Urgent Save score
#8

Quote:
Originally Posted by Grim_
Just do something like this
pawn Код:
#include <dini>

#define SAVE_FILE "%s.ini"

public OnPlayerConnect(playerid)
{
 new file[MAX_PLAYER_NAME+5], name[MAX_PLAYER_NAME];
 GetPlayerName(playerid, name, sizeof(name));
 format(file, sizeof(file), SAVE_FILE, name);
 if(!fexist(file))
 {
   dini_Create(file);
 }
 return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
 new file[MAX_PLAYER_NAME+5], name[MAX_PLAYER_NAME];
 GetPlayerName(playerid, name, sizeof(name));
 format(file, sizeof(file), SAVE_FILE, name);
 dini_IntSet(file, "Score", GetPlayerScore(playerid));
 return 1;
}

public OnPlayerSpawn(playerid)
{
 new file[MAX_PLAYER_NAME+5], name[MAX_PLAYER_NAME];
 GetPlayerName(playerid, name, sizeof(name));
 format(file, sizeof(file), SAVE_FILE, name);
 SetPlayerScore(playerid, dini_Int(file, "Score"));
 return 1;
}
THX! what about money? (thats all i need now)
Reply


Messages In This Thread
Urgent Save score - by JustinB - 29.05.2010, 23:36
Re: Urgent Save score - by Conroy - 30.05.2010, 00:57
Re: Urgent Save score - by ipsBruno - 30.05.2010, 01:03
Re: Urgent Save score - by JustinB - 30.05.2010, 01:23
Re: Urgent Save score - by ipsBruno - 30.05.2010, 02:08
Re: Urgent Save score - by Kar - 30.05.2010, 04:33
Re: Urgent Save score - by Grim_ - 30.05.2010, 05:02
Re: Urgent Save score - by Kar - 30.05.2010, 05:57
Re: Urgent Save score - by Grim_ - 30.05.2010, 06:00
Re: Urgent Save score - by Kar - 30.05.2010, 06:41

Forum Jump:


Users browsing this thread: 1 Guest(s)