Urgent Save score
#1

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

Use Dini to save player information.
Reply
#3

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


*Salvar Score = Save Score In English
Reply
#4

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

Nop, Justin Biba
Reply
#6

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

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

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)
Reply
#9

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

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

Код:
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)