Admin system problem
#1

Um... I already do a register/login system. But when i do /setlevel [id]. The %s.ini file looks like this :S

Код:
Admin = 3
[data]
Password = 731514188
Cash = 0
Admin = 0
Kills = 0
Deaths = 0
Score = 0
What is wrong??

Here is the setlevel thingy:

pawn Код:
CMD:setlevel(playerid, params[])
{
    new id, level;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1,"SERVER: You must be an admin.");
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "SERVER: Player not connected.");
    if(id == playerid) return SendClientMessage(playerid, -1, "SERVER: You cant set yourself an admin. Use /setadmin.");
    if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, "Usage: /setlevel [id] [level]");
    if(level > 5) return SendClientMessage(playerid, -1, "SERVER: Level is too high. [0/5]");
    new INI:File = INI_Open(UserPath(id));
    INI_WriteInt(File,"Admin",level); // Is this the problem ???
    INI_Close(File);
    return 1;
}
Pls help
Thanks!
Reply
#2

What's is your problem ? Does the adminlevel not save.

Where is the User Path ? \scriptfiles\.... and i need the stock UserPath(playerid)
Reply
#3

I recomment of using enums and save them on OnGameModeExit / OnFilterScriptExit / OnPlayerDisconnect o.O
Why did players always save it while they are playing ? i know sometimes it's a good way but not all the times
Reply
#4

Try

pawn Код:
CMD:setlevel(playerid, params[])
{
    new id, level;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1,"SERVER: You must be an admin.");
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "SERVER: Player not connected.");
    if(id == playerid) return SendClientMessage(playerid, -1, "SERVER: You cant set yourself an admin. Use /setadmin.");
    if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, "Usage: /setlevel [id] [level]");
    if(level > 5) return SendClientMessage(playerid, -1, "SERVER: Level is too high. [0/5]");
    PlayerInfo[id][Admin] == level;
    return 1;
}
Change the PlayerInfo for you info ofplayer..
if i help give me rep
Reply
#5

OMG. You helped me s4uKL! 1 Rep For ya!

And one mistake that you've done. Its
pawn Код:
PlayerInfo[id][Admin] = level;
Not
pawn Код:
PlayerInfo[id][Admin] == level;
NVM

CHEERS mate!
Reply
#6

sorry.
Reply
#7

Its ok
Reply
#8

You didn't set a tag in the command.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)