Save admin level - 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: Save admin level (
/showthread.php?tid=497850)
Save admin level -
Vasu99 - 28.02.2014
Howdydoo! This time I haven't got an actual problem, which is great as I always bring problems whenever I make a topic! Anyhow, this time I need help with actually saving the admin position that a player is appointed, because right now it just vanishes as soon as the player logs out. The script for the command will be posted below.
Код:
CMD:setlevel(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xF69521AA,"You can't use this command!");//Checking if the player is rcon admin to set an admin level
new id, level;//Creating the id variable to store the selected id and a level variable for the chosen admin level.
if(sscanf(params,"ui",id,level)) return SendClientMessage(playerid,0xF69521AA,"USAGE: /setlevel <id> <level(1-4)>");//Check if the player inputted a username or id and a admin level.
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xF69521AA,"The specified player is currently not connected!");//Checking if the selected user is connected or not.
if (!(0 <= level <= 4)) return SendClientMessage(playerid,0xF69521AA,"Please specify an admin level between 0 and 4");
new file[64],PlayerName[24];//Creating a variable to store the file path, and a variable to store the players name.
GetPlayerName(id,PlayerName,sizeof PlayerName);//Retrieving the selected id's name,
format(file,sizeof file,"Admin/%s.ini",PlayerName);
PlayerInfo[id][Level] = level;
SendClientMessage(playerid,0xF69521AA,"You have successfully changed the selected user's admin level");
SendClientMessage(id,0xF69521AA,"Your admin level has successfully been changed, congratulations!");
return 1;
}
Cheers!
Re: Save admin level -
Ahmad45123 - 28.02.2014
are you sure you are saving his stats when logging off, at OnPlayerDisconnect
Re: Save admin level -
Vasu99 - 28.02.2014
I'm sure I am not doing that, as I do not know how to do it, haha!
Could somebody help me out with that?
Re: Save admin level -
Golimad - 28.02.2014
Hello sir,
This might help you to save player's data instead of ( Admins/%s.ini ) You can save all data in one file ( User/%s.ini ) and it may contain maybe data such as ( Vip, Money, death, kills, score .... )
https://sampforum.blast.hk/showthread.php?tid=352703
Re: Save admin level -
Vasu99 - 28.02.2014
Thanks Golimad!