SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 21/05/2016, 04:34 AM   #1
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: 666
Posts: 1,490
Reputation: 263
Default Spawn protection system - unique

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)
__________________
Premium quality and reasonable pricing game Server hosting

Last edited by Logic_; 21/05/2016 at 08:13 AM.
Logic_ is offline   Reply With Quote
Old 21/05/2016, 06:12 AM   #2
Luicy.
Banned
 
Join Date: Dec 2014
Location: Sweden, Skövde
Posts: 831
Reputation: 79
Default Re: Spawn protection system - unique

Won't call it unique, it's simple, Anyways.. Nice I guess.
Luicy. is offline   Reply With Quote
Old 21/05/2016, 06:46 AM   #3
Infinity
High-roller
 
Infinity's Avatar
 
Join Date: Jul 2009
Posts: 1,538
Reputation: 975
Default Re: Spawn protection system - unique

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?
__________________

I apologize for the stupidity of my fellow members

Quote:
Originally Posted by !damo!spiderman View Post
Stand for something that's going to help the world rather than fill it with more hate. Give someone a hug, tell someone you care... Do something, do anything but do it with love not hate.
Infinity is offline   Reply With Quote
Old 21/05/2016, 07:03 AM   #4
oMa37
High-roller
 
oMa37's Avatar
 
Join Date: Feb 2016
Posts: 1,011
Reputation: 155
Default Re: Spawn protection system - unique

Nothing unique actually, it's simple af.
oMa37 is offline   Reply With Quote
Old 21/05/2016, 07:21 AM   #5
SyS
High-roller
 
SyS's Avatar
 
Join Date: Oct 2015
Posts: 1,984
Reputation: 461
Default Re: Spawn protection system - unique

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 ??
SyS is offline   Reply With Quote
Old 21/05/2016, 07:32 AM   #6
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: 666
Posts: 1,490
Reputation: 263
Default Re: Spawn protection system - unique

Quote:
Originally Posted by Infinity View Post
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.
__________________
Premium quality and reasonable pricing game Server hosting
Logic_ is offline   Reply With Quote
Old 21/05/2016, 07:39 AM   #7
PrO.GameR
Gangsta
 
PrO.GameR's Avatar
 
Join Date: Oct 2012
Posts: 732
Reputation: 121
Default Re: Spawn protection system - unique

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.
__________________
Blueberry Prison Roleplay will be back soon!
Follow the forums for more information about opening day.

Forums
PrO.GameR is offline   Reply With Quote
Old 21/05/2016, 07:44 AM   #8
Infinity
High-roller
 
Infinity's Avatar
 
Join Date: Jul 2009
Posts: 1,538
Reputation: 975
Default Re: Spawn protection system - unique

Quote:
Originally Posted by ALiScripter View Post
fixed.
You answered one question, are you going to ignore the others?
__________________

I apologize for the stupidity of my fellow members

Quote:
Originally Posted by !damo!spiderman View Post
Stand for something that's going to help the world rather than fill it with more hate. Give someone a hug, tell someone you care... Do something, do anything but do it with love not hate.
Infinity is offline   Reply With Quote
Old 21/05/2016, 07:55 AM   #9
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: 666
Posts: 1,490
Reputation: 263
Default Re: Spawn protection system - unique

Quote:
Originally Posted by PrO.GameR View Post
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?
__________________
Premium quality and reasonable pricing game Server hosting
Logic_ is offline   Reply With Quote
Old 21/05/2016, 08:00 AM   #10
MBilal
Gangsta
 
MBilal's Avatar
 
Join Date: May 2013
Posts: 825
Reputation: 57
Default Re: Spawn protection system - unique

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

Code:
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.

Code:
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.
MBilal is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spawn protection Brandon001 Scripting Help 1 18/01/2015 06:38 PM
Spawn protection ScRipTeRi Scripting Help 5 19/12/2013 07:09 PM
Spawn Protection + Spawn Health Help (rep++) iOmar Scripting Help 2 13/04/2012 12:53 PM
[FilterScript] Spawn Protection Filterscript [K665's Spawn Protection] Kerlan Filterscripts 17 28/11/2011 01:02 PM
[FilterScript] [FS]Spawn Protection BurningSWA Filterscripts 44 18/11/2011 06:39 PM


All times are GMT. The time now is 02:38 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.