SA-MP Forums Archive
pickup with car - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: pickup with car (/showthread.php?tid=479953)



pickup with car - PawnoQ - 08.12.2013

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


Re: pickup with car - newbie scripter - 08.12.2013

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*/);
    }
}



Re: pickup with car - PawnoQ - 08.12.2013

thanks but i need no loop?


Re: pickup with car - newbie scripter - 08.12.2013

Loop isn't required