SA-MP Forums Archive
How to make it load a players money from last time he logged in - 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: How to make it load a players money from last time he logged in (/showthread.php?tid=77686)



How to make it load a players money from last time he logged in - aspire5630 - 13.05.2009

ok, i would like to make it in v admin it logs everything
and i would like to make it, when the player logs in he will start with the money he logged out with,


Re: How to make it load a players money from last time he logged in - Think - 13.05.2009

show codes about saving and loading, just add a line there with money and getplayermoney easy as what?


Re: How to make it load a players money from last time he logged in - aspire5630 - 13.05.2009

Quote:
Originally Posted by Pandabeer1337
show codes about saving and loading, just add a line there with money and getplayermoney easy as what?
Emmmmm


Re: How to make it load a players money from last time he logged in - Think - 13.05.2009

Quote:
Originally Posted by aspire5630
Quote:
Originally Posted by Pandabeer1337
show codes about saving and loading, just add a line there with money and getplayermoney easy as what?
Emmmmm
Show the load and save thingys than you can goto script request topic, than you can request it there with the info included, or you can post it here and maybe someone will help you out, if you post the codes we can help you. (just from saving and loading so we an idea how it looks like.) because its as simple as: GetPlayerMoney and than save it


Re: How to make it load a players money from last time he logged in - aspire5630 - 14.05.2009

Quote:
Originally Posted by Pandabeer1337
Quote:
Originally Posted by aspire5630
Quote:
Originally Posted by Pandabeer1337
show codes about saving and loading, just add a line there with money and getplayermoney easy as what?
Emmmmm
Show the load and save thingys than you can goto script request topic, than you can request it there with the info included, or you can post it here and maybe someone will help you out, if you post the codes we can help you. (just from saving and loading so we an idea how it looks like.) because its as simple as: GetPlayerMoney and than save it
Right well im using v admin
Heopfully this is the code your looking for

Код:
			  			if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
			  			if( strcmp( key , "Warnings" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWarns] = strval( val ); }
			  			if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
			  			if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
			    		if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
			    		if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
			    		if( strcmp( key , "Bank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBank] = strval( val ); }
			    		if( strcmp( key , "Skin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSkin] = strval( val ); }
			   		if( strcmp( key , "TimesConnected" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTimes] = strval( val ); }
			    		if( strcmp( key , "PlayingHours" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pHours] = strval( val ); }
			    		if( strcmp( key , "PlayingMinutes" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMins] = strval( val ); }
			    		if( strcmp( key , "DayRegistered" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDate1] = strval( val ); }
		    			if( strcmp( key , "MonthRegistered" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDate2] = strval( val ); }
		    		if( strcmp( key , "YearRegistered" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDate3] = strval( val ); }




//========================================================================================




	if(IsPlayerConnected(playerid))
	{
			new string3[256];
			new string[256];
			new playername3[MAX_PLAYER_NAME];
			GetPlayerName(playerid, playername3, sizeof(playername3));
			format(string3, sizeof(string3), "V-Admin/Users/%s.ini", playername3);
			new File: hFile = fopen(string3, io_write);
 			if (hFile)
			{
			  new pIp[128];
			  GetPlayerIp(playerid, pIp, sizeof(pIp));
			  new var[32];
			  strmid(PlayerInfo[playerid][pPassword], password, 0, strlen(password), 255);
				format(var, 32, "Password=%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
				PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
				format(var, 32, "IP=%s\n", pIp);fwrite(hFile, var);
				format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
				format(var, 32, "Warnings=%d\n",PlayerInfo[playerid][pWarns]);fwrite(hFile, var);
				format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
				format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
				format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
				format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
				format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var);
				format(var, 32, "Skin=%d\n",PlayerInfo[playerid][pSkin]);fwrite(hFile, var);
				format(var, 32, "TimesConnected=%d\n",PlayerInfo[playerid][pTimes]);fwrite(hFile, var);
				format(var, 32, "PlayingHours=%d\n",PlayerInfo[playerid][pHours]);fwrite(hFile, var);
				format(var, 32, "PlayingMinutes=%d\n",PlayerInfo[playerid][pMins]);fwrite(hFile, var);
				format(var, 32, "JailTime=%d\n",PlayerInfo[playerid][pJailTime]);fwrite(hFile, var);
				new year,month,day;
				getdate(year,month,day);
        PlayerInfo[playerid][pDate1] = day;
        PlayerInfo[playerid][pDate2] = month;
        PlayerInfo[playerid][pDate3] = year;
        format(var, 32, "DayRegistered=%d\n",PlayerInfo[playerid][pDate1]);fwrite(hFile, var);
        format(var, 32, "MonthRegistered=%d\n",PlayerInfo[playerid][pDate2]);fwrite(hFile, var);
        format(var, 32, "YearRegistered=%d\n",PlayerInfo[playerid][pDate3]);fwrite(hFile, var);
				fclose(hFile);
				format(string, sizeof(string), "Account %s Created. You can now use /login [password]", playername3);
				SendClientMessage(playerid, COLOR_YELLOW, string);
			}
	}
	return 1;
}



Re: How to make it load a players money from last time he logged in - Think - 14.05.2009

add this at your login code:

GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);


Re: How to make it load a players money from last time he logged in - aspire5630 - 14.05.2009

Quote:
Originally Posted by Pandabeer1337
add this at your login code:

GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
Okkay i add that on PlayerConnect?


Re: How to make it load a players money from last time he logged in - aspire5630 - 15.05.2009

**Bump


Anyone?


Re: How to make it load a players money from last time he logged in - Yuval_Baruch - 15.05.2009

no, he ment that you will add it in the login function, not the connecting public