Guardar score
#6

Quote:
Originally Posted by Rat_
chaoz, donde pongo eso? en onplayerconnect?
Ay te dice xD

pawn Код:
#include <Dini>

enum PD{
  death,
  kills,
}
new pInfo[MAX_PLAYERS][PD];

public OnPlayerConnect(playerid) // <<==================== XD
{
  new File:file[256], name[MAX_PLAYER_NAME];
  GetPlayerName(playerid, name, sizeof(name));
  format(file, sizeof(file), "%s.ini", name);
  if(!fexist(file){
    dini_Create(file);
    dini_IntSet(file, "kills", 0);
    dini_IntSet(file, "death", 0);
    pInfo[playerid][deaht] = 0;
    pInfo[playerid][kills] = 0;
  }
  else{
    pInfo[playerid][deaht] = dini_Int(file, "death");
    pInfo[playerid][kills] = dini_Int(file, "kills");
  }
  return 1;
}

public OnPlayerDisconnect(playerid, reason) // <<==================== XD
{
  new File:file[256], PIP[16], name[MAX_PLAYER_NAME];
  GetPlayerName(playerid, name, sizeof(name));
  format(file, sizeof(file), "%s.ini", name);
  if(!fexist(file){
    dini_Create(file);
    dini_IntSet(file, "kills", pInfo[playerid][kills]);
    dini_IntSet(file, "death", pInfo[playerid][deaht]);
  }
  return 1;
}
Reply


Messages In This Thread
Guardar score - by RatHack - 10.06.2010, 20:08
Re: Guardar score - by Gw-platinum - 10.06.2010, 20:12
Re: Guardar score - by ConecCionMex - 10.06.2010, 20:32
Re: Guardar score - by TheChaoz - 11.06.2010, 00:13
Re: Guardar score - by RatHack - 11.06.2010, 19:01
Re: Guardar score - by ConecCionMex - 11.06.2010, 19:03
Re: Guardar score - by RatHack - 11.06.2010, 19:09
Re: Guardar score - by ConecCionMex - 11.06.2010, 19:10
Re: Guardar score - by RatHack - 11.06.2010, 19:17
Re: Guardar score - by ConecCionMex - 11.06.2010, 19:22

Forum Jump:


Users browsing this thread: 1 Guest(s)