SA-MP Forums Archive
Anti Spawn Kill [reps] - 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: Anti Spawn Kill [reps] (/showthread.php?tid=528049)



Anti Spawn Kill [reps] - SPA - 25.07.2014

Hello , anyone knows a code for Anti Spawn Kill (With Out Timers)? because its make server lag when u have much players


Re: Anti Spawn Kill [reps] - David (Sabljak) - 25.07.2014

Logic = No.


Re: Anti Spawn Kill [reps] - Sawalha - 25.07.2014

No timer = No ANTI SK


Re: Anti Spawn Kill [reps] - Wizzy951 - 25.07.2014

Why don't you try using gettime or gettickcount ?

Edit:
An example:
pawn Код:
#define FLOAT_INFINITY      (Float:0x7F800000)
antispawnkill[MAX_PLAYERS]= 0; //a global variable that you have to put somewhere in the top of your script

//onplayerspawn callback
antispawnkill[playerid] = gettime();
SetPlayerHealth(playerid, FLOAT_INFINITY);

if(gettime() - antispawnkill[playerid] < 10)/*10 stands for 10 seconds*/ return SetPlayerHealth(playerid, 100);



Re: Anti Spawn Kill [reps] - Threshold - 26.07.2014

pawn Код:
if(gettime() - antispawnkill[playerid] < 10)/*10 stands for 10 seconds*/ return SetPlayerHealth(playerid, 100);
And where exactly would this go?

That's right... under a timer.


Re: Anti Spawn Kill [reps] - BroZeus - 26.07.2014

Quote:
Originally Posted by Threshold
Посмотреть сообщение
pawn Код:
if(gettime() - antispawnkill[playerid] < 10)/*10 stands for 10 seconds*/ return SetPlayerHealth(playerid, 100);
And where exactly would this go?

That's right... under a timer.
no..

that would go under OnPlayerTakeDamage.......
no timer needed


Re: Anti Spawn Kill [reps] - Smileys - 26.07.2014

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
no..

that would go under OnPlayerTakeDamage.......
no timer needed
and what if the player doesn't take any damage at all? he could have anti-spawnkill forever lol.


Re: Anti Spawn Kill [reps] - Threshold - 26.07.2014

Effectively, there's no way to make something happen after a certain exact time without the use of a timer. Also:
pawn Код:
if(gettime() - antispawnkill[playerid] < 10)/*10 stands for 10 seconds*/ return SetPlayerHealth(playerid, 100);
under OnPlayerTakeDamage will pretty much just make the player invincible. Every time they take damage their health will be restored to 100...


Re: Anti Spawn Kill [reps] - Wizzy951 - 26.07.2014

After trying plenty of ways and each time different way I got convinced that Threshold is right! I'm really disappointed now, that it doesn't work.
Edit: to be honest I even tried using a loop which basically doesn't even make sense.


Re: Anti Spawn Kill [reps] - arlindi - 26.07.2014

Must help :
https://sampforum.blast.hk/showthread.php?tid=514583
https://sampforum.blast.hk/showthread.php?tid=399864
https://sampforum.blast.hk/showthread.php?tid=367115
https://sampforum.blast.hk/showthread.php?tid=298293
https://sampforum.blast.hk/showthread.php?tid=255508

REP Mee if i helped