problem with /kick cmd - 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: problem with /kick cmd (
/showthread.php?tid=199339)
problem with /kick cmd -
Face9000 - 15.12.2010
Hi all,i've 2 problems.
I created /kick cmd,i need add the reason too.
Ex: /kick playerid reason
And,i've my registration system with admin levels.
and the final code is:
Код:
if(strcmp("/kick", cmdtext, true, 5) == 0)
{
if(pInfo[playerid][AdminLevel] > 0)
if(!strlen(cmdtext[6])){
return SendClientMessage(playerid, COLOR_RED, "Correct usage: /kick [player id]");
}
new targetid = strval(cmdtext[6]);
if(IsPlayerConnected(targetid)){
new string[128], playername[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
GetPlayerName(targetid, targetname, MAX_PLAYER_NAME);
format(string, 128, "Admin %s kicked you from the server.", playername);
SendClientMessage(targetid, COLOR_YELLOW, string);
Kick(targetid);
format(string, 128, "Admin %s kicked %s from the server.", playername, targetname);
SendClientMessageToAll(0xFFAA00AA, string);
}
else{
return SendClientMessage(playerid, 0xFFAA00AA, "That player is not connected.");
}
}
else{
return SendClientMessage(playerid, 0xFFAA00AA, "No.");
}
return 1;
}
But i got errors:
Код:
C:\Documents and Settings\k\Desktop\SFWAR.pwn(171) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
C:\Documents and Settings\k\Desktop\SFWAR.pwn(171) : warning 215: expression has no effect
C:\Documents and Settings\k\Desktop\SFWAR.pwn(171) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\k\Desktop\SFWAR.pwn(171) : error 029: invalid expression, assumed zero
C:\Documents and Settings\k\Desktop\SFWAR.pwn(171) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
The enum of my registration system is:
Код:
enum pInfo
{
AdminLevel,
Cash,
Score,
}
Thanks.
Re: problem with /kick cmd -
Basicz - 15.12.2010
Umm...
I think the code is like this -
pawn Код:
enum playerInfo
{
AdminLevel,
Cash,
Score,
}
new pInfo[MAX_PLAYERS][playerInfo];
Re: problem with /kick cmd -
Face9000 - 15.12.2010
This:
Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
Re: problem with /kick cmd -
Basicz - 15.12.2010
Yep, like that.
EDIT:
If you used the PlayerInfo you showed, change the pInfo to PlayerInfo in your code.
Re: problem with /kick cmd -
Face9000 - 15.12.2010
Edit,working.Thanks.
Now i need to add the reason.
Any help?