SA-MP Forums Archive
/kick wont work? - 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: /kick wont work? (/showthread.php?tid=374530)



/kick wont work? - Socan - 03.09.2012

if(strcmp(cmd, "/kick", true) == 0) {
if(PlayerInfo[playerid][Level] >= 1) {
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, red, "{FF0000}Usage: {AAAAAA} /kick [playerid] [reason]");
return 1; }
new player1;
player1 = strval(tmp);
if(!IsPlayerConnected(player1) || player1 == INVALID_PLAYER_ID || (PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel]) ) {
SendClientMessage(playerid,red,"{FF0000}ERROR: {AAAAAA}: Player is not connected or is yourself");
return 1; }
tmp = strtok(cmdtext, idx);

GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
CMDMessageToAdmins(playerid,"KICK");
format(string,256,"{FF0000} %s has been kicked by %s reason: %s ",playername,adminname,cmdtext[7]); SendClientMessageToAll(grey,string);
SaveToFile("KickLog",string); Kick(player1);
} else {
SendClientMessage(playerid,red,NO_PERM); }
return 1; }



whats the prblem?


Re: /kick wont work? - Misiur - 03.09.2012

Do you get any output? Or after typing /kick nothing happens?


Re: /kick wont work? - Socan - 03.09.2012

It just says player is not connected or is yoursel and doesn't kick anyone


Re: /kick wont work? - shaniyal - 03.09.2012

have u compiled it after puting?


Re: /kick wont work? - Amit_B - 03.09.2012

pawn Код:
|| (PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel])
Are you sure about this part? try removing it.


Re: /kick wont work? - Socan - 03.09.2012

Yes compiled fine.


Re: /kick wont work? - Amit_B - 03.09.2012

Quote:
Originally Posted by Socan
Посмотреть сообщение
Yes compiled fine.
And it works in-game?


Re: /kick wont work? - Cjgogo - 03.09.2012

First of all why don't you use PAWN tags,so we can see the code easier,and second of all,it's time to switch to a new command system,like ZCMD,it would be a lot easier EVEN FOR A NEWBIE to script a kick command using ZCMD rather than strcmp,and also sscanf iis easier than strtok.


Re: /kick wont work? - Folder - 03.09.2012

use sscanf


Re: /kick wont work? - [MM]RoXoR[FS] - 03.09.2012

Are you max level admin?