24.06.2011, 19:26
How Can I Save Objects OnDisconnect?
I think he wants that when he spawns a object ingame it will save when the server restarts.
|
SetPVarInt(playerid, "object", objectid); // objectid = the one you entered in the cmd. if you did /hold 1337, then objectid = 1337
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)
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),....................
}
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 Код:
pawn Код:
pawn Код:
(Everything is UNTESTED Here!) |