[FilterScript] Spawn protection system - unique
#1

Anti Spawn Kill Protection - Unique

About Script
Took me 20 minutes in total, coding and testing and for the idea, developed from scratch (from zero). The script is optimized (i did all the optimization tricks that i knew), if you guys have any kind of suggestions and optimizations tips and bug complains, let me know. The specialty about it is that it has three different spawn protection time (10, 15 and 20), and you can end your spawn protection by press the key 'N'. Don't release it or claim it as yours. Use it in your gamemode, scripts and edit as to your needs.

Bugs
None

Download
Pastebin : Click me

Credits
-Me (coding)
Reply
#2

Won't call it unique, it's simple, Anyways.. Nice I guess.
Reply
#3

Why is one function a stock and one a public?
Why is the time random?
Won't pressing N also show a message when I don't have spawn protection enabled?
Reply
#4

Nothing unique actually, it's simple af.
Reply
#5

can be said as a filterscript its a snippet and also the function SpawnProtect does not require any keywords as you are writing Filterscript(Snippet yeah) and If it is UNIQUE what make its unique from other ??
Reply
#6

Quote:
Originally Posted by Infinity
Посмотреть сообщение
Why is one function a stock and one a public?
Why is the time random?
Won't pressing N also show a message when I don't have spawn protection enabled?
fixed.
Reply
#7

Not trying to sound like a dick, but A) this is not unique, B) Why do you use 4 different variables to store useless stuff? if timer is active, he is under spawn protection, when it finishes or anything happens, you turn it to -1, so that means timer isn't active, this way you can do it with 1 variable.
Reply
#8

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
fixed.
You answered one question, are you going to ignore the others?
Reply
#9

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
Not trying to sound like a dick, but A) this is not unique, B) Why do you use 4 different variables to store useless stuff? if timer is active, he is under spawn protection, when it finishes or anything happens, you turn it to -1, so that means timer isn't active, this way you can do it with 1 variable.
Didn't get you, can you try explaining clearly?
Reply
#10

Well its bad idea to use Random function some of the player have more protection and some has less thats unfair system.

Код:
forward AntiSKfunc(playerid);
public  AntiSKfunc(playerid)
{
        SetPlayerHealth(playerid, 99.0);
        SetPlayerArmour(playerid, 99.0);
        SendClientMessage(playerid, -1, "* Spawn protection ended.");
        return 1;
}
 
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if(newkeys & KEY_NO && AntiSK[playerid] == 1)
        {
            KillTimer(AntiSKt[playerid]);//if you're killing timer here
            AntiSKt[playerid] = SetTimerEx("AntiSKfunc", 100, false, "i", playerid);//why you using timer again here? 
            SendClientMessage(playerid, -1, "* You have ended your spawn protection.");
        }
        return 1;
}
You don't need timer to kill it. You can just add Function name like this.

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if(newkeys & KEY_NO && AntiSK[playerid] == 1)
        {
            KillTimer(AntiSKt[playerid]);//if you're killing timer here
            AntiSKfunc(playerid);// this is better
            SendClientMessage(playerid, -1, "* You have ended your spawn protection."); 
        }
        return 1;
}
But anyway good.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)