AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   I want a Trap plugin (https://forums.alliedmods.net/showthread.php?t=312481)

Mikaeel123 12-05-2018 13:53

I want a Trap plugin
 
Hi all . i want a trap plugin for jail break . tr can trap trs and cts . cts cant buy trap . thanks for help :X
/trap for buy trap
bind key+settrap for set the trap

OciXCrom 12-05-2018 14:01

Re: I want a Trap plugin
 
And what do traps do?!

Mikaeel123 12-05-2018 14:13

Re: I want a Trap plugin
 
-Rocket trap
-Slap 99 dmg trap
-bury trap
-bilnd trap
-fire trap
-disarm trap
-shove trap

Fuck For Fun 12-05-2018 14:52

Re: I want a Trap plugin
 
Fortnite request....wake up is "sh*t" game

Mikaeel123 12-06-2018 05:00

Re: I want a Trap plugin
 
What ? :|

OciXCrom 12-06-2018 08:48

Re: I want a Trap plugin
 
Quote:

Originally Posted by Fuck For Fun (Post 2626908)
Fortnite request....wake up is "sh*t" game

How is this related to Fortnite?!

Fuck For Fun 12-06-2018 18:14

Re: I want a Trap plugin
 
Quote:

Originally Posted by Mikaeel123 (Post 2626951)
What ? :|

This is my thinking trap, if not related then successfully searching

Mikaeel123 03-01-2019 04:25

Re: I want a Trap plugin
 
i dont find this in search . who have this ??

sekac 03-01-2019 13:40

Re: I want a Trap plugin
 
This is from my old server, here you go:

Code:

/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
\\                                                                                //
//                          AMXX Traps v2.0 by penGuiN^^                        \\
\\                                                                                //
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
\\                                                                                //
// - Bury Trap  - Player will be buried (they won't lose their weapons)          \\
\\ - Slap Trap  - Player will be slapped with their health cut in half          //
// - Death Trap  - Player will be instantly killed                                \\
\\ - Blind Trap  - Player will become blind                                      //
// - Slow Trap  - Player will lose all of their weapons (except knife)          \\
\\ - Math        - Player will become unable to move until they answer a math    //
//                problem (they type the answer into chat)                      \\
\\ - Drug        - Player overdoses on drugs                                      //
// - Hiccup      - Player gets the hiccups (jumps at random times)                \\
\\                                                                                //
//\\//\\//\\//\\//\\//\\// Console Commands  (ADMIN_KICK) \\//\\//\\//\\//\\//\\//\\
\\                                                                                //
// - amx_traps          - Changes the cvar traps_enable - <0|1 = OFF/ON>          \\
\\                                                                                //
//\\//\\//\\//\\//\\//\\//\\// Cvars <1|0 - on/off> //\\//\\//\\//\\//\\//\\//\\//\\
\\                                                                                //
// - traps_bury        - Enables/Disables usage of Bury Traps (Default = 1)      \\
\\ - traps_slap        - Enables/Disables usage of Slap Traps (Default = 1)      //
// - traps_death        - Enables/Disables usage of Death Traps (Default = 1)    \\
\\ - traps_blind        - Enables/Disabled usage of Blind Traps (Default = 1)    //
// - traps_slow        - Enables/Disables usage of Slow Traps (Default = 1)      \\
\\ - traps_math        - Enables/Disabled usage of Math Traps (Default = 1)      //
// - traps_drug        - Enables/Disables usage of Death Traps (Default = 1)    \\
\\ - traps_hiccup      - Enables/Disabled usage of Blind Traps (Default = 1)    //
\\ - traps_goggle      - Enables/Disables usage of Trap Goggles (Default = 1)    //
// - traps_price_bury  - Price of the Bury Trap                                  \\
\\ - traps_price_slap  - Price of the Slap Trap                                  //
// - traps_price_death  - Price of the Death Trap                                \\
\\ - traps_price_blind  - Price of the Blind Trap                                //
// - traps_price_slow  - Price of the Slow Trap                                  \\
\\ - traps_price_math  - Price of the Math Trap                                  //
// - traps_price_drug  - Price of the Drug Trap                                  \\
\\ - traps_price_hiccup - Price of the Hiccup Trap                                //
// - traps_price_goggle - Price of the Trap Goggles                              //
// - traps_max          - Amount of traps that can be bought per round per player \\
\\ - traps_radius      - How big the traps actually are                          //
// - traps_enable      - Enable/Disable usage of Traps                          \\
\\                                                                                //
//\\//\\//\\//\\//\\//\\//\\//\\//\\// Credit \\//\\//\\//\\//\\//\\//\\//\\//\\//\\
\\                                                                                //
// - Idea      - xeroblood's Shootable Proximity Mines plugin.                  \\
\\                                                                                //
// - Coding    - I got a lot of help with the planting code and /help code from  \\
\\                xeroblood's Shootable Proximity Mines plugin.                  //
//              - I got the Hiccup code from a plugin made by kingpin            \\
\\              - I got the blind code from a plugin made by T(+)rget/f117bomb    //
//              - Gangien wrote the equation generation code for the Math Trap    \\
\\              - Gangien created the sprites for the traps                      //
//              - Took some coding from Necro's Block Maker plugin                \\
\\                                                                                //
// - Shouts    - Stashio                                                        \\
\\              - OpTiKaL                                                        //
//              - HutCh`                                                          \\
\\              - Gangien                                                        //
//              - brian                                                          \\
\\              - Camper Joe                                                      //
//              - Sheyla (Pro!)                                                  \\
\\              - saladfingers (http://www.fat-pie.com/salad.htm)                //
//                                                                                \\
\\ - PhooGi    - Hide N Seek - 66.151.138.50:27015                              //
//              - KZ (Kreedz) - 66.150.188.79:27015                              \\
\\                                                                                //
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <money_ul>
#include <dhudmessage>
#include <colorchat>

//#define DEBUGGING 1

//
//DON'T EDIT THESE
//
#define T_BUY      0
#define T_PICK      1
#define T_PLANT    3
#define T_GOGGLES  5
#define T_IMMUNITY  6
#define T_BACK      8
#define T_EXIT      9

#define T_BURY      0
#define T_SLAP      1
//#define T_DEATH    2
#define T_BLIND    2
#define T_SLOW      3
//#define T_MATH      4
#define T_DRUG      4
#define T_HICCUP    5

#define NUMBER_OF_TRAPS 6

#define TASK_PLANT  16000
#define TASK_MOVE    16100
#define TASK_NOTICE  16200
#define TASK_BURY    500
#define TASK_SLOW    600
#define TASK_DRUG    700
#define TASK_MATH    800
#define TASK_HICCUP  900
#define TASK_PLAYHIC 1000

#define WAIT_TIME  20.0

#define T_MAX_ROUND 256

#define OP_ADD      0
#define OP_SUBTRACT 1
#define OP_MULTIPLY 2
#define OP_DIVIDE  3

new operators[4][2] = {
        "+",
        "-",
        "*",
        "/"
}

//
// Message to be printed into chat when a trap is bought and when it is used.
//
#define BUY_MESS "[Zamke] Sada imas %d [%s] Zamki. Ukupno imas %d Zamki"

//
// REM THIS OUT IF YOU DON'T WANT IT TO SHOW ON THE SCREEN WHEN SOMEONE JOINS
//
#define T_NOTICE "[ZAMKE] Da koristis zamke, kucaj /zamke"

//
// Global declarations...
//
new MenuKeys = (1 << 0) + (1 << 1) + (1 << 2) + (1 << 3) + (1 << 4) + (1 << 5) + (1 << 6) + (1 << 7) + (1 << 8) + (1 << 9)
new MainMenuKeys = (1 << 0) + (1 << 1) + (1 << 3) + (1 << 5) + (1 << 6) + (1 << 9)
new BuyMenuBodyText[256]
new PickMenuBodyText[256]
new MainMenuBodyText[256]

new bool:is_buyzone[32] = true

new pTraps[32]
new pTrapsRound[32]
new pTrapTypes[32][NUMBER_OF_TRAPS]
new pPickedTrap[32]
new pPickedTrapString[32][32]
new pTotalTrapsPlanted
new pTrapOrigins[T_MAX_ROUND][3]
new pTrapOwner[T_MAX_ROUND]
new pTrapType[T_MAX_ROUND]

new spriteTrap[8]
new spriteQMark

new bool:pTrapActive[T_MAX_ROUND]
new bool:is_blind[32] = false
new bool:is_slow[32] = false
new bool:is_bury[32] = false
new bool:is_planting[32] = false
new bool:is_drugged[32] = false
new bool:is_math[32] = false
new bool:is_hiccup[32] = false
new bool:is_goggle[32] = false
new bool:is_immunity[32] = false
new mathAnswer[32]
new mathEquations[32][128]
new mathLastGuess[32] = -1
new mathLastGuess2[32] = -1

new buryOrigins[32]
new Float:user_speed[32] = 250.0
new CsTeams:pTrapOwnerTeam[T_MAX_ROUND]

new soundPlant[] = "weapons/c4_plant.wav"
new soundJeopardy[] = "traps/jeopardy.wav"

new soundHiccups[3][19] = {
        "traps/hiccup.wav",
        "traps/hiccup2.wav",
        "traps/hiccup3.wav"
}

new spriteTraps[6][29] = {
        "sprites/traps/trap1.spr",
        "sprites/traps/trap2.spr",
        "sprites/traps/trap4.spr",
        "sprites/traps/trap5.spr",
        "sprites/traps/trap7.spr",
        "sprites/traps/trap8.spr"
}

//
// FUNCTIONS AND EVENTS START HERE!!!!!!!!!
//
public plugin_init()
{
        register_plugin("Set Traps", "v1.0", "xx_sirhc_xx")
       
        register_concmd("amx_traps", "ConCmdTraps", ADMIN_KICK, "- <0|1 = OFF/ON>")
       
        register_clcmd("say", "ClCmdSay", -1, "- Say")
       
        register_clcmd("say /zamke", "ClCmdTraps", -1, "- Traps Menu")
       
        register_event("StatusIcon", "Event_BuyZone", "be", "2=buyzone")
        register_event("DeathMsg", "Event_Death", "a")
        register_event("HLTV", "Event_Restart", "a", "1=0", "2=0")
        register_event("ScreenFade", "Event_ScreenFade", "b")
        register_event("CurWeapon", "eventCurWeapon", "be");
        register_logevent("Startr", 2, "1=Round_Start");
       
        register_cvar("traps_bury", "1")
        register_cvar("traps_slap", "1")
        register_cvar("traps_death", "0")
        register_cvar("traps_blind", "1")
        register_cvar("traps_hiccup", "1")
        register_cvar("traps_slow", "1")
        register_cvar("traps_drug", "1")
        register_cvar("traps_math", "1")
        register_cvar("traps_enable", "1")
        register_cvar("traps_goggle", "1")
        register_cvar("traps_immunity", "1")
        register_cvar("traps_max", "2")            //max traps that can be bought per round
        register_cvar("traps_radius", "50")
        register_cvar("traps_buyzone", "0")        //set to 0 for users to buy traps anywhere
        register_cvar("traps_price_bury", "8000")
        register_cvar("traps_price_slap", "5000")
        register_cvar("traps_price_death", "off")
        register_cvar("traps_price_blind", "6000")
        register_cvar("traps_price_slow", "7000")
        register_cvar("traps_price_drug", "4000")
        register_cvar("traps_price_math", "7000")
        register_cvar("traps_price_hiccup", "4000")
        register_cvar("traps_price_goggle", "7000")
        register_cvar("traps_price_immunity", "12000")
       
        SetupBuyMenu()
        SetupMainMenu()
       
        register_menucmd(register_menuid("\rTraps!"), MainMenuKeys, "Traps")
        register_menucmd(register_menuid("\rPick the trap to plant"), MenuKeys, "PickIt")
        register_menucmd(register_menuid("\rBuy Traps"), MenuKeys, "BuyIt")
}

public ConCmdTraps(id, level, cid)
{
        if (!cmd_access(id, level, cid, 2))
                return PLUGIN_HANDLED
       
        new pArg[32]
        read_argv(1, pArg, 31)
       
        new OnOff = str_to_num(pArg)
       
        if (!OnOff)
        {
                set_cvar_num("traps_enable", 0)
                console_print(id, "[Zamke] Zamke iskljucene!")
                client_print(0, print_chat, "[Zamke] Admin je iskljucio zamke.")
        }
        else
        {
                set_cvar_num("traps_enable", 1)
                console_print(id, "[Zamke] Zamke ukljucene!")
                client_print(0, print_chat, "[Zamke] Admin je ukljucio zamke.")
        }
       
        return PLUGIN_HANDLED
}

public plugin_precache()
{
        precache_sound(soundPlant)
        precache_sound(soundJeopardy)
       
        for (new i = 0; i < 3; i++)
                precache_sound(soundHiccups[i])
       
        for (new i = 0; i < 6; i++)
                spriteTrap[i] = precache_model(spriteTraps[i])
       
        spriteQMark = precache_model("sprites/traps/QMark.spr")
}

public client_putinserver(id)
{
        new pArgs[2]
        pArgs[0] = id
       
        #if defined T_NOTICE
        set_task(10.0, "ShowNotice", (TASK_NOTICE + id), pArgs, 1)
        #endif
       
        ResetPlayerVariables(id)
}

public client_disconnect(id)
        ResetPlayerVariables(id)

public ShowNotice(pArgs[])
{
        new id = pArgs[0]
       
        set_dhudmessage(200, 155, 0, -1.0, 0.50, 0,6.0,10.0)
        show_dhudmessage(id, T_NOTICE)
}

public Event_Restart()
{
        pTotalTrapsPlanted = 0
       
        for (new z = 1; z < 33; z++)
                ResetMostPlayerVariables(z)
       
        return PLUGIN_CONTINUE
}

public eventCurWeapon(id)
{
       
        if (is_slow[id - 1] || is_math[id - 1])
        {
                new Float:speed = user_speed[id - 1]
                set_user_maxspeed(id, speed)
        }
}

public ResetPlayerVariables(id)
{
       
        pTraps[id - 1] = 0
       
        ResetMostPlayerVariables(id)
       
        for (new i = 0; i < NUMBER_OF_TRAPS; i++)
                pTrapTypes[id - 1][i] = 0
       
        for (new i = 0; i < 5; i++)
                pTrapTypes[id - 1][i] = 0
       
        pPickedTrap[id - 1] = -1
       
}

public ResetMostPlayerVariables(id)
{
       
        pTrapsRound[id - 1] = 0
       
        is_blind[id - 1] = false
        is_slow[id - 1] = false
        is_bury[id - 1] = false
        is_planting[id - 1] = false
        is_math[id - 1] = false
        is_drugged[id - 1] = false
        is_hiccup[id - 1] = false
        is_goggle[id - 1] = false
        is_immunity[id - 1] = false
       
        mathLastGuess[id - 1] = -1
        mathLastGuess2[id - 1] = -1
       
        user_speed[id - 1] = 250.0
       
        buryOrigins[id - 1] = 0
       
}

public Event_Death()
{
        if (!get_cvar_num("traps_enable"))
                return PLUGIN_CONTINUE
       
        new id = read_data(2)
       
        if (task_exists(id))
                remove_task(id)
       
        if (task_exists(id + TASK_DRUG))
                remove_task(id + TASK_DRUG)
       
        if (task_exists(id + TASK_MATH))
                remove_task(id + TASK_MATH)
       
        if (task_exists(id + TASK_SLOW))
                remove_task(id + TASK_SLOW)
       
        if (task_exists(id + TASK_BURY))
                remove_task(id + TASK_BURY)
       
        if (task_exists(id + TASK_PLANT))
                remove_task(id + TASK_PLANT)
       
        if (task_exists(id + TASK_MOVE))
                remove_task(id + TASK_MOVE)
       
        if (task_exists(id + TASK_HICCUP))
                remove_task(id + TASK_HICCUP)
       
        if (task_exists(id + TASK_PLAYHIC))
                remove_task(id + TASK_PLAYHIC)
       
       
        ResetPlayerVariables(id)
       
        return PLUGIN_CONTINUE
}




/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\//\\  BUYING TRAPS    \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

//
// This is called when the user types "/buytrap" into chat
//
public ClCmdBuyTrap(id)
{
        SetupBuyMenu()
        show_menu(id, MenuKeys, BuyMenuBodyText)
       
        return PLUGIN_HANDLED
}

//
// This is called when the user types "/traps" into chat
//
public ClCmdTraps(id)
{
        SetupMainMenu()
        show_menu(id, MainMenuKeys, MainMenuBodyText)
       
        return PLUGIN_HANDLED
}

//
// This is called when the user tries to buy a trap from the menu
//
public BuyIt(id, key)
{
        switch (key)
        {
                case T_BURY:
                        if (canBuy(id, "bury"))
                        BuyTrap(id, T_BURY, "Bury", get_cvar_num("traps_price_bury"))
               
                case T_SLAP:
                        if (canBuy(id, "slap"))
                        BuyTrap(id, T_SLAP, "Slap", get_cvar_num("traps_price_slap"))
               
                case T_BLIND:
                        if (canBuy(id, "blind"))
                        BuyTrap(id, T_BLIND, "Blind", get_cvar_num("traps_price_blind"))
               
                case T_HICCUP:
                        if (canBuy(id, "hiccup"))
                        BuyTrap(id, T_HICCUP, "Hiccup", get_cvar_num("traps_price_hiccup"))
               
                case T_SLOW:
                        if (canBuy(id, "slow"))
                        BuyTrap(id, T_SLOW, "Slow", get_cvar_num("traps_price_slow"))
               
                case T_DRUG:
                        if (canBuy(id, "drug"))
                        BuyTrap(id, T_DRUG, "Drug", get_cvar_num("traps_price_drug"))
               
                case T_BACK:
                {
                        ClCmdTraps(id)
                        return PLUGIN_HANDLED
                }
               
                case T_EXIT:
                        return PLUGIN_HANDLED
        }
       
        ClCmdBuyTrap(id)
        return PLUGIN_HANDLED
}

public ClCmdBuyGoggles(id)
{
       
        if (!get_cvar_num("traps_enable"))
        {
                client_print(id, print_chat, "[Zamke] Admin je iskljucio zamke!")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
       
        if (!get_cvar_num("traps_goggle"))
        {
                client_print(id, print_chat, "[Zamke] Detektor zamki iskljucen!")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
        if  (get_user_team(id) == 1)
        {
                client_print(id, print_chat, "[Zamke] Samo CT moze kupiti detektor!")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
               
        }
        if (!is_user_alive(id))
        {
                client_print(id, print_chat, "[Zamke] Mrtav si, ne mozes kupiti detektor.")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
       
        if ((!is_buyzone[id - 1]) && (get_cvar_num("traps_buyzone") != 0))
        {
                client_print(id, print_chat, "[Zamke] Moras biti u zoni kupovine da bi kupio detektor.")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
       
        if (is_goggle[id - 1])
        {
                client_print(id, print_chat, "[Zamke] Vec imas Detektor za zamke.")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
       
        if ((cs_get_user_money_ul(id)) < (get_cvar_num("traps_price_goggle")))
        {
                client_print(id, print_chat, "[Zamke] Nemas dovoljno novca za detektor.")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
       
        is_goggle[id - 1] = true
       
        new Money = cs_get_user_money_ul(id)
        cs_set_user_money_ul(id, Money - get_cvar_num("traps_price_goggle"))
       
        client_print(id, print_chat, "[Zamke] Kupio si Detektor. Sada vidis postavljene zamke.")
        ClCmdTraps(id)
       
        return PLUGIN_HANDLED
}

public ClCmdBuyImmunity(id)
{
       
        if (!get_cvar_num("traps_enable"))
        {
                client_print(id, print_chat, "[Zamke] Admin je iskljucio zamke!")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
       
        if (!get_cvar_num("traps_immunity"))
        {
                client_print(id, print_chat, "[Zamke] Imunitet je iskljucen!")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
        if  (get_user_team(id) == 1)
        {
                client_print(id, print_chat, "[Zamke] Samo CT moze kupiti imunitet!")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
               
        }
       
        if (!is_user_alive(id))
        {
                client_print(id, print_chat, "[Zamke] Mrtav si, ne mozes kupiti imunitet.")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
       
        if ((!is_buyzone[id - 1]) && (get_cvar_num("traps_buyzone") != 0))
        {
                client_print(id, print_chat, "[Zamke] Moras biti u zoni kupovine da bi kupio imunitet.")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
       
        if (is_immunity[id - 1])
        {
                client_print(id, print_chat, "[Zamke] Vec imas imunitet.")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
       
        if ((cs_get_user_money_ul(id)) < (get_cvar_num("traps_price_immunity")))
        {
                client_print(id, print_chat, "[Zamke] Nemas dovoljno novca za imunitet.")
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
       
        is_immunity[id - 1] = true
       
        new Money = cs_get_user_money_ul(id)
        cs_set_user_money_ul(id, Money - get_cvar_num("traps_price_immunity"))
       
        client_print(id, print_chat, "[Zamke] Sada si imun na sve zamke do kraja runde! :)")
        ClCmdTraps(id)
       
        return PLUGIN_HANDLED
}
public Startr(){
        set_task(1.0, "Imunprvovreme")
       
}

public Imunprvovreme(){
        new i;
        new ctnum;
        new players[32];
        get_players(players,ctnum,"ae", "CT")
        for(i=0; i<ctnum; i++) {
                is_immunity[players[i] - 1] = true
                //ColorChat(players[i], TEAM_COLOR, "^4[Zamke]^3 Imun si na zamke dok se ne zavrsi sakrivanje!")
                set_task(48.0, "Visenijeimun")
        }
}
public Visenijeimun(){
        new i;
        new ctnum;
        new players[32];
        get_players(players,ctnum,"ae", "CT")
        for(i=0; i<ctnum; i++) {
                is_immunity[players[i] - 1] = false
                //ColorChat(players[i], TEAM_COLOR, "^4[Zamke]^3 Skrivanje zavrseno, imunitet ugasen. Mozes ga kupiti u Shopu :)")
        }
}



public Traps(id, key)
{
        switch (key)
        {
                case T_BUY:
                        ClCmdBuyTrap(id)
               
                case T_PICK:
                        ClCmdPickTrap(id)
               
                case T_GOGGLES:
                        ClCmdBuyGoggles(id)
               
                case T_IMMUNITY:
                        ClCmdBuyImmunity(id)
               
                case T_PLANT:
                {
                        ClCmdSetTrap(id)
                        SetupMainMenu()
                        show_menu(id, MainMenuKeys, MainMenuBodyText)
                }
        }
       
        return PLUGIN_HANDLED
}

//
// This buys the trap
//
public BuyTrap(id, tType, tName[], tPrice)
{
        pTraps[id - 1]++
        pTrapsRound[id - 1]++
        pTrapTypes[id - 1][tType]++
       
        new Money = cs_get_user_money_ul(id)
        cs_set_user_money_ul(id, Money - tPrice)
       
        if (pPickedTrap[id - 1] == -1)
        {
                pPickedTrap[id - 1] = tType
                format(pPickedTrapString[id - 1], 31, "%s", tName)
        }
       
        client_print(id, print_chat, BUY_MESS, pTrapTypes[id - 1][tType], tName, pTraps[id - 1])
       
        SetupBuyMenu()
        show_menu(id, MenuKeys, BuyMenuBodyText)
       
        return 1
}

//
// This event is called when a user enters/exits a buy zone
//
public Event_BuyZone(id)
{
        if (read_data(1))
                is_buyzone[id - 1] = true
        else
                is_buyzone[id - 1] = false
       
        return PLUGIN_CONTINUE
}

//
// This boolean is used to check if a user can buy the trap
//
public bool:canBuy(id, cvarName[])
{
        new cvarNameEnable[32]
        new cvarPriceCheck[32]
       
        format(cvarNameEnable, 31, "traps_%s", cvarName)
        format(cvarPriceCheck, 31, "traps_price_%s", cvarName)
       
        if (!get_cvar_num("traps_enable"))
        {
                client_print(id, print_chat, "[Zamke] Admin je iskljucio zamke!")
                return false
        }
       
        if (!get_cvar_num(cvarNameEnable))
        {
                client_print(id, print_chat, "[Zamke] Ova zamka je onemogucena.")
                return false
        }
       
        if (!is_user_alive(id))
        {
                client_print(id, print_chat, "[Zamke] Mrtav si, ne mozes kupiti ovu zamku.")
                return false
        }
       
        if ((!is_buyzone[id - 1]) && (get_cvar_num("traps_buyzone") != 0))
        {
                client_print(id, print_chat, "[Zamke] Moras biti u zoni kupovine da bi kupio zamku!")
                return false
        }
       
        if (pTrapsRound[id - 1] >= get_cvar_num("traps_max"))
        {
                client_print(id, print_chat, "[Zamke] Vec imas maksimalan broj zamki za ovu rundu!")
                return false
        }
       
        if ((cs_get_user_money_ul(id)) < (get_cvar_num(cvarPriceCheck)))
        {
                client_print(id, print_chat, "[Zamke] Nemas dovoljno novca za ovu zamku.")
                return false
        }
       
        return true
}

/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\//\\  PICKING TRAPS  \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

//
// This is called when a player types "/picktrap" into chat
//
public ClCmdPickTrap(id)
{
        SetupPickMenu(id)
        show_menu(id, MenuKeys, PickMenuBodyText)
       
        return PLUGIN_HANDLED
}

//
// This is called when a user tries to pick a Trap to be planted
//
public PickIt(id, key)
{
        switch (key)
        {
                case T_BURY:
                        if (canPick(id, "bury", T_BURY))
                {
                        pPickedTrap[id - 1] = T_BURY
                        pPickedTrapString[id - 1] = "Bury"
                        client_print(id, print_chat, "[Zamke] Izabrao si zakopavanje.");
                }
               
                case T_SLAP:
                        if (canPick(id, "slap", T_SLAP))
                {
                        pPickedTrap[id - 1] = T_SLAP
                        pPickedTrapString[id - 1] = "Slap"
                        client_print(id, print_chat, "[Zamke] Izabrao si samaranje.");
                }
               
                case T_BLIND:
                        if (canPick(id, "blind", T_BLIND))
                {
                        pPickedTrap[id - 1] = T_BLIND
                        pPickedTrapString[id - 1] = "Blind"
                        client_print(id, print_chat, "[Zamke] Izabrao si slepilo.");
                }
               
                case T_HICCUP:
                        if (canPick(id, "hiccup", T_HICCUP))
                {
                        pPickedTrap[id - 1] = T_HICCUP
                        pPickedTrapString[id - 1] = "Hiccup"
                        client_print(id, print_chat, "[Zamke] Izabrao si stucanje.");
                }
               
                case T_SLOW:
                        if (canPick(id, "slow", T_SLOW))
                {
                        pPickedTrap[id - 1] = T_SLOW
                        pPickedTrapString[id - 1] = "Slow"
                        client_print(id, print_chat, "[Zamke] Izabrao si usporavanje.");
                }
               
                case T_DRUG:
                        if (canPick(id, "drug", T_DRUG))
                {
                        pPickedTrap[id - 1] = T_DRUG
                        pPickedTrapString[id - 1] = "Drug"
                        client_print(id, print_chat, "[Zamke] Izabrao si drogu.");
                }
               
                case T_BACK:
                {
                        ClCmdTraps(id)
                        return PLUGIN_HANDLED
                }
               
                case T_EXIT:
                        return PLUGIN_HANDLED
        }
       
        ClCmdPickTrap(id)
        return PLUGIN_HANDLED
}

//
// This boolean checks to see if the player can Pick the selected Trap
//
public bool:canPick(id, tName[], pType)
{
        new cvarNameEnable[32]
       
        format(cvarNameEnable, 31, "traps_%s", tName)
       
        if (!get_cvar_num("traps_enable"))
        {
                client_print(id, print_chat, "[Zamke] Admin je iskljucio zamke!")
                return false
        }
       
        if (!get_cvar_num(cvarNameEnable))
        {
                client_print(id, print_chat, "[Zamke] Ova zamka je iskljucena.")
                return false
        }
       
        if (!pTrapTypes[id - 1][pType])
        {
                client_print(id, print_chat, "[Zamke] Nemas %s zamki.", tName)
                return false
        }
       
        return true
}







/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\//\\  PLANTING TRAPS  \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

//
// This is called when a user pushes a key bound to "+settrap"
//
public ClCmdSetTrap(id)
{
        if (!canPlant(id))
        {
                ClCmdTraps(id)
                return PLUGIN_HANDLED
        }
       
        //
        // Progress Bar (Activate) -- This was taken almost directly from xeroblood!
        //
        message_begin( MSG_ONE, 108, {0,0,0}, id )
        write_byte(1)  // duration
        write_byte(0)  // duration
        message_end()
       
        new pID[2]
        pID[0] = id
       
        is_planting[id - 1] = true
        set_task(0.1, "CheckUserMoving", (TASK_MOVE + id), pID, 1)
        set_task(1.0, "PlantTrap", (TASK_PLANT + id), pID, 1)
       
        return PLUGIN_HANDLED;
       
}

//
// This is called when a user executes -settrap (let's go of the key bound to +settrap)
//
public ClCmdEndSetTrap(id)
{
        if (task_exists((TASK_PLANT + id)))
        {
                remove_task((TASK_PLANT + id))
                remove_task((TASK_MOVE + id))
        }
       
        //
        // Progress Bar (Terminate)
        //
        message_begin(MSG_ONE, 108, {0,0,0}, id)
        write_byte(0) // duration
        write_byte(0) // duration
        message_end()
       
        is_planting[id - 1] = false
       
        return PLUGIN_HANDLED
}

//
// This plants the Trap
//
public PlantTrap(pArgs[])
{
        new id = pArgs[0]
       
        if (task_exists((TASK_MOVE + id)))
                remove_task((TASK_MOVE + id))
       
        new pTot = pTotalTrapsPlanted
        new pTyp = pPickedTrap[id - 1]
       
        get_user_origin(id, pTrapOrigins[pTot], 0)
        pTrapOwner[pTot] = id
        pTrapOwnerTeam[pTot] = cs_get_user_team(id)
        pTrapActive[pTot] = true
        pTrapType[pTot] = pTyp
       
        pTraps[id - 1]--
        pTrapTypes[id - 1][pTyp]--
        pTotalTrapsPlanted++
       
        if (pTrapTypes[id - 1][pTyp] <= 0)
        {
                pPickedTrap[id - 1] = -1
                for (new n = 0; n < NUMBER_OF_TRAPS; n++)
                {
                        if (pTrapTypes[id - 1][n] > 0)
                        {
                                pPickedTrap[id - 1] = n
                                break;
                        }
                }
        }
       
        emit_sound(id, CHAN_WEAPON, soundPlant, 1.0, ATTN_NORM, 0, PITCH_NORM)
       
        //set_user_maxspeed(id, user_speed[id - 1])
        is_planting[id - 1] = false
       
        client_print(id, print_chat, "[Zamke] Tvoja zamka je uspesno postavljena.")
        client_print(id, print_chat, BUY_MESS, pTrapTypes[id - 1][pTyp], pPickedTrapString[id - 1], pTraps[id - 1])
       
        //new origin[3]
        //new Float:vOrigin[3]
       
        //entity_get_vector(id, EV_VEC_origin, vOrigin)
       
        //get_user_origin(id, origin, 3);
        //IVecFVec(origin, vOrigin);
       
        //new ent = create_entity("info_target");
        //new Float:gfDefaultBlockAngles[3] = { 0.0, 0.0, 0.0 };
        //new Float:gfBlockSizeMinForZ[3] = {-16.0,-16.0,-2.0};
        //new Float:gfBlockSizeMaxForZ[3] = { 16.0, 16.0, 2.0};
       
        //if (is_valid_ent(ent))
        //{
        //        //set block properties
        //        entity_set_string(ent, EV_SZ_classname, "trap_flag");
        //        entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
        //        entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
        //        entity_set_model(ent, tehModel);
        //        entity_set_vector(ent, EV_VEC_angles, gfDefaultBlockAngles);
        //        entity_set_size(ent, gfBlockSizeMinForZ, gfBlockSizeMaxForZ);
        //        entity_set_origin(ent, vOrigin);
        //        set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransColor, 255)
        //        entity_set_int(ent, EV_INT_solid, SOLID_NOT);
       
        //        pTrapEntity[pTot] = ent
        //        pTrapEntityFlag[pTot] = true
        //        pTrapEntityTeam[pTot] = pev(id,pev_team)
       
       
        //}
        return PLUGIN_HANDLED
}

//
// Makes sure the player isn't moving while planting the Trap
//
public CheckUserMoving(pArgs[])
{
        new id = pArgs[0]
       
        if (!is_user_standing_still(id))
                ClCmdEndSetTrap(id)
        else
                set_task(0.1, "CheckUserMoving", (TASK_MOVE + id), pArgs, 1)
       
        return PLUGIN_HANDLED
}

//
// This boolean checks if a player is able to plant a Trap
//
public bool:canPlant(id)
{
       
        if (!get_cvar_num("traps_enable"))
        {
                client_print(id, print_chat, "[Zamke] Admin je iskljucio zamke.")
                return false
        }
       
        if (!is_user_alive(id))
        {
                client_print(id, print_chat, "[Zamke] Mrtav si, ne mozes kupiti ovu zamku.")
                return false
        }
       
        if (!pTraps[id - 1])
        {
                client_print(id, print_chat, "[Zamke] Prvo kupi zamku da bi je postavio.")
                return false
        }
       
        if (pPickedTrap[id - 1] == -1)
        {
                client_print(id, print_chat, "[Zamke] Nisi odabrao nijednu zamku.")
                ClCmdPickTrap(id)
                return false
        }
       
        if (!is_user_standing_still(id))
        {
                client_print(id, print_chat, "[Zamke] Moras stajati u mestu da bi postavio zamku.")
                return false
        }
       
        if (is_planting[id - 1] == true)
        {
                client_print(id, print_chat, "[Zamke] Vec postavljas zamku.")
                return false
        }
       
        return true
       
}

//
// This boolean makes sure a player is standing still (not jumping or moving!)
//
public bool:is_user_standing_still(id)
{
        if (get_user_button(id) & (IN_JUMP|IN_FORWARD|IN_BACK|IN_MOVELEFT|IN_MOVERIGHT))
                return false
       
        if (!(get_entity_flags(id) & FL_ONGROUND))
                return false
       
        return true
}

/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\//\\  CATCHING PLAYERS IN TRAPS  \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

//
// Checks if the person is in a trap
//
public client_PostThink(id)
{
        new pOrigin[3];
       
        if (!is_user_alive(id))
                return PLUGIN_CONTINUE
       
        if (!get_cvar_num("traps_enable"))
                return PLUGIN_CONTINUE
       
        if (is_slow[id - 1])
        {
                new Float:speed = get_user_maxspeed(id)
                if (speed != user_speed[id - 1])
                        set_user_maxspeed(id, user_speed[id - 1])
               
        }
       
        get_user_origin(id, pOrigin, 0);
       
        for (new i = 0; i < pTotalTrapsPlanted; i++)
        {
                if (pTrapActive[i])
                {
                        #if !defined DEBUGGING
                       
                        new CsTeams:pTheTeam = cs_get_user_team(id)
                       
                        if ((pTrapOwner[i] == id) || (pTrapOwnerTeam[i] == pTheTeam))
                        {
                                DrawSprite(id, i)
                                } else if (is_goggle[id - 1]) {
                                DrawSpriteQ(id, i)
                        }
                       
                        if ((pTrapOwner[i] != id) && (pTrapOwnerTeam[i] != pTheTeam) && (get_entity_flags(id) & FL_ONGROUND))
                        {
                                new pDistance = get_distance(pOrigin, pTrapOrigins[i])
                               
                                if (pDistance <= get_cvar_num("traps_radius"))
                                {
                                        if (!is_immunity[id - 1])
                                                PunishUser(id, i)
                                }
                        }
                        #else
                        if ((get_entity_flags(id) & FL_ONGROUND))
                        {
                                new pDistance = get_distance(pOrigin, pTrapOrigins[i])
                               
                                if (pDistance <= get_cvar_num("traps_radius"))
                                {
                                        PunishUser(id, i)
                                }
                        }
                        #endif
                }
        }
       
        return PLUGIN_CONTINUE
}

//
// Handle's the punishing of users
//

public DrawSprite(id, tNum)
{
       
        message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id)
        write_byte(TE_SPRITE) // additive sprite, plays 1 cycle
        write_coord(pTrapOrigins[tNum][0]) // xpos
        write_coord(pTrapOrigins[tNum][1]) // ypos
        write_coord(pTrapOrigins[tNum][2]) // zpos
        write_short(spriteTrap[pTrapType[tNum]]) // spr index
        write_byte(1) // (scale in 0.1's)
        write_byte(20) //brightness
        message_end()
       
}
public DrawSpriteQ(id, tNum)
{
       
        message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id)
        write_byte(TE_SPRITE) // additive sprite, plays 1 cycle
        write_coord(pTrapOrigins[tNum][0]) // xpos
        write_coord(pTrapOrigins[tNum][1]) // ypos
        write_coord(pTrapOrigins[tNum][2]) // zpos
        write_short(spriteQMark) // spr index
        write_byte(2) // (scale in 0.1's)
        write_byte(20) //brightness
        message_end()
       
}

public PunishUser(id, tNum)
{
        pTrapActive[tNum] = false
       
        switch (pTrapType[tNum])
        {
                case T_BURY:
                {
                        is_bury[id - 1] = true
                        BuryUser(id, tNum)
                }
               
                case T_SLAP:
                {
                        HalfDamageUser(id, tNum)
                        return PLUGIN_HANDLED
                }
               
                case T_BLIND:
                {       
                        new pName[32], aName[32]
                       
                        get_user_name(id, pName, 31)
                        get_user_name(pTrapOwner[tNum], aName, 31)
                       
                        client_print(id, print_chat, "[Zamke] Slepilo!!! Sada si slep.")
                        client_print(0, print_chat, "[Zamke] %s je upao u zamku od %s i sada je slep.", pName, aName)
                       
                        is_blind[id - 1] = true
                       
                        BlindUser(id)
                }
               
                case T_HICCUP:
                {
                        HiccupUser(id, tNum)
                        return PLUGIN_HANDLED
                }
               
                case T_SLOW:
                {
                        is_slow[id - 1] = true
                        SlowUser(id, tNum)
                }
               
                case T_DRUG:
                {
                        is_drugged[id - 1] = true
                        DrugUser(id, tNum)
                }
               
        }
        //set_user_rendering(id,kRenderFxGlowShell, 200,0,0, kRenderNormal,16);
       
        return PLUGIN_HANDLED
}

//
// Burys the user
//
public BuryUser(id, id2)
{
        new pOrigin[3], pName[32], aName[32]
       
        get_user_origin(id, pOrigin, 0)
       
        buryOrigins[id - 1] += 30
       
        is_bury[id - 1] = true
       
        pOrigin[2] -= 30;
        set_user_origin(id, pOrigin)
       
        get_user_name(id, pName, 31)
        get_user_name(pTrapOwner[id2], aName, 31)
       
        client_print(id, print_chat, "[Zamke] Ukopavanje!!! Ukopan si narednih 20sec.")
        client_print(0, print_chat, "[Zamke] %s je upao u zamku od %s i sada je zakopan.", pName, aName)
       
        set_task(WAIT_TIME, "UnBuryUser", id + TASK_BURY)
       
        return 1
}

//
// Slaps the user's health in half
//
public HalfDamageUser(id, id2)
{
        new pName[32], aName[32]
       
        new Health = get_user_health(id)
       
        user_slap(id, (Health / 2), 1)
       
        get_user_name(id, pName, 31)
        get_user_name(pTrapOwner[id2], aName, 31)
       
        client_print(id, print_chat, "[Zamke] Samaranje!!! Pazi se, polovina helta ti je skinuta!")
        client_print(0, print_chat, "[Zamke] %s je lupio samar %s", pName, aName)
       
        return 1
}

//
// Slow the user down
//
public SlowUser(id, id2)
{
        new pName[32], aName[32]
       
        new Float:speed = get_user_maxspeed(id) / 2
       
        set_user_maxspeed(id, speed)
       
        user_speed[id - 1] = speed
        is_slow[id - 1] = true
       
        get_user_name(id, pName, 31)
        get_user_name(pTrapOwner[id2], aName, 31)
       
        client_print(id, print_chat, "[Zamke] Usporavanje!!! Sada si usporen.")
        client_print(0, print_chat, "[Zamke] %s je upao u zamku od %s i sada je usporen.", pName, aName)
       
        set_task(WAIT_TIME, "UnSlowUser", id + TASK_SLOW)
       
        return 1
}

//
// Drug the user
//
public DrugUser(id, id2)
{
        new pName[32], aName[32]
       
        is_drugged[id - 1] = true
       
        message_begin(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id)
        write_byte(170)
        message_end()
       
        get_user_name(id, pName, 31)
        get_user_name(pTrapOwner[id2], aName, 31)
       
        client_print(id, print_chat, "[Zamke] Droga!!! Sada si drogiran.")
        client_print(0, print_chat, "[Zamke] %s se predozirao od %s droge.", pName, aName)
       
        set_task(WAIT_TIME, "UnDrugUser", id + TASK_DRUG)
       
        return 1
}

//
// "Math" the user
//
public MathUser(id, id2)
{
        new pName[32], aName[32], pOrigin[3]
       
        is_math[id - 1] = true
       
        set_user_maxspeed(id, 0.1)
        user_speed[id - 1] = 0.1
       
        get_user_origin(id, pOrigin, 0)
        pOrigin[2] -= 30;
        set_user_origin(id, pOrigin)
       
        get_user_name(id, pName, 31)
        get_user_name(pTrapOwner[id2], aName, 31)
       
        client_cmd(id, "spk %s", soundJeopardy)
        client_print(0, print_chat, "[Zamke] %s je sada u teskoj matematici zbog %s", pName, aName)
        client_print(id, print_chat, "[Zamke] Matematika!!! Resi jednacinu.")
        client_print(id, print_chat, "[Zamke] Resi X? Ukucaj odgovor u chat kada resis.")
       
        cmdMath(id)
       
        return 1
}

//
// Kill's the user
//
public KillUser(id, id2)
{
        new pName[32], aName[32]
       
        user_kill(id)
       
        new aFrags = get_user_frags(id2 + 1)
        aFrags += 1
        set_user_frags(id2 + 1, aFrags)
       
        get_user_name(id, pName, 31)
        get_user_name(pTrapOwner[id2], aName, 31)
       
        client_print(id, print_chat, "[Zamke] Smrt!!! Mrtav si :(")
        client_print((id2 + 1), print_chat, "[Zamke] Ubio si %s sa svojom zamkom smrti.", aName)
        client_print(0, print_chat, "[Zamke] %s je upao u zamku od %s i sada je mrtav :(", pName, aName)
       
        return 1
}

//
// Blinds the user and initializes BlindTask to keep them blind
//
public BlindUser(id)
{
        message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
        write_short(1<<12)
        write_short(1<<8)
        write_short(1<<0)
        write_byte(0)
        write_byte(0)
        write_byte(0)
        write_byte(255)
        message_end()
        set_task(1.0, "BlindTask", id)
        set_task(WAIT_TIME, "UnBlindUser", id)
        return PLUGIN_CONTINUE
}

//
// Blinds the user
//
public BlindTask(id)
{
        if (is_blind[id - 1])
        {
                message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
                write_short(1<<0)
                write_short(1<<0)
                write_short(1<<2)
                write_byte(0)
                write_byte(0)
                write_byte(0)
                write_byte(255)
                message_end()
        }
}

public UnBlindUser(id)
{
        if (is_blind[id - 1])
        {
                new pName[32]
               
                message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id);        // use the magic #1 for "one client" 
                write_short( 1<<12 );        // fade lasts this long duration 
                write_short( 1<<8 );        // fade lasts this long hold time 
                write_short( 1<<1 );        // fade type
                write_byte( 0 );        // fade red 
                write_byte( 0 );        // fade green 
                write_byte( 0 );        // fade blue
                write_byte( 128 );        // fade alpha 
                message_end( );
               
                is_blind[id - 1] = false
               
                get_user_name(id, pName, 31)
                client_print(0, print_chat, "[Zamke] %s vise nije slep.", pName)
               
                //set_user_rendering(id,kRenderFxNone,255,255,255, kRenderNormal,16);
        }
}

public UnSlowUser(id)
{
        new pName[32]
       
        set_user_maxspeed(id - TASK_SLOW, 250.0)
       
        is_slow[(id - TASK_SLOW) - 1] = false
        user_speed[(id - TASK_SLOW) - 1] = 250.0
        set_user_rendering(id - TASK_SLOW,kRenderFxNone,255,255,255, kRenderNormal,16);
       
        get_user_name(id - TASK_SLOW, pName, 31)
        client_print(0, print_chat, "[Zmurka] %s brzina vracena u normalu.", pName)
       
        if (task_exists(id))
                remove_task(id)
}

public UnDrugUser(id)
{
        new pName[32]
       
        set_user_maxspeed(id - TASK_DRUG, 250.0)
       
        is_drugged[(id - TASK_DRUG) - 1] = false
        set_user_rendering(id - TASK_DRUG,kRenderFxNone,255,255,255, kRenderNormal,16);
       
        message_begin(MSG_ONE, get_user_msgid("SetFOV"), {0,0,0}, id - TASK_DRUG)
        write_byte(90)
        message_end()
       
        get_user_name(id - TASK_DRUG, pName, 31)
        client_print(0, print_chat, "[Zamke] %s nije vise drogiran.", pName)
       
        if (task_exists(id))
                remove_task(id)
}

public UnBuryUser(id, id2)
{
        new pOrigin[3], pName[32]
       
        get_user_origin(id - TASK_BURY, pOrigin, 0)
        pOrigin[2] += buryOrigins[(id - TASK_BURY) - 1]
       
        set_user_origin(id - TASK_BURY, pOrigin)
        buryOrigins[(id - TASK_BURY) - 1] = 0
       
        is_bury[(id - TASK_BURY) - 1] = false
        set_user_rendering(id - TASK_BURY,kRenderFxNone,255,255,255, kRenderNormal,16);
       
        get_user_name(id - TASK_BURY, pName, 31)
        client_print(0, print_chat, "[Zamke] %s nije vise zakopan.", pName)
       
        if (task_exists(id))
                remove_task(id)
}
//
// This event is called on a ScreenFade
//
public Event_ScreenFade(id)
{
        set_task(0.6, "BlindTask", id)
        return PLUGIN_CONTINUE
}

//
// Hiccups the user
//
public HiccupUser(id, id2)
{
        new aName[32], pName[32]
        new r = random(5) + 1
       
        set_task(float(r), "PlayHic", TASK_PLAYHIC + id)
        set_task(WAIT_TIME * 1.5, "UnHiccupUser", TASK_HICCUP + id)
       
        get_user_name(id, pName, 31)
        get_user_name(pTrapOwner[id2], aName, 31)
       
        client_print(id, print_chat, "[Zamke] Stucanje!!! Sada stucas.")
        client_print(0, print_chat, "[Zamke] %s je upao u %s zamku stucanja.", pName, aName)
       
        return 1
}

public PlayHic(id)
{
        new mid = id - TASK_PLAYHIC
       
        new Float:velocity[3]
       
        //set player Z velocity to make player bounce
        entity_get_vector(mid, EV_VEC_velocity, velocity)
        velocity[2] = 250.0                                        //jump velocity
        entity_set_vector(mid, EV_VEC_velocity, velocity)
       
        entity_set_int(mid, EV_INT_gaitsequence, 6)                //play the Jump Animation
       
        new h = random(3)
       
        emit_sound(mid, CHAN_WEAPON, soundHiccups[h], 1.0, ATTN_NORM, 0, PITCH_NORM)
       
        new r = random(5) + 1
        set_task(float(r), "PlayHic", id)
       
        return 1
}

public UnHiccupUser(id)
{
        new pName[32]
       
        is_hiccup[(id - TASK_HICCUP) - 1] = false
       
        get_user_name(id - TASK_HICCUP, pName, 31)
        client_print(0, print_chat, "[Zamke] %s vise ne stuca.", pName)
       
        if (task_exists(id))
                remove_task(id)
       
        if(task_exists(id + 100))
                remove_task(id + 100)
}

public cmdMath(id) {
        new count = random_num(3, 6)
        new values[10]
        new operations[10]
       
        for(new i = 0; i < count; i++) {
               
                if(i < count - 1)
                        operations[i] = random_num(0, 3)
               
                do {
                        values[i] = random_num(1, 20)
                } while ((i > 0) && (values[i] == 0) && (operations[i - 1] == OP_DIVIDE))
               
        }
       
        new solved = values[random_num(0, count - 1)]
       
        new str[256]
        new fl[16]
       
        for(new i = 0; i < count - 1; i++) {
                add(str, sizeof(str), "(")
        }
        for(new i = 0; i < count; i++) {
                if(values[i] == solved) {
                        add(str, sizeof(str), "x");
                        } else {
                        num_to_str(values[i], fl, sizeof(fl))
                        add(str, sizeof(str), fl)
                }
                if(i > 0) {
                        add(str, sizeof(str), ")")
                }
               
                if(i < count - 1) {
                        add(str, sizeof(str), operators[operations[i]])
                }
               
        }
       
        new Float:fValue = float(values[0])
        for(new i = 1; i < count; i++) {
                switch(operations[i - 1]) {
                        case OP_ADD: fValue = floatadd(fValue, float(values[i]))
                                case OP_SUBTRACT: fValue = floatsub(fValue, float(values[i]))
                                case OP_MULTIPLY: fValue = floatmul(fValue, float(values[i]))
                                case OP_DIVIDE: fValue = floatdiv(fValue, float(values[i]))
                        }
               
        }
       
        if (solved == mathLastGuess[id - 1])
        {
                cmdMath(id)
                return PLUGIN_HANDLED
        }
        if (solved == mathLastGuess2[id - 1])
        {
                cmdMath(id)
                return PLUGIN_HANDLED
        }
       
        format(mathEquations[id - 1], 127, "Problem: %s = %f", str, fValue)
       
        mathAnswer[id - 1] = solved
       
        set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 1.0, 0.3, 0.5, 3)
        show_hudmessage(id, mathEquations[id - 1])
       
        set_task(1.0, "MathTask", TASK_MATH + id, "", 0, "b")
       
        return PLUGIN_HANDLED
}

public MathTask(id)
{
        new mid = id - TASK_MATH
       
        if (is_math[mid - 1])
        {
                set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 1.1, 0.3, 0.5, 3)
                show_hudmessage(mid, mathEquations[mid - 1])
        }
       
       
}
/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\//\\  MENU SETUPS    \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

//
// Sets up the Buy Menu (for picking which Trap to buy)
//

public SetupBuyMenu()
{
        new menuLen = format(BuyMenuBodyText, 255, "\rBuy Traps^n")
        menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w1. Zakopavanje \w[\r8000$\w]^n") //get_cvar_num("traps_price_bury"))
        menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w2. Samaranje \w[\r5000$\w]^n") //get_cvar_num("traps_price_slap"))
        menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w3. Slepilo \w[\r6000$\w]^n") //get_cvar_num("traps_price_blind"))
        menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w4. Usporavanje \w[\r7000$\w]^n") //get_cvar_num("traps_price_slow"))
        menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w5. Droga \w[\r4000$\w]^n") //get_cvar_num("traps_price_drug"))
        menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w6. Stucanje \w[\r4000$\w]^n^n9. Back^n0. Exit") //get_cvar_num("traps_price_hiccup"))
       
        return 1
}

//
// Sets up the main menu
//

public SetupMainMenu()
{
        new menuLen = format(MainMenuBodyText, 255, "\rTraps!^n")
        menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w1. Kupi zamku^n")
        menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w2. Odaberi zamku^n")
        menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w4. Postavi zamku^n")
        menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w6. \w[\rCT\w] Detektor zamki \w(\r7000$\w)^n")// get_cvar_num("traps_price_goggle"))
        menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w7. \w[\rCT\w] Imunitet \w(\r12000$\w)^n^n")// get_cvar_num("traps_price_immunity"))
       
        menuLen += format(MainMenuBodyText[menuLen], 255 - menuLen, "\w0. Exit")
       
        return 1
}

//
// Sets up the Pick Menu (for picking which Trap to plant)
//
public SetupPickMenu(id)
{
        new menuLen = format(PickMenuBodyText, 255, "\rPick the trap to plant^n")
        menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w1. Zakopavanje \w[\r%d\w]^n", pTrapTypes[id - 1][T_BURY])
        menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w2. Samaranje \w[\r%d\w]^n", pTrapTypes[id - 1][T_SLAP])
        menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w3. Slepilo \w[\r%d\w]^n", pTrapTypes[id - 1][T_BLIND])
        menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w4. Usporavanje \w[\r%d\w]^n", pTrapTypes[id - 1][T_SLOW])
        menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w5. Droga \w[\r%d\w]^n", pTrapTypes[id - 1][T_DRUG])
        menuLen += format(PickMenuBodyText[menuLen], 255 - menuLen, "\w6. Stucanje \w[\r%d\w]^n^n9. Back^n0. Exit", pTrapTypes[id - 1][T_HICCUP])
       
        return 1
}


/*\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\//\\  HELP    \\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\*/

public ClCmdSay(id)
{
        new Message[128], pName[32]
       
        read_argv(1, Message, 127)
        remove_quotes(Message)
       
        new myAns[128], pOrigin[3]
        num_to_str(mathAnswer[id - 1], myAns, 127)
       
        if (is_math[id - 1] && is_str_num(Message))
        {
                if (!equali(Message, mathLastGuess[id - 1]))
                {
                        if (!equali(Message, mathLastGuess2[id - 1]))
                        {
                                mathLastGuess2[id - 1] = mathLastGuess[id - 1]
                                mathLastGuess[id - 1] = str_to_num(Message)
                        }
                }
               
               
               
                if (equali(Message, myAns))
                {
                        client_print(id, print_chat, "[Zmurka] Tacan odgovor!!!")
                       
                        user_speed[id - 1] = 250.0
                        set_user_maxspeed(id, 250.0)
                        get_user_origin(id, pOrigin, 0)
                        pOrigin[2] += 30;
                        set_user_origin(id, pOrigin)
                        is_math[id - 1] = false
                       
                        if (task_exists(id + TASK_MATH))
                                remove_task(id + TASK_MATH)
                       
                        get_user_name(id, pName, 31)
                       
                        client_print(0, print_chat, "[Zmurka] %s je resio jednacinu i nije vise ukopan.", pName)
                        //set_user_rendering(id,kRenderFxNone,255,255,255, kRenderNormal,16);
                        mathLastGuess[id - 1] = -1
                }
                else
                {
                        new Health = get_user_health(id)
                        new hp
                       
                        if (Health <= 10)
                        {
                                if (Health == 1)
                                {
                                        user_kill(id)
                                        client_print(id, print_chat, "[Zmurka] Greska, ubijen si. ")
                                        return PLUGIN_HANDLED
                                        } else {
                                        hp = 1
                                }
                                } else {
                                hp = Health - 5
                        }
                       
                        set_user_health(id, hp)
                       
                        client_print(id, print_chat, "[Zmurka] Greska! Izgubio si %d helta.", Health - hp)
                        cmdMath(id)
                }
               
                return PLUGIN_HANDLED
        }
       
        if ((containi(Message, "trap") != -1) && (containi(Message, "how") != -1))
        {
                client_print(id, print_chat, "[Zamke] Da koristis zamke, kucaj /zamke")
        }
       
        return PLUGIN_CONTINUE
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang9242\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1250\\ deff0\\ deflang9242{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/



All times are GMT -4. The time now is 17:46.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.