Jump to content
ThatOneGingie

Simple Alarm E2 *protecc ur base today*

Recommended Posts

Very simple E2 Alarm that you can use to keep your base safe.
No ability to remove players from the whitelist cuz I am lazy, cry about it.

 

This E2 Automatically finds the center of your screen to properly place the HUD, so that's cool I guess.

Video:


Code:
 

@name Alarm E2 For New Rules
@inputs [EGP]:wirelink
@persist [CenterW,CenterH,Armed,Number]:number
@persist [Position]:array [Whitelist]:table 

if(first()){
    runOnChat(1)
    interval(100)
    
    Armed=0
    Number=0
    
    #Dont Fuck With This Stuff, It Finds The Center Of Your Screen To Place The HUD
    CenterH=egpScrH(owner())/2
    CenterW=egpScrW(owner())/2

    function baseSafe(){
        EGP:egpClear()
        EGP:egpRoundedBox(1,vec2(CenterW+750,CenterH+425),vec2(300,100))
        EGP:egpColor(1,vec(0,0,0))
        EGP:egpAlpha(1,200)
        
        EGP:egpText(2,"Base Safe",vec2(CenterW+750,CenterH+400))
        EGP:egpSize(2,45)
        EGP:egpColor(2,vec(0,255,0))
        EGP:egpAlign(2,1)
    }
    function baseTripped(){
        EGP:egpClear()
        EGP:egpRoundedBox(1,vec2(CenterW+750,CenterH+425),vec2(300,100))
        EGP:egpColor(1,vec(0,0,0))
        EGP:egpAlpha(1,200)
        
        EGP:egpText(2,"!!Base Alarm!!",vec2(CenterW+750,CenterH+400))
        EGP:egpSize(2,45)
        EGP:egpColor(2,vec(255,0,0))
        EGP:egpAlign(2,1)
        
    }
    function findTheRaiders(){
        Alarm=find():isPlayer()
        findIncludeEntities(players())
        findInBox(Position[1,vector],Position[2,vector])
        foreach(I,L:entity=Whitelist){
            findExcludeEntity(L)
        }    
    }
} 
else{
    interval(500)
    
    findTheRaiders()
    
    if(Alarm){
        if(Armed==1){
            baseTripped()
            printColor(vec(69,255,69),"[Base Alarm]",vec(69,69,69)," You Are Being Raided! ",vec(255,69,69),"Suspected Player(s): "+find():name())  
        }
    }
    else{ 
        baseSafe()
    }
    
    if(chatClk(owner())){
        LS=lastSaid():lower():explode(" ")
        if(LS[1,string]:sub(1,1)=="."){
            switch(LS[1,string]){
                case ".pos",
                    Number++
                    Position[Number,vector]=owner():aimPos()
                    if(Position:count()==1){
                        printColor(vec(69,255,69),"[Base Alarm]",vec(69,69,69)," 1 Out Of 2 Needed Positions Recorded")
                    }
                    elseif(Position:count()==2){
                        Armed=1
                        printColor(vec(69,255,69),"[Base Alarm]",vec(69,69,69)," The Alarm Is Now ARMED")
                    }
                break 
                case ".check",
                    printColor(vec(69,255,69),"[Base Alarm]",vec(69,69,69)," The Following Players Are On Your Whitelist: ")
                    foreach(I,L:entity=Whitelist){
                        print(L:name())
                    }
                break
                case ".add",
                    local Player=findPlayerByName(LS[2,string])
                    if(Player:isPlayer()){
                        Whitelist[Player:steamID(),entity]=Player
                        printColor(vec(69,255,69),"[Base Alarm]",vec(69,69,69)," Added The Following Player To Whitelist: "+Player:name())
                    }
                    else{
                        printColor(vec(69,255,69),"[Base Alarm]",vec(69,69,69)," This Player Does Not Exist: "+Player:name())
                    }
                break
            }
        }
    }
}

 

Share this post


Link to post
Share on other sites
Vexyzs    34

This is great, but thing it could work on is how much it spams the chat. 

Share this post


Link to post
Share on other sites
7 hours ago, Vexyzs said:

This is great, but thing it could work on is how much it spams the chat. 

Chat spam to grab ur attention since alarm E2s cant make noise

 

Share this post


Link to post
Share on other sites
Vexyzs    34
3 minutes ago, Insert White Name said:

what's e2 

Expression 2 a useful way to make random stuff

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...