Spawn protection system - unique -
Logic_ - 21.05.2016
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)
Re: Spawn protection system - unique -
Luicy. - 21.05.2016
Won't call it unique, it's simple, Anyways.. Nice I guess.
Re: Spawn protection system - unique -
Infinity - 21.05.2016
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?
Re: Spawn protection system - unique -
oMa37 - 21.05.2016
Nothing unique actually, it's simple af.
Re: Spawn protection system - unique -
SyS - 21.05.2016
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 ??
Re: Spawn protection system - unique -
Logic_ - 21.05.2016
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.
Re: Spawn protection system - unique -
PrO.GameR - 21.05.2016
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.
Re: Spawn protection system - unique -
Infinity - 21.05.2016
Quote:
Originally Posted by ALiScripter
fixed.
|
You answered one question, are you going to ignore the others?
Re: Spawn protection system - unique -
Logic_ - 21.05.2016
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?
Re: Spawn protection system - unique -
MBilal - 21.05.2016
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.