SA-MP Forums Archive
function doesnt work as i want it to 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: function doesnt work as i want it to work. (/showthread.php?tid=239742)



function doesnt work as i want it to work. - legodude - 14.03.2011

pawn Code:
forward CheckLevel(cmd[]);
public CheckLevel (cmd[])
{
    printf("%s",cmd);
    print("checklevel1");
    for(new i;i<216;i++)
    {
        if(!strcmp(cmd, Cmds[i][Name], true, strlen(cmd)))
        {
            print("checklevel2");
            printf("%s:%i",Cmds[i][Name],Cmds[i][Level]);
            return Cmds[i][Level];
        }
    }
    return 6;
}

forward LevelError(playerid,cmd[]);
public LevelError(playerid,cmd[])
{
    new str[128];
    printf("%s",cmd);
    print("LevelError1");
    format(str,sizeof(str),"ERROR:You need to be Administrator Level %d to use %s",CheckLevel(cmd),cmd);
    print("LevelError2");
    return SendClientMessage(playerid,red,str);
}
this doesnt work.
when i do /god (needs to be lvl 5.) i am lvl one. it just performs it. so it must be a fail in CheckLevel. but what??
help me!