GiveAllWeapons with strcmp? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: GiveAllWeapons with strcmp? (
/showthread.php?tid=342250)
GiveAllWeapons with strcmp? -
Admigo - 13.05.2012
Heey all,
I am helping a friend with a giveallweapons command and he wants to have his command with strcmp.
I never used strcmp because i am using dcmd so i used the dance code for the params.
Код:
new cmd[256];
new idx;
new weaponid;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/giveallweapons", true) == 0)
{
cmd = strtok(cmdtext, idx);
tmp = strtok(cmdtext, idx);
weaponid = strval(tmp);
if(weaponid < 1 || weaponid > 46) {
SendClientMessage(playerid,0xFF0000FF,"USAGE: /giveallweapons [weaponid]");
return 1;
}
But why it gives the message everytime when i fill in the right code :/giveallweapons 2 it says the error message^
I didnt show the whole code because its only about that message showing when you fill right id.
Re: GiveAllWeapons with strcmp? -
JaKe Elite - 13.05.2012
pawn Код:
if(weaponid < 1 || weaponid > 46) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /giveallweapons [weaponid]");
Re: GiveAllWeapons with strcmp? -
Admigo - 13.05.2012
I am not saying its not showing the message,its showing the message when i fill in the right command.
Re: GiveAllWeapons with strcmp? -
Dan_Barocu - 13.05.2012
so if i do /giveallweapons 20 for ex then it appears /giveallweapons [weaponid]
Re: GiveAllWeapons with strcmp? -
Vince - 13.05.2012
Tell your friend to move on. DCMD can be used together with strcmp; if he does not intend to switch to ZCMD.
Anyway, remove the second occurrence of
pawn Код:
cmd = strtok(cmdtext, idx);