21.09.2018, 20:50
i try to create pickup for change car
but its not change the car for the players
but its not change the car for the players
PHP код:
new Pickups[4];
new Pickups2[4];
PHP код:
Pickups[0] = CreateDynamicPickup(1314, 1, -2334.0427, -3311.5967, 195.1423);
Pickups2[1] = CreateDynamicPickup(1314, 1, -3064.8191, -3764.0562, 7.7760);
PHP код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
for(new i; i < 4; i++)if(Pickups[i] == pickupid)ChangeVehicle(playerid, 451);
for(new i; i < 4; i++)if(Pickups2[i] == pickupid)ChangeVehicle(playerid, 411);
return 1;
}
forward ChangeVehicle(player, vehicle);
public ChangeVehicle(player, vehicle)
{
if(IsPlayerInAnyVehicle(player))
{
n
ew veh = GetPlayerVehicleID(player);
new Float:ang;
GetVehicleZAngle(veh, ang);
new Float:pos[3];
GetVehiclePos(veh, pos[0], pos[1], pos[2]);
new Float:velo[3];
GetVehicleVelocity(veh, velo[0], velo[1], velo[2]);
DestroyVehicle(veh);
veh = CreateVehicle(vehicle, pos[0], pos[1], pos[2]+0.5, ang, -1, -1, -1);
PutPlayerInVehicle(player, vehicle, 0);
SetVehicleVelocity(veh, velo[0], velo[1], velo[2]);
return 1;
}
return 1;
}