Stuck with a simple admin command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Stuck with a simple admin command (
/showthread.php?tid=228287)
Stuck with a simple admin command -
OldDirtyBastard - 19.02.2011
Its realy embarasing, i have no clue what should i try next,
pawn Код:
CMD:kick(playerid, params[])
{
new pid, reason[64];
if(sscanf(params, "us", pid, reason)) return SendClientMessage(playerid, 0xFF0000AA, "Command Usage: /kick [playerid] [reason]");
if ( GetPVarInt( playerid, "Level" ) < 2 )
return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} You are not allowed to use this command.");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, -1, "ERROR: That player is not connected.");
new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180];
GetPlayerName(pid, paramname, sizeof(paramname));
GetPlayerName(playerid, adminname, sizeof(adminname));
format(string, sizeof(string), "Administrator %s has kicked %s. Reason: %s", adminname, paramname, reason);
SendClientMessageToAll(-1, string);
Kick(pid);
return 1;
}
I doesnt wants to print the reason why the player got kicked.
I cant use params[1] because its not suitable for sscanf and it prints a string warning.
Can anyone tell me what im doing wrong please?
Thanks, regards.
Re: Stuck with a simple admin command -
Mokerr - 19.02.2011
pawn Код:
CMD:kick(playerid, params[])
{
new pid, reason[64];
if(sscanf(params, "us[64]", pid, reason)) return SendClientMessage(playerid, 0xFF0000AA, "Command Usage: /kick [playerid] [reason]");
if ( GetPVarInt( playerid, "Level" ) < 2 )
return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} You are not allowed to use this command.");
if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, -1, "ERROR: That player is not connected.");
new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180];
GetPlayerName(pid, paramname, sizeof(paramname));
GetPlayerName(playerid, adminname, sizeof(adminname));
format(string, sizeof(string), "Administrator %s has kicked %s. Reason: %s", adminname, paramname, reason);
SendClientMessageToAll(-1, string);
Kick(pid);
return 1;
}
Re: Stuck with a simple admin command -
OldDirtyBastard - 19.02.2011
Thanks.