[HELP!!!] with "level save system" - 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: [HELP!!!] with "level save system" (
/showthread.php?tid=109025)
[HELP!!!] with "level save system" -
BMGP - 17.11.2009
Hi!
Im making a level server(-> You have to make missions like in Singeplayer and sometimes you are at a new level(-> you can buy guns...)
Ok. My problem is:
I will work so: level[playerid] = 1(2,3,4,...)
But how can i save that for every registered player in a file

??
PLEASE Help
(Im usin GAdmin - including register login system if its important)
BMGP
Re: [HELP!!!] with "level save system" -
JonyAvati - 17.11.2009
For example:
pawn Код:
new PlayerLevel[MAX_PLAYERS];
// This will set the player's level
stock SetPlayerLevel(playerid, money)
{ PlayerLevel[playerid] = PlayerLevel[playerid] + money; PlayerLevel[playerid] = 0; return PlayerLevel[playerid]; }
// This will get the player's level
stock GetPlayerLevel(playerid)
{ return PlayerLevel[playerid]; }
// If your saving system uses dini, use this code:
forward SavePlayerLevel(playerid); public SavePlayerLevel(playerid) {
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"%s.ini",name);
dini_IntSet(file, "Level",GetPlayerLevel(playerid)); return 1; }
So for example, if you want to make a command that requires level 5 to be used, you should use:
pawn Код:
if(PlayerLevel[playerid] == 5)
Good luck!
EDIT:
I will give you another function, because "SetPlayerLevel" will set it, and of course you want to add more level, I think. So use this:
pawn Код:
stock GivePlayerLevel(playerid, money)
{ Level[playerid] = Level[playerid] + money; return Level[playerid]; }