Pos loader and saver help
#1

Ok so i made a filterscript around 9 months ago witch was a pos saver and loader. at the time i use to code sa-mp alot but took a break from it for around 8 months just recently came back. I noticed alot of people pmed me on how to make it so when the player first joins the server it puts him at there coordinates instead off at a farm type thing. I had it working on my old server but i don't have it any more and i can't rember how to do it.

The code is:
Quote:

#define FILTERSCRIPT

#include <a_samp>
#include <Dini>
#include <dudb>

new Floatositionx;
new Floatositiony;
new Floatositionz;

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Position saver by Jueix");
print("--------------------------------------\n");
return 1;
}

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

public OnPlayerDisconnect(playerid, reason)
{
new Float;
new Float:y;
new Float:z;

GetPlayerPos(playerid,x,y,z);
positionx = x;
positiony = y;
positionz = z;
if (!dini_Exists(Pos(playerid)))
{
dini_Create(Pos(playerid));
}

SaveStats(playerid);
return 1;
}

public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid,positionx,positiony,position z);
return 1;
}

Player(playerid)
{
new player[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, sizeof(player));
return player;
}

Pos(playerid)
{
new a[256]; format(a, sizeof(a), "%s.ini",udb_encode(Player(playerid)));
return a;
}

SaveStats(playerid)
{
dini_IntSet(Pos(playerid), "PositionX", floatround(positionx));
dini_IntSet(Pos(playerid), "PositionY", floatround(positiony));
dini_IntSet(Pos(playerid), "PositionZ", floatround(positionz));
}

LoadStats(playerid)
{
positionx = dini_Int(Pos(playerid), "PositionX");
positiony = dini_Int(Pos(playerid), "PositionY");
positionz = dini_Int(Pos(playerid), "PositionZ");
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by Jueix");
print("----------------------------------\n");
}

#endif

What i want it to basicly do is if the player doesn't have a pos saved or a pos save file it will basicly put them at like i don't no lspd or at lv train station.

If any one helps me with this ill be forever grateful and will give you rep =).
Reply
#2

please some one help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)