SA-MP Forums Archive
Guardar score - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Guardar score (/showthread.php?tid=153802)



Guardar score - RatHack - 10.06.2010

Hola, estoi buscando un script o algo para que el score se te quede guardado en el juego cuando entras

alguien tiene idea donde lo puedo encontrar??


Re: Guardar score - Gw-platinum - 10.06.2010

Yo te podia hacer un FS, pero tendrian k registrar su cuenta pa que les guardara el score


Re: Guardar score - ConecCionMex - 10.06.2010


En: OnPlayerConnect

Код:
if(dini_Isset("score.ini",PlayerName(playerid))) SetPlayerScore(playerid,dini_Int("score.ini",PlayerName(playerid)));
En: OnPlayerDisconnect

Код:
dini_IntSet("score.ini",PlayerName(playerid),GetPlayerScore(playerid));
En: OnGameModeInit o OnFilterScriptInit

Код:
if(!fexist("score.ini")) dini_Create("score.ini");



Re: Guardar score - TheChaoz - 11.06.2010

intenta con esto:
pawn Код:
#include <Dini>

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

public OnPlayerConnect(playerid){
  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){
  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;
}
espero que te sirva


Re: Guardar score - RatHack - 11.06.2010

chaoz, donde pongo eso? en onplayerconnect?


Re: Guardar score - ConecCionMex - 11.06.2010

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



Re: Guardar score - RatHack - 11.06.2010

Ya lo puse, me dice:

C:\Documents and Settings\Propietario\Escritorio\TClanServ.pwn(125) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Propietario\Escritorio\TClanServ.pwn(822) : warning 213: tag mismatch
C:\Documents and Settings\Propietario\Escritorio\TClanServ.pwn(823) : warning 213: tag mismatch
C:\Documents and Settings\Propietario\Escritorio\TClanServ.pwn(823) : error 001: expected token: ")", but found "{"
C:\Documents and Settings\Propietario\Escritorio\TClanServ.pwn(824) : error 017: undefined symbol "dini_Create"
C:\Documents and Settings\Propietario\Escritorio\TClanServ.pwn(825) : error 017: undefined symbol "dini_IntSet"
C:\Documents and Settings\Propietario\Escritorio\TClanServ.pwn(826) : error 017: undefined symbol "dini_IntSet"
C:\Documents and Settings\Propietario\Escritorio\TClanServ.pwn(827) : error 017: undefined symbol "pInfo"
C:\Documents and Settings\Propietario\Escritorio\TClanServ.pwn(827) : warning 215: expression has no effect
C:\Documents and Settings\Propietario\Escritorio\TClanServ.pwn(827) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Propietario\Escritorio\TClanServ.pwn(827) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Propietario\Escritorio\TClanServ.pwn(827) : fatal error 107: too many error messages on one line


Re: Guardar score - ConecCionMex - 11.06.2010

pon

#include <dini>

arriva de todo


Re: Guardar score - RatHack - 11.06.2010

Aora me sale esto xd

C:\Documents and Settings\Propietario\Escritorio\SAAAAMP\pawno\incl ude\dutils.inc(22) : error 017: undefined symbol "MAX_PLAYERS"
C:\Documents and Settings\Propietario\Escritorio\SAAAAMP\pawno\incl ude\dutils.inc(233) : error 017: undefined symbol "fexist"
C:\Documents and Settings\Propietario\Escritorio\SAAAAMP\pawno\incl ude\dutils.inc(233) : warning 215: expression has no effect
C:\Documents and Settings\Propietario\Escritorio\SAAAAMP\pawno\incl ude\dutils.inc(233) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Propietario\Escritorio\SAAAAMP\pawno\incl ude\dutils.inc(233) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Propietario\Escritorio\SAAAAMP\pawno\incl ude\dutils.inc(233) : fatal error 107: too many error messages on one line


Re: Guardar score - ConecCionMex - 11.06.2010

intenta ahora

pawn Код:
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;
}