Quote:
Originally Posted by [HiC
TheKiller ]
I hate DUDB . I'll just make a simple one for you out of DINI because I am bored.
TOP
pawn Код:
new Kills[MAX_PLAYERS]; new Deaths[MAX_PLAYERS];
Under OnGameModeInit
pawn Код:
if(!dini_Exists("Deaths.cfg")) { dini_Create("Deaths.cfg"); } if(!dini_Exists("Kills.cfg")) { dini_Create("Kills.cfg"); }
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { Kills[killerid]++; Deaths[playerid]++; return 1; }
pawn Код:
public OnPlayerConnect(playerid) { new Pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, Pname, MAX_PLAYER_NAME); Deaths[playerid] = dini_Int("Deaths.cfg", Pname); Kills[playerid] = dini_Int("Kills.cfg", Pname); return 1; }
pawn Код:
OnPlayerDisconnect(playerid, reason) { new Pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, Pname, MAX_PLAYER_NAME); dini_IntSet("Deaths.cfg", Pname, Deaths[playerid]); dini_IntSet("Kills.cfg", Pname, Kills[playerid]); }
Simple
The format shown in the file will be:
|
DUDB > DINI for player files.
Here's why, when the player disconnects, the file is saved as Deaths, when another player disconnects, the file is overwritten. Then when a new player connects, (s)he gets the kills and deaths of the last person to disconnect. DUDB saves the file as the player's name or however you set it up.