public LoadUser_data(playerid,name[],value[]) { INI_Int("Password",PlayerInfo[playerid][pPass]); INI_Int("Cash",PlayerInfo[playerid][pCash]); INI_Int("Admin",PlayerInfo[playerid][pAdmin]); INI_Int("Model",PlayerInfo[playerid][pModel]); INI_Int("Muted",PlayerInfo[playerid][pMuted]); INI_Int("Locked",PlayerInfo[playerid][pLocked]); INI_Int("Warns",PlayerInfo[playerid][pWarns]); INI_Int("Tester",PlayerInfo[playerid][pTester]); INI_Int("Kills",PlayerInfo[playerid][pKills]); INI_Int("Deaths",PlayerInfo[playerid][pDeaths]); return 1; }
if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Welcome To [DU]",""COL_WHITE"Type your password below to login.","Login","Quit"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Welcome To [DU]",""COL_WHITE"Type your password below to register a new account.","Register","Quit"); }
new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)); INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]); INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]); INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]); INI_WriteInt(File,"Locked",PlayerInfo[playerid][pLocked]); INI_WriteInt(File,"Warns",PlayerInfo[playerid][pWarns]); INI_Close(File);
switch( dialogid ) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Welcome To [DU]",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Password",udb_hash(inputtext)); INI_WriteInt(File,"Cash",0); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_Close(File); SCM(playerid, COLOR_GREEN, "You've Successfully Registered! And Has Been Auto-Matically Logged In!"); } } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); SCM(playerid, COLOR_GREEN, "You Have Successfully Logged In!!"); SetSpawnInfo(playerid,0,164,-2380.1345,-578.2792,132.1117,123.4686,0,0,0,0,0,0); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Welcome To [DU]",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit"); } return 1;
CMD:makeadmin(playerid, params[]) { new pID, value; if(PlayerInfo[playerid][pAdmin] < 5 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command."); else if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /makeadmin [playerid/partofname] [level 1-5]."); else if (value < 0 || value > 5) return SendClientMessage(playerid, COLOR_RED, "Unknown level! Only 0 to 1338."); else if(pID == INVALID_PLAYER_ID) return SCM(playerid, COLOR_RED,"Invalid player id."); else { new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128]; GetPlayerName(playerid, pName, MAX_PLAYER_NAME); GetPlayerName(pID, tName, MAX_PLAYER_NAME); format(string, sizeof(string), "You Have Promoted %s To Admin Level %i", tName, value); SCM(playerid, COLOR_GREEN, string); format(string, sizeof(string), "You Have Been Promoted To Admin Level %i By %s", value, pName); SCM(pID, COLOR_GREEN, string); PlayerInfo[pID][pAdmin] = value; } return 1; }
[data] Password = 313918402 Cash = 0 Admin = 0 Kills = 0 Deaths = 0 Locked = 0 Warns = 0
Hello,
I mean the data is not being saved, for example, i'll go IG and type /makeadmin myself 5, after restart when i take a look at scriptfiles it's something like this. Code:
[data] Password = 313918402 Cash = 0 Admin = 0 Kills = 0 Deaths = 0 Locked = 0 Warns = 0 |
public OnGameModeExit( )
{
for( new i = 0; i < MAX_PLAYERS; i ++ ) OnPlayerDisconnect( i, 1 );
return 1;
}
If you can't use any commands after using that command then you're not setting some variables correctly, so they're still 0 and thus saved as 0.
|
CMD:sethp(playerid, params[]) { new id, hp, sendername[MAX_PLAYER_NAME], string[128]; if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED,"You are not authorized to use this command."); else if(sscanf(params,"ui", id, hp)) return SCM(playerid, COLOR_GREY,"USAGE: /sethp [playerid/partofname] [ammount]"); else if(!IsPlayerConnected(id)) return SCM(playerid, COLOR_RED,"Invalid player ID."); else { SetPlayerHealth(id, hp); format(string, sizeof(string),"Your Health Has Been Set To %i By Administrator %s", hp, sendername); SendClientMessage(id, COLOR_GREEN, string); } return 1; }