Saving Objects -
0_o - 24.06.2011
How Can I Save Objects OnDisconnect?
Re: Saving Objects -
0_o - 24.06.2011
Anyone Who Can Help
Re: Saving Objects -
iPLEOMAX - 24.06.2011
A little more info would help us...
Please provide some..
Re: Saving Objects -
Jay. - 24.06.2011
First of all , stop bumping your topics and read the rules.
second of all , as iPLEOMAX has said. Give us some more information about what you want
Re: Saving Objects -
bartje01 - 24.06.2011
I think he wants that when he spawns a object ingame it will save when the server restarts.
Re: Saving Objects -
Jay. - 24.06.2011
Quote:
Originally Posted by bartje01
I think he wants that when he spawns a object ingame it will save when the server restarts.
|
Nevermind,
topic creator: You could try learning dini/y_ini , or djhson(Whatever it's name is)
And saving the objects like that. I'm not really experienced myself though
Good luck
Re: Saving Objects -
iPLEOMAX - 24.06.2011
What is the way you create objects? a Map building FS perhaps? Then you have to find some other ways. Try the ones suggested by Funtime.
But if you coded an object creator script yourself then add an extra
string with the
format of "CreateObject" line Function. Then use the
file functions to save it in txt files. Later,
include the file to your script.
It's pretty complicated if you are a starter in pawn.
Re: Saving Objects -
0_o - 24.06.2011
Im Talking about Player Attached Objects, i made a command that player can hold several objects, and i want to save them when a player disconnects, and when he spawns he's wearing the objects.
Re: Saving Objects -
iPLEOMAX - 24.06.2011
So, what parameters are you using in the attach object command?
like Object ID, Bone ID, Positions, Rotations etc...
Simple Example:
In your attach command:
pawn Код:
SetPVarInt(playerid, "object", objectid); // objectid = the one you entered in the cmd. if you did /hold 1337, then objectid = 1337
In OnPlayerDisconnect:
pawn Код:
new pname[MAX_PLAYER_NAME], objectid, string[30], string2[10];
GetPlayerName(playerid,pname,sizeof(pname);
objectid = GetPVarInt(playerid, "object");
format(string,30,"%s.txt",pname);
format(string2,10,"%i",objectid);
new File:pobject=fopen(string, io_write);
fwrite(pobject, string2);
fclose(pobject);
SetPVarInt(playerid, "object", 0)
In OnPlayerSpawn:
pawn Код:
new pname[MAX_PLAYER_NAME],string[30];
GetPlayerName(playerid,pname,sizeof(pname);
format(string,30,"%s.txt",pname);
if(fexist(string)
{
new File:pobject=fopen(string, io_read);
new objectid[10];
fread(pobject, objectid, sizeof(objectid), false);
fclose(pobject);
SetPlayerAttachedObject(strval(objectid),....................
}
There are many other sophisticated/better methods. This is just a basic example.
(Everything is UNTESTED Here!)
Re: Saving Objects -
0_o - 24.06.2011
Quote:
Originally Posted by iPLEOMAX
So, what parameters are you using in the attach object command?
like Object ID, Bone ID, Positions, Rotations etc...
Simple Example:
In your attach command:
pawn Код:
SetPVarInt(playerid, "object", objectid); // objectid = the one you entered in the cmd. if you did /hold 1337, then objectid = 1337
In OnPlayerDisconnect:
pawn Код:
new pname[MAX_PLAYER_NAME], objectid, string[30], string2[10]; GetPlayerName(playerid,pname,sizeof(pname); objectid = GetPVarInt(playerid, "object"); format(string,30,"%s.txt",pname); format(string2,10,"%i",objectid); new File:pobject=fopen(string, io_write); fwrite(pobject, string2); fclose(pobject); SetPVarInt(playerid, "object", 0)
In OnPlayerSpawn:
pawn Код:
new pname[MAX_PLAYER_NAME],string[30]; GetPlayerName(playerid,pname,sizeof(pname); format(string,30,"%s.txt",pname); if(fexist(string) { new File:pobject=fopen(string, io_read); new objectid[10]; fread(pobject, objectid, sizeof(objectid), false); fclose(pobject); SetPlayerAttachedObject(strval(objectid),.................... }
There are many other sophisticated/better methods. This is just a basic example.
(Everything is UNTESTED Here!)
|
i have a menu which is /ho only, and will this save all the objects that player is holding?