how to destroy neons at vehicle death? not working..., also how to make destroyvehicle unoccupied..
#1

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

top
pawn Код:
new OnGameModeInitLastCarID;
OnGameModeInit
pawn Код:
OnGameModeInitLastCarID = AddStaticVehicleEx(....
pawn Код:
public OnVehicleSpawn(vehicleid)
{
    if(vehicleid > OnGameModeInitLastCarID)
        DestroyVehicle(vehicleid);
    return 1;
}
Reply
#3

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?
Reply
#4

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;
}
Reply
#5

ok now testing , could you also please check this? hope you also know how to fix that

EDIT: nop not working
Reply
#6

You dont need timer for that public, it works only when vehicle is spawned ( after blowing etc)
Reply
#7

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

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

aha, okay gonna try it , if i still have trouble i post here again thnx
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)