SA-MP Forums Archive
vehicles - 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: vehicles (/showthread.php?tid=514043)



vehicles - rumen98 - 19.05.2014

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"2000true);
}
public 
DestroyDeadVehicles()
{
    new 
Float:health;
    for(new 
i=0i<MAX_VEHICLESi++)
    {
    
GetVehicleHealth(ihealth);
    if(
health <= 251DestroyVehicle(i);
    }
    return 
1;
}
CMD:sultan(playeridparams[]) 

if(
GetPlayerMoney(playerid) == 10000

if(
IsPlayerInRangeOfPoint(playerid3.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