SA-MP Forums Archive
Help please ;) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help please ;) (/showthread.php?tid=102057)



Help please ;) - meegan1 - 13.10.2009

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


Re: Help please ;) - FUNExtreme - 13.10.2009

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


Re: Help please ;) - Correlli - 13.10.2009

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.");
  }
}



Re: Help please ;) - Beaver07 - 13.10.2009

Код:
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



Re: Help please ;) - meegan1 - 13.10.2009

thank you all