reloading objects-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: reloading objects-help` (
/showthread.php?tid=328233)
reloading objects-help` -
Bleach79 - 24.03.2012
i have some objects that breack like glass in samp server.
in the glassmadness , after the glass breaks it take a lot of time to bring all of them back
how can we put a timer to reload all objects??
Re: reloading objects-help` -
Vladamir - 24.03.2012
I would do something like this:
Quote:
new totalobj[TOTALNUMBER_OF_OBJECTS];
public OnGameModeInit()
{
totalobj[0] = CreateObject();
totalobj[1] = CreateObject();
totalobj[2] = CreateObject();
// rest if the objects
SetTimer("RespawnAllObj", 60000, 1); // here it will keep on repeating the respawn process.
}
forward RespawnAllObj();
public RespawnAllObj() // main function which the timer does. After every 60 seconds this process is repeated.
for(new i = 0; i < sizeof(totalobj); i ++)
{
DestroyObject(totalobj[i]);
}
//Then recreate them, just use the code you used in OnGameModeInit to create them:
totalobj[0] = CreateObject();
totalobj[1] = CreateObject();
totalobj[2] = CreateObject();
// your objects....
}
|
Hopefully that helps!