19.05.2014, 14:13
Hello can anyone help me make this code only destroy vehicles created by the command /sultan, when health of vehicle is below 251?
PHP код:
forward DestroyDeadVehicles();
public OnGameModeInit()
{
SetTimer("DestroyDeadVehicles", 2000, true);
}
public DestroyDeadVehicles()
{
new Float:health;
for(new i=0; i<MAX_VEHICLES; i++)
{
GetVehicleHealth(i, health);
if(health <= 251) DestroyVehicle(i);
}
return 1;
}
CMD:sultan(playerid, params[])
{
if(GetPlayerMoney(playerid) == 10000)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0,2140.4116,-2256.4915,13.3010))
{
GivePlayerMoney(playerid,-10000);
CreateVehicle(560,2140.4116,-2258.4915,14.3010,180.0000,10,10,-1);
}else{
SendClientMessage(playerid,COLOR_RED,"You are no in Buy Zone");
}
}else{
SendClientMessage(playerid,COLOR_RED,"You dont have enough money");
}
return 1;
}