[HELP!!!] with "level save system"
#1

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
Reply
#2

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]; }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)