Problem with kick 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: Problem with kick command (
/showthread.php?tid=230389)
Problem with kick command -
spedico - 23.02.2011
pawn Код:
COMMAND:kick(playerid, params[])
{
if(PlayerInfo[playerid][pAdminLevel] < 1) return 0; // or just IsPlayerAdmin
new user, string[64];
if(!sscanf(params, "u", user))
{
format(string, sizeof(string), "%s has been kicked by an admin.", user);
printf(string);
SendClientMessageToAll(ADMIN, string);
SendClientMessage(user, RED, "You have been kicked by an admin.");
Kick(user);
}
else return SendClientMessage(playerid, RED, "USAGE: /kick id");
return 1;
}
When I start the server, this error pops up:
[16:12:33] Script[gamemodes/SGM.amx]: Run time error 19: "File or function is not found"
Yes I have all plugins/includes. The problem is probably with the sscanf stuff.
And yes, the problem is with that code. I commented it out and it worked fine.
Re: Problem with kick command -
armyoftwo - 23.02.2011
Make sure you have it in server.cfg
And make sure it loads
Re: Problem with kick command -
spedico - 23.02.2011
I have another command with sscanf and it works. So it's not that.
edit: also,
[16:30:11] sscanf plugin loaded.
edit2; works now.
Re: Problem with kick command -
Jochemd - 23.02.2011
pawn Код:
COMMAND:kick(playerid, params[])
{
if(PlayerInfo[playerid][pAdminLevel] < 1) return 0; // or just IsPlayerAdmin
new user, string[64];
if(!sscanf(params, "u", user))
{
new Playername[MAX_PLAYER_NAME];
GetPlayerName(user,Playername,sizeof(Playername));
format(string, sizeof(string),"%s has been kicked by an admin.", Playername);
print(string);
SendClientMessageToAll(ADMIN, string);
SendClientMessage(user, RED, "You have been kicked by an admin.");
Kick(user);
return 1;
}
else return SendClientMessage(playerid, RED, "USAGE: /kick id");
}
I'm not sure my changes are the problem but at least it's bugless now.
Re: Problem with kick command -
spedico - 23.02.2011
I got it working already. I didn't have the file extension in the server.cfg. Somehow my other command with sscanf worked..