Help please ;)
#1

hi i need help with finding how to make it so the script can detect the vehicle health and if its below 900.00 it fixes it.

thanks in advance.

-
meegan1
Reply
#2

Quote:
Originally Posted by GaGlets
Whot u give for it ?
Dont ask stupid things ...
Use GetVehicleHealth in a timer (SetTimer)
Reply
#3

pawn Код:
if(!IsPlayerInAnyVehicle(playerid))
{
  SendClientMessage(playerid, 0xFFFFFFAA, "SERVER: You must be in the vehicle.");
  return 1;
}
else
{
  new Float:health, vehicleid;
  vehicleid = GetPlayerVehicleID(playerid);
  GetVehicleHealth(vehicleid, health);
  if(health < 900)
  {
    RepairVehicle(vehicleid);
    SendClientMessage(playerid, 0xFFFFFFAA, "SERVER: Your vehicle is repaired.");
  }
  else
  {
    SendClientMessage(playerid, 0xFFFFFFAA, "SERVER: Your vehicle's health is not below 900, so you can't repair it.");
  }
}
Reply
#4

Код:
forward repaircar()

public OnGameModeInit()
{
SetTimer("repaircar",3000,1);
}

public repaircar()
{
     for(new i=0; i < MAX_PLAYERS; i++)
	{
       new Float:hp[MAX_PLAYERS];
       GetVehicleHealth(GetPlayerVehicleID(i),hp[i]);
       if (hp[i] < 900)
      {
         SetVehicleHealth(GetPlayerVehicleID(i),1000);
         GameTextForPlayer(i,"~w~Vehicle~g~ Repaired",3000,3);
      } 
    }
}
looks like it'll work just wrote it then hope it helps
Reply
#5

thank you all
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)