How can I do object respawn
#4

Quote:
Originally Posted by Jin
Посмотреть сообщение
I'm new can you give me more information
Okay well it's basically simple:-

pawn Код:
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 keeps on repeating the respawn process on every 60 seconds you can increase the time if you want.
}

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 ++) // this is a loop which take all the objects from totalobj and destroys.
      {
          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();
      // ... Rest of the objects.
}
I am on phone sorry for any mistake hope this helps you.

Use CreateObject from the following link:-

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

-FalconX
Reply


Messages In This Thread
How can I do object respawn - by Jin - 26.02.2012, 04:26
Re: How can I do object respawn - by FalconX - 26.02.2012, 04:43
Re: How can I do object respawn - by Jin - 26.02.2012, 04:49
Re: How can I do object respawn - by FalconX - 26.02.2012, 07:00

Forum Jump:


Users browsing this thread: 1 Guest(s)