pickup with car
#1

hi,

how can i make a pickup and when i drive to the pickup in a car it will fix my car then?
I tried but it never gives me health to my car

pawn Код:
new Vehicle[MAX_PLAYERS];

//with command player gets into vehicle that is created like this
Vehicle[playerid]=CreateVehicle(571,x,y,z,facing_angle,-1,-1,-1);

//OnGameModeInit
CreatePickup(1248,1,x,y,z,-1);

public OnPlayerPickUpPickup(playerid, pickupid)
{
            foreach (Player, i)
            {
                if(IsPlayerInAnyVehicle(i))
                {
                    if(IsPlayerInRangeOfPoint(i,2,x,y,z))
                    {
                        SetVehicleHealth(Vehicle[i],1000.0);
                        RepairVehicle(Vehicle[i]);
                    }
                }
            }
return 1;
}
hope u can help
Reply
#2

1. Define that pickup like
pawn Код:
new Pickup1 =  CreatePickup(1248,/*1*/ 14,x,y,z,-1); // use 14 as pickup ID, only pickup type 14 is available in cars
pawn Код:
foreach (Player, i)
            {
                if(IsPlayerInAnyVehicle(i))
                {
                    if(IsPlayerInRangeOfPoint(i,2,x,y,z))
                    {
                        SetVehicleHealth(Vehicle[i],1000.0);
                        RepairVehicle(Vehicle[i]);
                    }
                }
            }
will become
pawn Код:
if(pickupid == Pickup1)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
         SetVehicleHealth(/*Vehicle*/,1000.0);
        RepairVehicle(/*Vehicle*/);
    }
}
Reply
#3

thanks but i need no loop?
Reply
#4

Loop isn't required
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)