10.06.2015, 05:58
Example code to detect if player is near hood and usage.
or
PHP код:
if(strcmp(cmd, "/repair", true) == 0)
{
new
Float:X,
Float:Y,
Float:Z,
vehicleid = Function;
GetVehicleHood(vehicleid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 1.5, X, Y, Z))
{
ApplyAnimation(playerid,"CAR", "Fixn_Car_Loop",4.1,1,1,1,1,10000);
SetVehicleHealth(vehicleid, 1000.0);
RepairVehicle(vehicleid);
}
else SendClientMessage(playerid, -1, "You're not near vehicle's hood.");
return 1;
}
PHP код:
if(strcmp(cmd, "/repair", true) == 0)
{
new
Float:X,
Float:Y,
Float:Z;
for(new vehicleid = 0; vehicleid < MAX_VEHICLES; vehicleid++)
{
GetVehicleHood(vehicleid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 1.5, X, Y, Z))
{
ApplyAnimation(playerid,"CAR", "Fixn_Car_Loop",4.1,1,1,1,1,10000);
SetVehicleHealth(vehicleid, 1000.0);
RepairVehicle(vehicleid);
break;
}
else SendClientMessage(playerid, -1, "You're not near vehicle's hood.");
}
return 1;
}

