Why doesn`t Vehicle delete when I pick up pickup?.
#1

This is my script,I want it to delete previous spawned vehicle before spawning new one but it is not working.

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == infernuspickup)
    {
    new Float:X,Float:Y,Float:Z,vehicle[MAX_PLAYERS];
    GetPlayerPos(playerid,X,Y,Z);
    DestroyVehicle(vehicle[playerid]);
    vehicle[playerid] = CreateVehicle(411,X,Y,Z,0,0,0,-1);
    PutPlayerInVehicle(playerid,vehicle[playerid], 0);
        return 1;
    }
    return 1;
}
Reply
#2

You're creating the variable locally, which means that it gets wiped when the function is done executing. Try changing new to static, that might work.
Reply
#3

Works...Thank You! Rep+ from me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)