Problem with kick command
#1

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.
Reply
#2

Make sure you have it in server.cfg
Код:
plugins sscanf.dll
And make sure it loads
Reply
#3

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.
Reply
#4

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.
Reply
#5

I got it working already. I didn't have the file extension in the server.cfg. Somehow my other command with sscanf worked..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)