08.01.2017, 18:50
(
Последний раз редактировалось Learn; 08.01.2017 в 18:59.
Причина: Worng title.
)
You told me to start learning properly, so I started to build commands. It's hard for me to start with then please help.
The code not realy active. Thanks for dear helpers!
PHP код:
//BREAK VEHICLE SYSTEM
//STOCK
stock GetClosestVehicle(playerid, Float:range) //Function of WooTFTW
{
//NEW
new Float:p_X;
new Float:p_Y;
new Float:p_Z;
new Float:Distance;
new Float:PretendentDistance = range +1;
new Pretendent;
//GET PLAYER
GetPlayerPos(playerid, p_X, p_Y, p_Z);
for(new vehicleid=1; vehicleid < MAX_VEHICLES; vehicleid++)
{
//DISTANCE
Distance = GetVehicleDistanceFromPoint(vehicleid, p_X, p_Y, p_Z);
if(Distance <= range && Distance <= PretendentDistance)
{
//PERTENDENT
Pretendent = vehicleid;
PretendentDistance = Distance;
}
}
return Pretendent;
}
//BREAK VEHICLE CMD
CMD:breakveh(playerid, params[])
{
new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective;
vehicleid = GetClosestVehicle(playerid, 1);
SetTimer("Breaking the vehicle...", 30000, false);
SetVehicleHealth(vehicleid, 200);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, 0, 1, 0, 0, 1, objective);
SendClientMessage(playerid, COLOR_GREY,"You break the vehicle, now you can do as you wish.");
return 1;
}