something weird..
#1

Код:
  if(strcmp(cmd, "/mswat", true) == 0) // Admin Slap
  {
	  if(IsPlayerAdmin(playerid)==1)
	  {
      tmp = strtok(cmdtext, idx);
      if(!strlen(tmp))
			{
        SendClientMessage(playerid, COLOR_ERROR, "USAGE: /mswat (id)");
        return 1;
      }
      giveplayerid = strval(tmp);
      if(!IsNumeric(tmp))
		  {
        SendClientMessage(playerid, COLOR_ERROR, "USAGE: /mswat (id) ID Must be a number");
        return 1;
      }
      if(!IsPlayerConnected(giveplayerid))
		  {
        format(string, sizeof(string), "ID (%d) Is not an active player",giveplayerid);
        SendClientMessage(playerid, COLOR_ERROR, string);
        return 1;
      }
      SendClientMessage(giveplayerid,0xFF7F50AA,"You have been given swat rights, you can now join the swat team!");
      GetPlayerName(giveplayerid,name,sizeof(name));
	    format(string,sizeof(string),"You have given %s swat rights!!",name);
	    SendClientMessage(playerid, COLOR_YELLOW, string);
      swat[giveplayerid] = 1;
      return 1;
    }
    return 1;
  }
Ingame, when i use the command i always get the message: USAGE: /mswat (id); even if i type something like /mswat 1. Whats wrong?
Reply
#2

Check your strtok or maybe some things above this command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)