Score
#2

i use this to save my players score make a fs with this
Код:
#include <a_samp>
#include <Dini>
#include <Dutils>
#include <Dudb>


#define COLOR_GREY 	0xCECECEFF
//*******************************PRAGMAS**************************************//
#pragma unused ret_memcpy
#pragma tabsize 0 //Fixes all lose indentation errors
//**FORWARDS**//
forward XtR_OnPlayerDisconnect(playerid);
forward XtR_OnPlayerConnect(playerid);

//**************************************NEWS**********************************//
new pname[MAX_PLAYER_NAME];
new XtreaMeRScore[100];

//------------------------------------------------------------------------------
/*---------------------------------CallBacks----------------------------------*/
public XtR_OnPlayerDisconnect(playerid){
GetPlayerName(playerid, pname, sizeof(pname));
format(XtreaMeRScore, sizeof(XtreaMeRScore), "/XtreaMeR Saver/%s.ini",pname);
if(!dini_Exists(XtreaMeRScore))
{
}
else
{
dini_IntSet(XtreaMeRScore, "Score", GetPlayerScore(playerid));
}
}
public XtR_OnPlayerConnect(playerid){
GetPlayerName(playerid, pname, sizeof(pname));
format(XtreaMeRScore, sizeof(XtreaMeRScore), "/XtreaMeR Saver/%s.ini",pname);
if(!dini_Exists(XtreaMeRScore))
{
dini_Create(XtreaMeRScore);
dini_IntSet(XtreaMeRScore, "Score", 0);
SetPlayerScore(playerid, dini_Int(XtreaMeRScore, "Score"));
}
else
{
SetPlayerScore(playerid, dini_Int(XtreaMeRScore, "Score"));
}
return 1;
}

public OnPlayerConnect(playerid)
{
	XtR_OnPlayerConnect(playerid);
	return 1;
}

public OnPlayerDisconnect(playerid)
{
	XtR_OnPlayerDisconnect(playerid);
  return 1;
}
one more thing you will need to do is make a file on your scriptfiles with the name XtreaMeR Saver

i hope help you!
Reply


Messages In This Thread
Score - by maltheus. - 17.01.2010, 20:54
Re: Score - by akis_tze - 17.01.2010, 21:16
Re: Score - by Huzzy - 14.10.2010, 15:29
Re: Score - by Biesmen - 14.10.2010, 15:40

Forum Jump:


Users browsing this thread: 2 Guest(s)