sscanf error: System not initialised.
#1

Hey, i'm having some problems with my admin system...
First of all, i should log in to RCON to make myself admin, but i dont need too, i can still use some admin commands.
Also when i use the command /ban and /kick it shows me how to use the command, it should show [WARNING] You cannot use this command, but it doesnt it just shows me how to perform the command...
Also, i get this in the server console sscanf error: System not initialised. is this the problem?

Please help, thanks in advance.
Reply
#2

Show bugged cmds, and full server log.

Sscanf error could be related, but i am not sure even i don't see commands and log.

Code:
#include <sscanf2>

#if !defined _ALS_OnGameModeInit || !defined SSCANF_Init
    #error You're using the wrong include somehow.
#endif
Reply
#3

Okay, anyways it looks like that i'm not an administrator but somehow i can still perform the commands and when i use /ban on someone it still doesnt work and shows the USAGE of the command, here's the server log and the script.
Also added some explanations in the script so you know what they do.

Admin Script: http://pastebin.com/H4d7WMGF
Server Log: http://pastebin.com/4UtPgZaK
Reply
#4

double post, sorry.
Reply
#5

Sscanf error could be related on not re-compiled filterscripts to your gamemode sscanf version, so the sscanf version does not match; about the commands params bug (usage) it's related to sscanf, as it can't be loaded and params can't be declaired.
The command permission bug is related too on a 'return' issue.

Kick cmd fixed on permissions:

Code:
COMMAND:kick(playerid,params[])
{
    if(pInfo[playerid][Adminlevel] >= 2)
    {
        new id;
        new reason;
        if(sscanf(params,"u",id,reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /kick [playerid] [reason]");
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "This id isnt online!");
        if(pInfo[playerid][Adminlevel] < pInfo[id][Adminlevel]) return SendClientMessage(playerid,COLOR_RED,"You can't kick a higher admin level than you");
        Kick(id);
        SendClientMessage(playerid, 0x33AA33AA, "[ADMIN] You have succesfully kicked the player!");
    } else return SendClientMessage(playerid, COLOR_RED, "You must be atleast admin level 2 in order to use this command !");
    return 1;
}
Try to fix your sscanf bug, by downloading the latest include and plugin version, and recompiling gamemode + all filterscripts.

+REP If i helped you.

Regards,
Rodri.
Reply
#6

Quote:
Originally Posted by xEF
View Post
Sscanf error could be related on not re-compiled filterscripts to your gamemode sscanf version, so the sscanf version does not match; about the commands params bug (usage it's related to sscanf, as it can't be loaded and params can't be declaired.
The cmds bug is related too on 'return' issue.

Kick cmd fixed:

Code:
COMMAND:kick(playerid,params[])
{
    if(pInfo[playerid][Adminlevel] >= 2)
    {
        new id;
        new reason;
        if(sscanf(params,"u",id,reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /kick [playerid] [reason]");
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "This id isnt online!");
        if(pInfo[playerid][Adminlevel] < pInfo[id][Adminlevel]) return SendClientMessage(playerid,COLOR_RED,"You can't kick a higher admin level than you");
        Kick(id);
        SendClientMessage(playerid, 0x33AA33AA, "[ADMIN] You have succesfully kicked the player!");
    } else return SendClientMessage(playerid, COLOR_RED, "You must be atleast admin level 2 in order to use this command !");
    return 1;
}
Try to fix your sscanf bug, downloading the latest include and plugin version, and recompiling gamemode + all filterscripts.

+REP If i helped you.

Regards,
Rodri.
Thanks, i'l try it anyways you've been really helpfull, since im new in SA:MP forums how do i +REP?
Reply
#7

Thanks.

Best Regards,
Rodri.
Reply
#8

Hi,
I'v fixed all the bugs, and added more features, thanks for the help.
Reply
#9

Hey wait, u forgot to add some thing very important to your code.
[Pawn]COMMAND:kick(playerid,params[])
{
if(pInfo[playerid][Adminlevel] >= 2)
{
new id;
new reason;
if(sscanf(params,"u",id,reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /kick [playerid] [reason]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "This id isnt online!");
if(pInfo[playerid][Adminlevel] < pInfo[id][Adminlevel]) return SendClientMessage(playerid,COLOR_RED,"You can't kick a higher admin level than you");
Kick(id);
SendClientMessage(playerid, 0x33AA33AA, "[ADMIN] You have succesfully kicked the player!");
} else return SendClientMessage(playerid, COLOR_RED, "You must be atleast admin level 2 in order to use this command !");
return 1;
}[\pawn]
[B]what's wrong?
Good question.
Firwt of all, n

New reason; must be new reason[string limit];
Ex: new reason[100];
Second:
pawn Code:
if(sscanf(params,"u",id,reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /kick [playerid] [reason]");
It must be
pawn Code:
if(sscanf(params,"us",id,reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /kick [playerid] [reason]");
Why did i add "s" ?
Because u made reaso, and you forgot to make a varible for him, like you did with the "u" because the u is id,tho it will make the id .[b]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)