Admin system problem - 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)
+--- Thread: Admin system problem (
/showthread.php?tid=390021)
Admin system problem -
Deaglez - 04.11.2012
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!
AW: Admin system problem -
Skimmer - 04.11.2012
What's is your problem ? Does the adminlevel not save.
Where is the User Path ?
\scriptfiles\.... and i need the stock
UserPath(playerid)
Re: Admin system problem -
Tigerkiller - 04.11.2012
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
Re: Admin system problem -
s4kuL - 04.11.2012
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
Re: Admin system problem -
Deaglez - 04.11.2012
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!
Re: Admin system problem -
s4kuL - 04.11.2012
sorry.
Re: Admin system problem -
Deaglez - 04.11.2012
Its ok
Re: Admin system problem -
tyler12 - 04.11.2012
You didn't set a tag in the command.