help with invalid id
#5

You don't want strtok AND sscanf, you only want sscanf! Let me fix it up for you! Will take a min or too, I'll pm you it incase you don't check back...

pawn Код:
dcmd_slap(playerid,params[])
{
    if(PlayerData[playerid][AdminLevel] < 2)
      {
      SendClientMessage(playerid,COLOR_YELLOW,"Not admin level 4");
      return 1;
      }
    new
      pid,
    if (sscanf(params, "u", pid))
        {
        SendClientMessage(playerid, COLOR_YELLOW, "use: /Slap [Player id number]");
        return 1;
        }
    if (IsPlayerConnected(pid) == 0)
      {
      SendClientMessage(playerid, COLOR_YELLOW, "Not online player");
      return 1;
      }
    else
      {
      new
            Float:posX,
            Float:posY,
            Float:posZ,
            name[MAX_PLAYER_NAME],
            pname2[MAX_PLAYER_NAME],
            string[128];
        GetPlayerName(pid,name,sizeof(name));
        GetPlayerName(playerid,pname2,sizeof(pname2));
        GetPlayerPos(pid, posX, posY, posZ);
        SetPlayerPos(pid, posX, posY, posZ+5);
        SetCameraBehindPlayer(pid);
        format(string,sizeof(string),"%s got slapped in the face by %s!",name,pname2);
        SendClientMessageToAll(COLOR_YELLOW, string);
        return 1;
        }
}
I've compiled it now, but I changed all your colors to COLOR_YELLOW< you'll want to change these back again probably.. I can't guarantee it'll work, but hey it compiles!

P.S I took out the reason bit, because you haven't used it yet, if you want it back i'll put it there...
Reply


Messages In This Thread
help with invalid id - by aaronishello - 10.05.2009, 17:12
Re: help with invalid id - by MenaceX^ - 10.05.2009, 17:15
Re: help with invalid id - by Weirdosport - 10.05.2009, 17:15
Re: help with invalid id - by aaronishello - 10.05.2009, 19:14
Re: help with invalid id - by Weirdosport - 10.05.2009, 20:59

Forum Jump:


Users browsing this thread: 1 Guest(s)