Why it doesnt remove the object?
#2

pawn Код:
new NeonObject;
DestroyObject(NeonObject);
You are creating a new variable and passing it through DestroyObject which will remove the objectid 0 (if any).

This is called local variable but in your case, you need global variable and per player/vehicle in order to store the neon object.

So this would be: (declare this independently, not in any callback or function)
pawn Код:
new pNeonObject[MAX_PLAYERS];
pawn Код:
if (HOLDING(KEY_NO) && IsPlayerInAnyVehicle(playerid) && DB[playerid][Neon] != 0){
    new vehicleid = GetPlayerVehicleID(playerid);
    if (IsValidObject(pNeonObject[playerid])
        DestroyObject(pNeonObject[playerid]);
    pNeonObject[playerid]= CreateObject(DB[playerid][Neon], 0,0,-30, 0.0, 0.0, 96.0, 300.0);
    AttachObjectToVehicle(pNeonObject[playerid], vehicleid, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0);}
Reply


Messages In This Thread
Why it doesnt remove the object? - by Lirbo - 07.02.2016, 19:49
Re: Why it doesnt remove the object? - by Gammix - 07.02.2016, 19:58
Re: Why it doesnt remove the object? - by Lirbo - 07.02.2016, 20:05

Forum Jump:


Users browsing this thread: 1 Guest(s)