SA-MP Forums Archive
help - 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: help (/showthread.php?tid=248474)



help - omer5198 - 14.04.2011

i tried to make my own Include because i wanted to make a FS with something there is in my GM(levels)
so i did this:
Код:
stock PlayerLevel(playerid, level)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new file[256], tmp;
format(file, 256, "MyGameMode/Users/%s.ini", udb_encode(name));
tmp = dini_Int(file, "Level");
if((IsPlayerConnected(playerid)) && tmp >= level)
return true;
else return false;
}
^^this is in my include... what's wrong with it? when i did:
Код:
if(PlayerLevel(playerid, 1))
{
...
...
...
}
else
{
...
}
it didn't work! it always did what i wrote in the "else". plz help! (it suppose to check if the player is level 1 or more


Re: help - Stigg - 14.04.2011

Try:
pawn Код:
if(PlayerLevel(playerid) == 1)



Re: help - Voldemort - 14.04.2011

pawn Код:
stock GetPlayerLevel(playerid)
{
    if((IsPlayerConnected(playerid))
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        new file[256],level;
        format(file, 256, "MyGameMode/Users/%s.ini", udb_encode(name));
        level = dini_Int(file, "Level");
        return level;
    }
    return -1;
}
CHeck if he is connected first, and than try to get name