SA-MP Forums Archive
Urgent Save score - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Urgent Save score (/showthread.php?tid=151305)



Urgent Save score - JustinB - 29.05.2010

Hi Guys I am currently running SATDM by MoNeYPiMp but I made it so you have to have a certain score to be a cop.
But everytime I quit the game and rejoin the scores Dont save! so I gotta get all that score back again!Please help me I want the scores to Save!


Re: Urgent Save score - Conroy - 30.05.2010

Use Dini to save player information.


Re: Urgent Save score - ipsBruno - 30.05.2010

Here My TUT:
http://forum.sa-mp.com/index.php?topic=169012.0


*Salvar Score = Save Score In English


Re: Urgent Save score - JustinB - 30.05.2010

Quote:
Originally Posted by DraKoNeoN
Here My TUT:
http://forum.sa-mp.com/index.php?topic=169012.0


*Salvar Score = Save Score In English
I did EXACTLY what it said to do and my PAWN just crashes......


Re: Urgent Save score - ipsBruno - 30.05.2010

Nop, Justin Biba


Re: Urgent Save score - Kar - 30.05.2010

Quote:
Originally Posted by DraKoNeoN
Here My TUT:
http://forum.sa-mp.com/index.php?topic=169012.0


*Salvar Score = Save Score In English
doesnt work


Re: Urgent Save score - Grim_ - 30.05.2010

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));
  dini_IntSet(file, "Cash", GetPlayerMoney(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"));
  GivePlayerMoney(playerid, dini_Int(file, "Cash"));
  return 1;
}



Re: Urgent Save score - Kar - 30.05.2010

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)


Re: Urgent Save score - Grim_ - 30.05.2010

Add these:
// OnPlayerDisconnect
dini_IntSet(file, "Cash", GetPlayerMoney(playerid));

//OnPlayerSpawn
GivePlayerMoney(playerid, dini_Int(file, "Cash"));


Re: Urgent Save score - Kar - 30.05.2010

Код:
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SAMPSE~1\GAMEMO~1\COPSNR~1.pwn(300) : error 017: undefined symbol "file"
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SAMPSE~1\GAMEMO~1\COPSNR~1.pwn(315) : error 017: undefined symbol "file"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
wtf