PDA

View Full Version : ZCMD To Strcmp [+REP]


Frank Biohazard
02/03/2012, 02:44 PM
my script won't run this one
new Siren[MAX_VEHICLES];
new SirenObject[MAX_VEHICLES];






CMD:siren(playerid, params[])
{
if(IsACop(playerid))
{
new string[128], type;
new VID = GetPlayerVehicleID(playerid);
if(sscanf(params, "d", type))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /siren [type]");
SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = Inside, 2 = Roof, 3 = Off.");
return 1;
}
switch(type)
{
case 1:
{
if(Siren[VID] == 1)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
return 1;
}
new sendername[MAX_PLAYER_NAME];
Siren[VID] = 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
format(string, sizeof(string), "* %s puts the siren on the dashboard.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
return 1;
}
case 2:
{
if(Siren[VID] == 1)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
return 1;
}
Siren[VID] = 1;
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
format(string, sizeof(string), "* %s puts the siren on the roof.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
return 1;
}
case 3:
{
if(Siren[VID] == 0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle doesn't have a siren on it!");
return 1;
}
Siren[VID] = 0;
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
DestroyObject(SirenObject[VID]);
format(string, sizeof(string), "* %s takes down the siren.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
return 1;
}
default:
{
SendClientMessageEx(playerid, COLOR_WHITE, "Invalid license type! /siren [type]");
SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = Roof, 2 = Inside, 3 = Off.");
}
}
}
else SendClientMessageEx(playerid, COLOR_GREY, "You're not authorised to use this command.");
return 1;


now i have it on zcmd, and it works but i can't add it in my script because im working with the other one

all my commands are with if (strcmp("/siren", cmdtext, true, 10) == 0)

but that full script is in ZCMD
can some one fix this one, and if it's possible with the right align's
i would be so happy!

thimo
02/03/2012, 02:45 PM
Change this: CMD:siren(playerid, params[])
into this: if (strcmp("/siren", cmdtext, true, 10) == 0) You did the work for yourself already -.-

Vince
02/03/2012, 02:46 PM
No. It's like installing Windows95 on a Windows 7 PC. Do it the other way round.

Frank Biohazard
02/03/2012, 02:50 PM
Change this: CMD:siren(playerid, params[])
into this: if (strcmp("/siren", cmdtext, true, 10) == 0) You did the work for yourself already -.-
if i do that, it say's compailer libary won't work anymore.

what to do.

BigD
02/03/2012, 03:12 PM
if(strcmp(cmd, "/siren", true) == 0)
{
if(!IsValidObject(Siren[playerid]))
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
{
new siren[65];
new VID = GetPlayerVehicleID(playerid);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /siren [inside, roof, nothing]");
SendClientMessage(playerid, COLOR_GREY, "[INFO]: 'nothing' will remove the item from your vehicle!");
return 1;
}
strmid(siren, tmp, 0, strlen(cmdtext), 255);
if(strcmp(siren, "inside", true, strlen(siren)) == 0)
{
if(Siren[playerid] != INVALID_OBJECT_ID)
{
if(VID != 426) { return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to be in a Premier model!"); } // If he's not in a Premier...
GetPlayerName(playerid, sendername, sizeof(sendername));
Siren[playerid] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(Siren[playerid], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0); // Inside - Premier
format(string, sizeof(string), "* %s puts the siren on the dashboard.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
} else { return SendClientMessage(playerid, COLOR_GREY, "[INFO]: You do already have a siren..."); }
}
else if(strcmp(siren, "roof", true, strlen(siren)) == 0)
{
if( Siren[playerid] != INVALID_OBJECT_ID )
{
if(VID != 426) { return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to be in a Premier model!"); } // If he's not in a Premier...
GetPlayerName(playerid, sendername, sizeof(sendername));
Siren[playerid] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(Siren[playerid], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0); // tak - Premier
format(string, sizeof(string), "* %s puts the siren on the roof.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
} else { return SendClientMessage(playerid, COLOR_GREY, "[INFO]: You do already have a siren..."); }
}
else if(strcmp(siren, "nothing", true, strlen(siren)) == 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
DestroyObject(Siren[playerid]);
format(string, sizeof(string), "* %s takes down the siren.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}
} else { SendClientMessage(playerid, COLOR_GREY, "[INFO]: Are you a cop?"); }
}
return 1;
} edit the variables to fit your script.

Frank Biohazard
02/03/2012, 03:44 PM
it keep saying pawno doesn't work anymore, i think there are to much error's if i add it.

FalconX
02/03/2012, 03:48 PM
it keep saying pawno doesn't work anymore, i think there are to much error's if i add it.

Again, I am repeating, Zcmd will not work with Strcmp. You have to remove ZCMD if you want to use Strcmp, and remove strcmp if you want to use Zcmd.. If you know what i mean..

-FalconX

Frank Biohazard
02/03/2012, 03:50 PM
i have both but not #included, at the other script i have not ZCMD included, and if i run this one with ZCMD in filterscript INCLUDED i need to add more new and included but i don't know what to add, so i wanna use this script but i can't cause of the zmcd and strcmp

how will it work

Chrillzen
02/03/2012, 05:45 PM
You can't use zcmd and strcmd in one script, you can run zcmd in a filterscript and strcmd in a gamemode but it might turn out to be buggy.

Max_Coldheart
02/03/2012, 05:53 PM
The compiler goes to the "not responding" state when it's compiling. Give it some time, this is absolutely normal.

Frank Biohazard
02/03/2012, 08:26 PM
So you'r code works in strcmp, cause i need that xode translated to strcmp

Walsh
02/03/2012, 09:41 PM
:picard:

Don't use strcmp! ZCMD is perfect. Like Vince said it's like installing Windows 95 on a Windows 7 PC.

Frank Biohazard
03/03/2012, 10:04 AM
Walsh u don't understand that my gamemode script is running on STRCMP i can't translate 50k lines into ZCMD.

i need this command as STRCMP

Frank Biohazard
03/03/2012, 10:32 AM
compailer says no error's but if i do /siren nothing will happend, it says no command.

Shadow_
03/03/2012, 10:48 AM
Frank, you can very easily convert 50k lines into ZCMD its not hard.

http://forum.sa-mp.com/showpost.php?p=1698197&postcount=16

Walsh
03/03/2012, 02:03 PM
Stop using the NGRP script.