OnVehicleDeat
#1

Why does the vehicles respawn when i have this code? it shouldn't respawn again after death?

Code:
public OnVehicleDeath(vehicleid)
{
	for(new i = 0; i < MAX_VEHICLES; i++)
	{
		SetVehicleToRespawn(0);
	}
	return 1;
}
Reply
#2

Because you respawn all vehicles.
Reply
#3

pawn Code:
public OnVehicleDeath(vehicleid)
{
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        SetVehicleToRespawn(i);
    }
    return 1;
}
It should be that but why would you respawn every vehicle when 1 vehicle dies? Makes no sense to me.
Reply
#4

Quote:
Originally Posted by Sergei
View Post
Because you respawn all vehicles.
Then how do i make a car not to respawn after death?
because this should make cars not to respawn,
Code:
SetVehicleToRespawn(0);
Tried it on OnGameModeInit to, but it still respawn the car you crash.
Reply
#5

Quote:
Originally Posted by cruising
View Post
Why does the vehicles respawn when i have this code? it shouldn't respawn again after death?

Code:
public OnVehicleDeath(vehicleid)
{
	for(new i = 0; i < MAX_VEHICLES; i++)
	{
		SetVehicleToRespawn(0);
	}
	return 1;
}
The Parameter of SetVehicleRespawn is asking you the vehicleid, so if you write 0 there, vehicleid 0 will be respawned.
Reply
#6

You are looping through all vehicles then only respawning vehicle ID 0?
And if you want only the vehicle that died to respawn:
pawn Code:
public OnVehicleDeath(vehicleid,killerid)
{
    SetVehicleToRespawn(vehicleid);
    return 1;
}
EDIT: If you want the car NOT to respawn,put the 'respawntime' or 'respawndelay' in CreateVehicle or AddStaticVehicleEx as -1.
Reply
#7

Sorry if i make you guys not understand me.
i mean i dont want that vehicle who died to respawn. if you blow up your car it will not respawn again
Reply
#8

Read my edit,if you don't want it to respawn just place the 'respawntime' or 'respawndelay' parameter as -1.
Like this:

pawn Code:
AddStaticVehicleEx(411,x,y,z,angle,color1,color2,-1);
or
pawn Code:
CreateVehicle(411,x,y,z,agnle,color1,color2,-1);
Or just use AddStaticVehicle.
Reply
#9

Quote:
Originally Posted by [XST]O_x
View Post
Read my edit,if you don't want it to respawn just place the 'respawntime' or 'respawndelay' parameter as -1.
Like this:

pawn Code:
AddStaticVehicleEx(411,x,y,z,angle,color1,color2,-1);
or
pawn Code:
CreateVehicle(411,x,y,z,agnle,color1,color2,-1);
Or just use AddStaticVehicle.
sorry didnt see your edit.
it doenst work. i did like this
Code:
AddStaticVehicleEx(476,-1511.3623,-164.6398,14.8441,11.8009,6,6,-1);
Reply
#10

pawn Code:
public OnVehicleDeath(vehicleid, killerid)
{
    DestroyVehicle(vehicleid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)