SA-MP Forums Archive
Object model help! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Object model help! (/showthread.php?tid=390848)



Object model help! - Michael98 - 08.11.2012

I am making a map editor but i want to make the objects save on exit.
I tried to do this by saving the objects in an .ini file.
But in the .ini file i get this: CreateObject(0,0,100,0,0,0);
Is there any way to get all the yet created objects modelid and then save it in an .ini file?


AW: Object model help! - Skimmer - 08.11.2012

Yes there is a way, but you need to have some experience.

https://sampwiki.blast.hk/wiki/Fopen


Re: Object model help! - Faisal_khan - 08.11.2012

You can check some of the ini functions on their respective topics.


Re: Object model help! - Michael98 - 08.11.2012

I have not problems with .ini files, i just want to know how to get object models to an array or something so that i can save the current created objects to an .ini file.


Re: Object model help! - Faisal_khan - 08.11.2012

Like for x, y and z co-ords, we use:
pawn Код:
new Float:X,Float:Y,FLoat:Z;
GetPlayerPos(playerid, X, Y, Z);
//and then save the co-ords in the file
You can do something like this for the object params.


Re: Object model help! - Michael98 - 08.11.2012

I know how to save the cords.but i dont know how to take the model id of an object and thats why i made this thread.
Does anybody knows how to do this?(+REP)


Re: Object model help! - Faisal_khan - 09.11.2012

Hmm.. I found this maybe it will be helpful for you.

https://sampforum.blast.hk/showthread.php?tid=367718


Re: Object model help! - MP2 - 09.11.2012

pawn Код:
new objModel[MAX_OBJECTS];

hook CreateObject like so (get y_hooks):

stock hook_CreateObject(blah blah blah)
{
    new oid = CreateObject(blah blah blah);
    objModel[oid] = model;
    return oid;
}



Re: Object model help! - Michael98 - 10.11.2012

Quote:
Originally Posted by MP2
Посмотреть сообщение
pawn Код:
new objModel[MAX_OBJECTS];

hook CreateObject like so (get y_hooks):

stock hook_CreateObject(blah blah blah)
{
    new oid = CreateObject(blah blah blah);
    objModel[oid] = model;
    return oid;
}
Код:
CreateObject(objModel[oid],x,y,z,0,0,0,300.0);
It till give me the model id of the last created object.
How can i use it to take all the yet created objects model id and then save them in an .ini file?


Re: Object model help! - Faisal_khan - 10.11.2012

Maybe I think the function you want doesn't exist. Try making all the objects and save them in the file using MP2's code. Hope it might work it out for you.