SendClientMessageToAll Help
#4

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.
Reply


Messages In This Thread
SendClientMessageToAll Help - by ofir060 - 01.03.2013, 17:04
Re: SendClientMessageToAll Help - by Patrick - 01.03.2013, 17:11
Re: SendClientMessageToAll Help - by AndreT - 01.03.2013, 17:29
Re: SendClientMessageToAll Help - by ofir060 - 01.03.2013, 18:43
Re: SendClientMessageToAll Help - by ofir060 - 01.03.2013, 19:42
Re: SendClientMessageToAll Help - by Patrick - 01.03.2013, 20:17
Re: SendClientMessageToAll Help - by AndreT - 01.03.2013, 21:57
Re: SendClientMessageToAll Help - by ofir060 - 01.03.2013, 23:12
Re: SendClientMessageToAll Help - by mittukuttan - 02.03.2013, 03:30
Re: SendClientMessageToAll Help - by Denying - 02.03.2013, 06:08

Forum Jump:


Users browsing this thread: 1 Guest(s)