#1

I use ladmin 4v2
And my gm...And to players on my server score dont save...I tryed with previous ur help.(something from lvdm)

But still dont save...Please help me,this is only bug on my server what i hate and my players
Reply
#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
#3

Wow nice,Do you know how to make when player logs out he logs back in the same spot he logged of.
Reply
#4

Use the public function public OnPlayerDisconnect(playerid, reason)
Then, get the player position:
GetPlayerPos(playerid, x, y ,z)
Make sure you define x,y,z
Код:
new Float:x, Float:y, Float:z;
Or else x,y,z doesn't mean anything.
Now, make it save into a file with using dini_FloatSet.

When you finished doing that, make it set the player position to the saved position.
Use this public function: public OnPlayerSpawn(playerid).
Define x,y,z again (new Float:.... etc)
Make it read the file by using dini_Float
Then make it spawn at x,y,z:
SetPlayerPos(playerid, x, y, z);

Try figuring out how dini_Floatset and dini_Float work. if I give you the whole script you won't really learn from that
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)