SA-MP Forums Archive
Weird command fail (again...) - 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: Weird command fail (again...) (/showthread.php?tid=256627)



Weird command fail (again...) - Wesley221 - 21.05.2011

Hey guys,

Once again i messed up my script, and i dont know what i did wrong. I just added a simple command (akill), and then it was like poof bye bye admin script.. When i delete the akill command, it works 100%, and i dont get any problems

pawn Код:
dcmd_akill(playerid, params[])
    {
        new Player2;
        if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[AKILL])
        {
            new string[128];
            format(string, sizeof(string), "You must be a level %d administrator to use that command!", gCommands[AKILL]);
            SendClientMessage(playerid, COLOR_ORANGE, string);
        }
            else if (sscanf(params, "u", Player2)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /akill [playerid]");
            else if (Player2 == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ORANGE, "Player not Connected");
            else {
            SendClientMessage(Player2, COLOR_RED, "You have been killed by an admin");
            SetPlayerHealth(Player2, 0);
        }
        return 0;
    }
It is this command, there are no errors when i compile, just when i start up the server; it doesnt print the line i putted on OnFilterScriptInit (This is JUST when i HAVE the command in it, when i comment it; the line prints)

Anyone could check it?

Thanks
~Wesley


Re: Weird command fail (again...) - Wesley221 - 22.05.2011

Could anyone please check this?


Re: Weird command fail (again...) - xir - 22.05.2011

Try this out

pawn Код:
dcmd_akill(playerid, params[])
{
    new Player2, string[128];
    if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[AKILL])
    {
        if (sscanf(params, "u", Player2)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /akill [playerid]");
        if (Player2 == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ORANGE, "Player not Connected");
        SendClientMessage(Player2, COLOR_RED, "You have been killed by an admin");
        SetPlayerHealth(Player2, 0);
    }
    else format(string, sizeof(string), "You must be a level %d administrator to use that command!", gCommands[AKILL]);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    return 1;
}



Re: Weird command fail (again...) - Wesley221 - 22.05.2011

Nope, still doesnt print the line when i start the server...


Re: Weird command fail (again...) - xir - 22.05.2011

What are you trying to print?


Re: Weird command fail (again...) - Wesley221 - 22.05.2011

Its just a line in "OnFilterScriptInit", that prints a line that it loads my FS.. Just a test print to check if its working

pawn Код:
print("Admin System by Wesley");
Just that, so no big problem with that
The whole FS works, just when i add that command; it stops working


Re: Weird command fail (again...) - Wesley221 - 22.05.2011

So.. no one who knows the problem?


Re: Weird command fail (again...) - xir - 22.05.2011

Show OnPlayerFilterScriptInit


Re: Weird command fail (again...) - Wesley221 - 22.05.2011

pawn Код:
public OnFilterScriptInit()
    {
    print("This admin system have been made by Wesley");
       
        if(!fexist(CommandFile))
        {
            dini_Create(CommandFile);
            dini_IntSet(CommandFile, "Flip", 2);
            dini_IntSet(CommandFile, "Nitro", 2);
            dini_IntSet(CommandFile, "Fixme", 3);
            dini_IntSet(CommandFile, "Akill", 5);
        }

        gCommands[FLIP] = dini_Int(CommandFile, "Flip");
        gCommands[NITRO] = dini_Int(CommandFile, "Nitro");
        gCommands[FIXME] = dini_Int(CommandFile, "Fixme");
        gCommands[AKILL] = dini_Int(CommandFile, "Akill");
        return 1;
    }



Re: Weird command fail (again...) - Wesley221 - 23.05.2011

Anyone knows?