adding reason to kick & ban?
#1

how do i add a reason to these commands

thanks


Код:
COMMAND:kick(playerid,params[])
{
	new playerid2,PlayerName[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
	new tmp[256], Index, str[49];
	tmp = strtok(params,Index), playerid2 = strval(tmp);
	GetPlayerName(playerid2,on,sizeof(on));
	GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
	if(Account[playerid][Level] < 2) return SendClientMessage(playerid,Yellow,"You need to be level 2 to use this command!");
	if (sscanf(params, "u", playerid2)) return SendClientMessage(playerid, Yellow, "Usage: /kick id");
	if(!IsPlayerConnected(playerid2))return SendClientMessage(playerid,Yellow,"Player is not connected!");
	format(str,sizeof(str),"%s has kicked %s",PlayerName,on);
	SendClientMessageToAll(Blue,str);
	Kick(playerid2);
	return 1;
}
COMMAND:ban(playerid,params[])
{
	new playerid2, PlayerName[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
	new tmp[256], Index, string[49];
	tmp = strtok(params,Index), playerid2 = strval(tmp);
	GetPlayerName(playerid2,on,sizeof(on));
	GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
	if(Account[playerid][Level] < 3) return SendClientMessage(playerid,Yellow,"You need to be level 3 to use this command!");
	if (sscanf(params, "u", playerid2)) return SendClientMessage(playerid, Yellow, "Usage: /ban id");
	if(!IsPlayerConnected(playerid2))return SendClientMessage(playerid,Yellow,"Player is not connected!");
	format(string,sizeof(string),"Admin %s has banned %s",PlayerName,on);
	SendClientMessageToAll(Yellow,string);
	Ban(playerid2);
	return 1;
}
Reply
#2

pawn Код:
COMMAND:kick(playerid,params[])
{
    new playerid2,PlayerName[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
    new tmp[256], Index, str[49], reason[106];
    tmp = strtok(params,Index), playerid2 = strval(tmp);
    GetPlayerName(playerid2,on,sizeof(on));
    GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
    if(Account[playerid][Level] < 2) return SendClientMessage(playerid,Yellow,"You need to be level 2 to use this command!");
    if (sscanf(params, "uS(No Reason Given)[128]", playerid2, reason)) return SendClientMessage(playerid, Yellow, "Usage: /kick id reason");
    if(!IsPlayerConnected(playerid2))return SendClientMessage(playerid,Yellow,"Player is not connected!");
    format(str,sizeof(str),"%s has kicked %s Reason: %s",PlayerName,on, reason);
    SendClientMessageToAll(Blue,str);
    Kick(playerid2);
    return 1;
}
COMMAND:ban(playerid,params[])
{
    new playerid2, PlayerName[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
    new tmp[256], Index, string[49], reason[106];
    tmp = strtok(params,Index), playerid2 = strval(tmp);
    GetPlayerName(playerid2,on,sizeof(on));
    GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
    if(Account[playerid][Level] < 3) return SendClientMessage(playerid,Yellow,"You need to be level 3 to use this command!");
    if (sscanf(params, "uS(No Reason Given)[128]", playerid2, reason)) return SendClientMessage(playerid, Yellow, "Usage: /ban id reason");
    if(!IsPlayerConnected(playerid2))return SendClientMessage(playerid,Yellow,"Player is not connected!");
    format(string,sizeof(string),"Admin %s has banned %s Reason: %s",PlayerName,on, reason);
    SendClientMessageToAll(Yellow,string);
    Ban(playerid2);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)