how to destroy neons at vehicle death? not working..., also how to make destroyvehicle unoccupied.. -
niels44 - 01.06.2012
hey guys,
im stuck at a problem...
ok so i saw that ingame when a vehicle blows up and dissapears the neons are still there..., so i thought, lets add the delete things at the onvehicledeath... but the problem is.. it doesnt knows playerid.. so i get error undefined symbol playerid... hmm anyways check this code:
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
//remove neon
DestroyObject(GetPVarInt(playerid, "neon"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon1"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon2"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon3"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon4"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon5"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon6"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon7"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon8"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon9"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon10"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon11"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon12"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "neon13"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "interior"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "interior1"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "back"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "back1"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "front"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "front1"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "undercover"));
DeletePVar(playerid, "Status");
DestroyObject(GetPVarInt(playerid, "undercover1"));
DeletePVar(playerid, "Status");
HasCar[playerid] = 0;
return 1;
}
should i use killerid? or wont that work?
also if that isnt working please tell me how to fix this,
also how can i make that all the unmanned cars are getting destroyed?, i mean well not all the vehicles, i mean onkly the spawned vehicles a PLAYER spawned, not the cars that are in ongamemodeinit...
anyone knwos how to make this?
i have this but it doesnt works...
pawn Код:
stock VehicleCheck(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i++) //All players
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
{
if(GetPlayerVehicleID(i) == vehicleid)
{
DestroyVehicle(vehicleid);
return 1;
}
}
}
return 0;
}
ongamemodeinit timer:
pawn Код:
forward DestroyEmptyCars(vehicleid);
public DestroyEmptyCars(vehicleid)
{
VehicleCheck(vehicleid);
return 1;
}
// the timer that is at ongamemodeinit:
SetTimer("DestroyEmptyCars", 45000, 1);
anyone knows?

greets niels
Re: how to destroy neons at vehicle death? not working..., also how to make destroyvehicle unoccupied.. -
Jefff - 01.06.2012
top
pawn Код:
new OnGameModeInitLastCarID;
OnGameModeInit
pawn Код:
OnGameModeInitLastCarID = AddStaticVehicleEx(....
pawn Код:
public OnVehicleSpawn(vehicleid)
{
if(vehicleid > OnGameModeInitLastCarID)
DestroyVehicle(vehicleid);
return 1;
}
Re: how to destroy neons at vehicle death? not working..., also how to make destroyvehicle unoccupied.. -
niels44 - 01.06.2012
do i have to do ongamemodeinitlastcarid at ALL the cars in ongamemode init? or just the last one?
EDIT: i now have this, but how to check if there is NOONE in teh car?
pawn Код:
public OnVehicleSpawn(vehicleid)
{
if(vehicleid > OnGameModeInitLastCarID)
{
for (new i = 0; i != MAX_PLAYERS; ++i)
{
if(vehicleid != newcar[i])
{
DestroyVehicle(vehicleid);
return 1;
}
}
}
return 1;
}
or does it automatically checks that?
Re: how to destroy neons at vehicle death? not working..., also how to make destroyvehicle unoccupied.. -
Jefff - 01.06.2012
Quote:
Originally Posted by niels44
or just the last one?
|
Only last one
Quote:
Originally Posted by niels44
or does it automatically checks that?
|
Automatically
pawn Код:
public OnVehicleSpawn(vehicleid)
{
if(vehicleid > OnGameModeInitLastCarID)
{
for(new i = 0; i != MAX_PLAYERS; i++)
{
if(vehicleid == newcar[i])
{
newcar[i] = 0;
DestroyVehicle(vehicleid);
return 1;
}
}
}
return 1;
}
Re: how to destroy neons at vehicle death? not working..., also how to make destroyvehicle unoccupied.. -
niels44 - 01.06.2012
ok now testing

, could you also please check this? hope you also know how to fix that
EDIT: nop not working
Re: how to destroy neons at vehicle death? not working..., also how to make destroyvehicle unoccupied.. -
Jefff - 01.06.2012
You dont need timer for that public, it works only when vehicle is spawned ( after blowing etc)
Re: how to destroy neons at vehicle death? not working..., also how to make destroyvehicle unoccupied.. -
niels44 - 01.06.2012
oooooooow, but i want it that when a player spawns a vehicle and it doesnt enters it the next 50 seconds, then it just destroys the car.. is this possible?

Respuesta: how to destroy neons at vehicle death? not working..., also how to make destroyvehicle unoccupied.. -
[DOG]irinel1996 - 01.06.2012
Don't use PVars, make a global variable for all vehicles, for example
new neonOne[MAX_VEHICLES]; and when you create the neon just use
neonOne[vehicleid] = CreateObject(.....);, and
DestroyObject(neonOne[vehicleid]); where you wish.
Re: how to destroy neons at vehicle death? not working..., also how to make destroyvehicle unoccupied.. -
niels44 - 02.06.2012
aha, okay


gonna try it

, if i still have trouble i post here again

thnx

Re: Respuesta: how to destroy neons at vehicle death? not working..., also how to make destroyvehicle unoccupied.. -
niels44 - 02.06.2012
Quote:
Originally Posted by irinel1996
Don't use PVars, make a global variable for all vehicles, for example new neonOne[MAX_VEHICLES]; and when you create the neon just use neonOne[vehicleid] = CreateObject(.....);, and DestroyObject(neonOne[vehicleid]); where you wish. 
|
WTFFFFFFFFFFFFFF i get about 60 errors in my pawn when i do this? :O WTFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
thsi definitely NOT gonna work mate