Anti Spawn Kill [reps]
#1

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

Logic = No.
Reply
#3

No timer = No ANTI SK
Reply
#4

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);
Reply
#5

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.
Reply
#6

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
Reply
#7

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.
Reply
#8

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...
Reply
#9

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.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)