22.02.2013, 18:30
Here is my code:
I also added 2 timers..
What do i do? i have been doing this all day, but dunno how to make player kicked / banned get the message :S
pawn Код:
CMD:kick(playerid, params[])
{
{
if(PlayerInfo[playerid][pAdmin] >= 3) {
new PID;
new reason[64];
new str[128];
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, Adminname, sizeof(Adminname));
GetPlayerName(PID, Playername, sizeof(Playername));
if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, DEEPPINK, "USAGE: /kick <playerid> <reason>");
if(!IsPlayerConnected(PID))return SendClientMessage(playerid, DEEPPINK, "Player is not connected!");
format(str, sizeof(str), "'%s' has been kicked by administrator '%s'. Reason: %s ", Playername, Adminname, reason);
SendClientMessageToAll(ORANGE, str);
Kick(PID);
}
else
{
SendClientMessage(playerid, DEEPPINK, "ERROR: You have to be level 3 to use that command!");
}
return 1;
}
}
CMD:ban(playerid, params[])
{
{
if(PlayerInfo[playerid][pAdmin] >= 5) {
new PID;
new reason[64];
new str[128];
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, Adminname, sizeof(Adminname));
GetPlayerName(PID, Playername, sizeof(Playername));
if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, DEEPPINK, "USAGE: /ban <playerid> <reason>");
if( PlayerInfo[ playerid ][ pAdmin ] < 5 ) return SendClientMessage( playerid, DEEPPINK, "ERROR: You must be level 5 to use this command!" );
if(!IsPlayerConnected(PID))
return SendClientMessage(playerid, DEEPPINK, "ERROR: Player is not connected.");
format(str, sizeof(str), "'%s' has been banned by administrator '%s'. Reason: %s ", Playername, Adminname, reason);
SendClientMessageToAll(ORANGE, str);
Ban(PID);
}
else
{
SendClientMessage(playerid, ORANGE, "ERROR: You have to be level 5 to use that command!");
}
return 1;
}
}
pawn Код:
forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }
stock KickWithMessage(playerid, message[])
{
SendClientMessage(playerid, RED, "'%s' has been kicked by administrator '%s'. Reason: %s ", Playername, Adminname, reason);
SetTimerEx("KickPublic", 1000, 0, "d", playerid);
}
forward BanPublic(playerid);
public BanPublic(playerid) { Ban(playerid); }
stock BanWithMessage(playerid, message[])
{
SendClientMessage(playerid, RED, "'%s' has been banned by administrator '%s'. Reason: %s ", Playername, Adminname, reason);
SetTimerEx("BanPublic", 1000, 0, "d", playerid);
}