Saving Objects
#10

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?
Reply


Messages In This Thread
Saving Objects - by 0_o - 24.06.2011, 19:26
Re: Saving Objects - by 0_o - 24.06.2011, 19:35
Re: Saving Objects - by iPLEOMAX - 24.06.2011, 19:41
Re: Saving Objects - by Jay. - 24.06.2011, 19:43
Re: Saving Objects - by bartje01 - 24.06.2011, 19:47
Re: Saving Objects - by Jay. - 24.06.2011, 19:48
Re: Saving Objects - by iPLEOMAX - 24.06.2011, 19:54
Re: Saving Objects - by 0_o - 24.06.2011, 20:51
Re: Saving Objects - by iPLEOMAX - 24.06.2011, 21:10
Re: Saving Objects - by 0_o - 24.06.2011, 23:04

Forum Jump:


Users browsing this thread: 2 Guest(s)