Error - 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)
+--- Thread: Error (
/showthread.php?tid=435829)
Error -
NathNathii - 08.05.2013
// Fixed.
Re: Error -
Yashas - 08.05.2013
The identifiers are case sensitive in PAWN.Capital Letters do matter a lot here.
Just change ReasonMSG to ReasonMsg and its fixed.
Re: Error -
NathNathii - 08.05.2013
-___- Thx.
Re: Error -
NathNathii - 08.05.2013
EDIT
When I first tried the command it gave me why I got kicked in the chat.
But now it only gives me the gametextforplayer "KICKED!".
pawn Код:
CMD:kick(playerid, params[])
{
new PlayerToKick, Reason[128], ReasonMsg[128], Name[24];
SendAdminText(playerid, "/kick", params);
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerLevel] >= 1)
{
if (sscanf(params, "us[128]", PlayerToKick, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/kick [id] [reason]\"");
else
if (IsPlayerConnected(PlayerToKick))
{
GameTextForPlayer(playerid,"~r~KICKED!",5000,3);
GetPlayerName(playerid, Name, sizeof(Name));
GameTextForPlayer(playerid,"~r~KICKED!",5000,3);
SendClientMessage(playerid, 0xFF0000, "You have been kicked by an Adminstrator - Reason: %s", ReasonMsg);
Kick(PlayerToKick);
}
else
SendClientMessage(playerid, 0xFF0000FF, "{FF0000}Error: {FFFFFF}No player with that ID!");
}
else
return 0;
}
else
return 0;
return 1;
}
Re: Error -
Yashas - 08.05.2013
You can't give format in SendClientMessage.It doesn't accept the specifiers.So you must use format(string,length,"format",....); then call the SendClientMessage.
https://sampwiki.blast.hk/wiki/Format
And the next issues is all client message will not be shown just before Kick();
So you must use a timer to Kick the player.
Код:
SetTimerEx("KickPlayer",1000,0,"i",playerid);
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
Kick(playreid);
}
Re: Error -
NathNathii - 08.05.2013
Still same thing, but it only says 'Server closed the connection.".