Jump to content
  • 0

Spawn save!


Pinki950

Question

2 answers to this question

Recommended Posts

new PQuery[300], Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid,x,y,z);
format(PQuery, sizeof(PQuery), "UPDATE `accounts` SET `posx` = '%.2f', `posy` = '%.2f', `posz` = '%.2f' WHERE `playername` = '%s'", X, Y, Z, GetPlayerName(playerid));
db_query( Database, PQuery );

daca folosesti dini , faci ceva de genu' doar ca pt dini :)) nu ma prea pricep la dini :D srry

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

Topic Solved!

[pawn]#define FILTERSCRIPT

#include <a_samp>

#include <Dini>

#include <dudb>

new Float:positionx;

new Float:positiony;

new Float:positionz;

#if defined FILTERSCRIPT

public OnFilterScriptInit()

{

        print("\n--------------------------------------");

        print(" De la Alexica721 pt voi                  ");

        print("--------------------------------------\n");

        return 1;

}

public OnPlayerConnect(playerid)

{

        LoadStats(playerid);

        return 1;

}

public OnPlayerDisconnect(playerid, reason)

{

        new Float:x;

        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)

{

        if (!dini_Exists(Pos(playerid))) {

        SetPlayerPos(playerid, 1676.8462, 1447.7908, 10.7833);

        }

        else

        {

        SetPlayerPos(playerid, positionx,positiony,positionz);

        }

        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(" Nimic de spus");

        print("----------------------------------\n");

}

#endif[/pawn]

?q=192&s=s&bg1=5eeb06&bg2=3a7bfc&t=000&gl=fff&b=000000&gbg=000
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.