GiveAllWeapons with strcmp?
#1

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.
Reply
#2

pawn Код:
if(weaponid < 1 || weaponid > 46) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /giveallweapons [weaponid]");
Reply
#3

I am not saying its not showing the message,its showing the message when i fill in the right command.
Reply
#4

so if i do /giveallweapons 20 for ex then it appears /giveallweapons [weaponid]
Reply
#5

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);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)