Confused about admin save - 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: Confused about admin save (
/showthread.php?tid=246551)
Confused about admin save -
cruising - 04.04.2011
Hello!
Im a bit confused how to get this to work. I want your admin level to get saved in your usefile.
Info like this was no problem
pawn Код:
Password=0
Member=0
Leader=0
Status=0
Request=0
IsRequesting=0
Score=0
But info like this i cant figure out how to get saved.
pawn Код:
enum pInfo
{
Money,
Admin,
Level,
Vip,
Spawn,
};
Here is the setadmin code, there is no problem with it. You get admin rights... but it just not geting saved.
pawn Код:
CMD:setadmin(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][Admin] >= 5)
{
new sendername[MAX_PLAYER_NAME];
new giveplayername[MAX_PLAYER_NAME];
new giveplayerid,level;
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
if (!sscanf(params, "ii", giveplayerid,level))
{
if (giveplayerid != INVALID_PLAYER_ID)
{
new string[128];
format(string, sizeof(string), "The admin %s has made you a level %d admin",sendername,level);
SendClientMessage(giveplayerid, COLOR_GRAD1, string);
format(string, sizeof(string), "You have made %s a level %d admin",giveplayername,level);
SendClientMessage(playerid, COLOR_GRAD1, string);
PlayerInfo[giveplayerid][Admin] = level;
}
}
else SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setadmin [playerid] [level]");
}
else SendClientMessage(playerid, 0xFF0000FF, "You are not an level 5, or not a Admin!");
}
return 1;
}
Here is the part of what confuse me. I dont use OnPlayerConnect, so i must put this things somewhere else to get it saved in the userfiles, but how?
pawn Код:
/*new gPlayerAccount[MAX_PLAYERS];*/
/*public OnPlayerConnect(playerid)
{
PlayerInfo[playerid][Level] = 0;
PlayerInfo[playerid][Money] = 0;
PlayerInfo[playerid][Vip] = 0;
PlayerInfo[playerid][Admin] = 0;
PlayerInfo[playerid][Spawn] = 0;
format(file, sizeof(file), "/Users/%s.ini", playername3);
if(dini_Exists(string))
{
gPlayerAccount[playerid] = 1;
}
else
{
gPlayerAccount[playerid] = 0;
}
return 1;
}*/
I just cant get how to do to get it to work properly, any suggestions?