SA-MP Forums Archive
[infinite health?] Please help me! [SOLVED] - 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: [infinite health?] Please help me! [SOLVED] (/showthread.php?tid=113251)



[infinite health?] Please help me! [SOLVED] - devteamsnDOTcom - 13.12.2009

Can I make it so that the cars in my gamemode do not take damage? And so that it takes no visual damage? Please tell me how if you can....


Re: [infinite health?] Please help me! - Correlli - 13.12.2009

pawn Код:
forward myTimer();
 
public OnGameModeInit()
{
  SetTimer("myTimer", 1000, true);
  return true;
}
 
public myTimer()
{
  new
      v;
  /* use you're own define for maximum amount of vehicles,
  because i doubt you're using 2000 vehicles which is equal to MAX_VEHICLES define. */

  for(v = 0; v < MAX_VEHICLES; v++) RepairVehicle(v);
  return true;
}



Re: [infinite health?] Please help me! - devteamsnDOTcom - 13.12.2009

Ok, I have a car spawning command so what would happen if I leave it to 2,000 cars?


Re: [infinite health?] Please help me! - Correlli - 13.12.2009

Quote:
Originally Posted by devteamsnDOTcom
Ok, I have a car spawning command so what would happen if I leave it to 2,000 cars?
The 2000x-loop is big and it could lag server a bit because the timer is set to 1 second.

Just use your own amount (amount of vehicles you're using in your script).

OR you could search for "OnVehicleLoseHealth"-callback or something similar and use RepairVehicle(...) function in this callback.


Re: [infinite health?] Please help me! - devteamsnDOTcom - 13.12.2009

Ok, Where do I set it, because I do not see a 2,000 anywhere in the code.


Re: [infinite health?] Please help me! - Correlli - 13.12.2009

Quote:
Originally Posted by devteamsnDOTcom
Ok, Where do I set it, because I do not see a 2,000 anywhere in the code.
Quote:
Originally Posted by Don Correlli
Quote:
/* use you're own define for maximum amount of vehicles,
because i doubt you're using 2000 vehicles which is equal to MAX_VEHICLES define. */

for(v = 0; v < MAX_VEHICLES; v++) RepairVehicle(v);




Re: [infinite health?] Please help me! - devteamsnDOTcom - 13.12.2009

so put...
Код:
for(v = 0; v < 100; v++) RepairVehicle(v);
If I want it to be 100?


Re: [infinite health?] Please help me! - Correlli - 13.12.2009

Quote:
Originally Posted by devteamsnDOTcom
so put...
Код:
for(v = 0; v < 100; v++) RepairVehicle(v);
If I want it to be 100?
If you have 99 or less vehicles on the server, yes.


Re: [infinite health?] Please help me! [SOLVED] - NeymarJr - 09.06.2012

It dont work for me?


Re: [infinite health?] Please help me! [SOLVED] - MP2 - 09.06.2012

Just set the vehicles' health to 99999, no need for a timer.