reloading objects-help`
#1

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)