SA-MP Forums Archive
How to make a object spawn back, when you have smashed it - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to make a object spawn back, when you have smashed it (/showthread.php?tid=73724)



How to make a object spawn back, when you have smashed it - aspire5630 - 17.04.2009

Ok, i have like used the idea of stunt univeruse,
and for /kill
you are spawned with granades, and you have to kill you self
you are stood on a glass window,
soo when you chuck the granade you fall to your death
how do i make this glass window spawn back? after somebody has smashed it


Re: How to make a object spawn back, when you have smashed it - uni - 17.04.2009

You could use a timer to spawn it back I guess.


Re: How to make a object spawn back, when you have smashed it - SpiderPork - 17.04.2009

DestroyObject to destroy it then recreate it with CreateObject.


Re: How to make a object spawn back, when you have smashed it - aspire5630 - 17.04.2009

Quote:
Originally Posted by SpiderPork
DestroyObject to destroy it then recreate it with CreateObject.
Huh,?
whats the pawno code


Re: How to make a object spawn back, when you have smashed it - aspire5630 - 17.04.2009

i dont need to destroy it, the player will destory the glass to kill himself
then i need the glass to spawn back!


Re: How to make a object spawn back, when you have smashed it - [LCG]TANKER - 17.04.2009

im not to sure if that is possible


Re: How to make a object spawn back, when you have smashed it - Redirect Left - 17.04.2009

When the glass is "destroyed" SA-MP itself will still class the object as there, it's just destroyed and clients can't see it.

You must DestroyObject & then recreate the object.


Re: How to make a object spawn back, when you have smashed it - aspire5630 - 17.04.2009

Quote:
Originally Posted by Jolteon | RD Left
When the glass is "destroyed" SA-MP itself will still class the object as there, it's just destroyed and clients can't see it.

You must DestroyObject & then recreate the object.
How do i do that :S.


Re: How to make a object spawn back, when you have smashed it - OmeRinG - 17.04.2009

Just make a timer that respawns the glass...
on top:
pawn Код:
new glassobject[//the amount of glass objects you have + 1 goes here];
forward RespawnGlass();
in OnGameModeInIt:
pawn Код:
SetTimer("RespawnGlass",7000,1);
whereever you create the glass do like this for each glass object:
pawn Код:
glassobject[0] = CreateObject(................);
glassobject[1] = CreateObject(................);
glassobject[2] = CreateObject(................);
and so on until you reach the last object.

in bottom of the script
pawn Код:
public RespawnGlass()
{
    for(new i; i < sizeof(glassobject); i++)
    {
        DestroyObject(glassobject[i]);
        switch (i) {
        case 0: glassobject[0] = CreateObject(//The first glass cordinates go here);
        case 1: glassobject[1] = CreateObject(//The second glass cordinates go here);
        case 2: //and so on....
        }
     }
     return 1;
}






Re: How to make a object spawn back, when you have smashed it - aspire5630 - 17.04.2009

Ok i get theese errors

Line 95
new glassobject[1 //glass at /kill
forward RespawnGlass();//Glass at /kill

i get one error saying
C:\Users\Jj\Desktop\My stunt server\gamemodes\kontrolNEW.pwn(96) : error 001: expected token: "]", but found "forward"

i only have 1 glass which need re-spawning after everytime its smashed