Quote:
Originally Posted by pds2012
try this. hope it helps
pawn Код:
COMMAND:kick(playerid, params[]) { new id, reason[128] ; if(IsPlayerAdmin(playerid) || PInfo[playerid][pAdmin] < 0) return SendPM(playerid, -1,"You're Not Authorized to use this command"); if(sscanf(params, "us[128]", id,reason)) return SendPM(playerid, COLOR_GRAD2, "/kick [id] [reason]"); if(id == INVALID_PLAYER_ID) return SendPM(playerid, COLOR_GRAD2, "The player is disconnected"); format(string,sizeof(string),"AdmWrn: %s[%d] was kicked by %s[%d] reason: "COL_YELLOW"%s",PlayerName(id),id,PlayerName(playerid),playerid,reason); SendClientMessageToAll(COLOR_RED,string); Kick(id); return 1; }
Cheers
PDS2012
|
Thank you.
I'll check it out as soon i'll be at my place.
Quote:
Originally Posted by AndreT
A small bit of advice here: you should return 1 in the command. On every occasion, I mean, including the error cases. As SendPM is not a native function and we don't know its return value, you should resort to writing code like this:
pawn Код:
return SendPM(playerid, ..., "..."), true;
... to return true, when helping others in help topics.
Also, SendClientMessage does not have a documented return value. So this is why it should be preferred for practice.
|
I wondered about it too, Didnt knew how to properly do it.
Thank you.
Btw, the SendPM is SendClientMessage.