Guardar score
#1

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

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


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");
Reply
#4

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

chaoz, donde pongo eso? en onplayerconnect?
Reply
#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
#7

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

pon

#include <dini>

arriva de todo
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)