How to make a object spawn back, when you have smashed it
#1

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

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

DestroyObject to destroy it then recreate it with CreateObject.
Reply
#4

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

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

im not to sure if that is possible
Reply
#7

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.
Reply
#8

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.
Reply
#9

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;
}



Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)