Posts: 118
Threads: 48
Joined: Jul 2010
Reputation:
0
I searched 'kick' and 'ban' on SAMP Wiki and it told me how to ban/kick myself, but I want it to be like this: /kick [playerid] [reason], and then when it kicks/bans them it says to all players
'AdmCmd: Adminname has kicked/banned playername, Reason: reason'
Also must be logged into RCON.
Any ideas?
Posts: 734
Threads: 8
Joined: Jun 2009
I suggest you to use
zcmd+
sscanf2
The example code will look like:
pawn Код:
CMD:kick(playerid, params[])
{
new
string[128],
reason[64],
sendername[MAX_PLAYER_NAME],
giveplayername[MAX_PLAYER_NAME],
giveplayerid;
if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, 0xBFC0C2FF, "USAGE: /kick [playerid/PartOfName] [reason]");
if(IsPlayerAdmin(playerid)
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "-| Administrator %s kicked %s. [Reason: %s ] |-", sendername, giveplayername, reason);
//SendClientMessageToAdmins(ADMIN_RED, string, 1);
SendClientMessageToAll(0x00000FF, string);
Kick(giveplayerid);
}
}
else
{
SendClientMessage(playerid, 0x00000FF, "You must be logged in to RCON !");
}
return 1;
}
Posts: 734
Threads: 8
Joined: Jun 2009
Well then if your GameMode does not have many lines, I strongly suggest you to start using zcmd+sscanf in combination with foreach, as speed and efficiency wins!
Posts: 18
Threads: 0
Joined: Oct 2010
Reputation:
0
that is good to male your own admin system
Posts: 1,130
Threads: 77
Joined: Jan 2010
Reputation:
0
You should switch to sscanf and zcmd.. with strcmp and strok is more difficult and less efficient.