SSCANF and DCMD on 0.3
#1

I tried to make my own PM function, the code is like this:

pawn Код:
dcmd_pm(playerid, params[])
{
    new string[128];
    new id;
    new message;
    new namax[MAX_PLAYERS];
    new namax2[MAX_PLAYERS];

    if(sscanf(params,"us",id,message))
    {
      SendClientMessage(playerid, COLOR_ERROR, "<~> Wrong Usage! Correct Usage: /pm <playerid> <message> <~>");
    }
    else if(id == INVALID_PLAYER_ID)
    {
      SendClientMessage(playerid, COLOR_ERROR, "<~> Player doesn't exist <~>");
    }
    else
    {
      GetPlayerName(playerid, namax, sizeof(namax));
      GetPlayerName(id, namax2, sizeof(namax2));
        format(string, sizeof(string), "[PM %s (%i) -> %s (%i)] %s", namax, playerid, namax2, id, message);
        SendClientMessage(l_green,playerid, string);
        format(string, sizeof(string), "[PM %s (%i) <- %s {%i)] %s", namax, id, namax2, playerid, message);
        SendClientMessage(l_green,id,string);
    }
    return 1;
}
And i got no error when compiling.
Now, when i typed /pm [id] TEST in Game, there is nothing happened.

Why this doesn't work. Pleaze helpz, z0r!
Reply


Messages In This Thread
SSCANF and DCMD on 0.3 - by virspector - 19.10.2009, 09:07
Re: SSCANF and DCMD on 0.3 - by Andom - 19.10.2009, 09:17
Re: SSCANF and DCMD on 0.3 - by Zeex - 19.10.2009, 09:22
Re: SSCANF and DCMD on 0.3 - by virspector - 19.10.2009, 09:26

Forum Jump:


Users browsing this thread: 1 Guest(s)