19.10.2009, 09:07
I tried to make my own PM function, the code is like this:
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!
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;
}
Now, when i typed /pm [id] TEST in Game, there is nothing happened.
Why this doesn't work. Pleaze helpz, z0r!