AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help fixing hns "bug" (https://forums.alliedmods.net/showthread.php?t=64489)

CharlieE Candymountain 12-17-2007 04:26

Need help fixing hns "bug"
 
Ok, i need help fixing the bug that allows t's to reconnect and they will get a knife and no flash / smoke. I want it to be no knife, + Getting 2 flash and a smoke. Anyone who thinks he can manage to do it?

Code:

/*
 *  Comments:
 *      Hide N Seek has a Tournament and Public mode.
 *
 *            --Public Mode--
 *            When activated, it begins rounds of Hide N Seek, when round begins, CTs will be blinded
 *            and a counter will appear, counting down.  When timer is up, CTs (Seekers) , must find and kill hiders,
 *            they will have 3.5 minutes to kill Terrorists (Hiders).  CT's begin with a knife and nightvision.
 *            Terrorists begin with 2 flashbangs, 1 smoke, and Armor. 2 Types of Public mode available.
 *            pub_type 1 - 3 rounds per side, then it swaps teams.
 *            pub_type 2 - Teams swap sides when CT's (Seekers) win.
 *
 *            -Tournament mode--
 *            It requires teams to be named by Captain or Clan Tag.  Then match can begin with
 *            amx_begin.  First round is a Knife Only Round, winner will be Hiders first.  After that, results in a
 *            best of 6 rounds.  If teams tie, it will continue into overtime, until one team wins. 
 *            Then match will end, and server will go back to normal. 
 *   
 *    Commands:
 *        amx_pub        - Begins public version of Hide_N_Seek, playing default pub_type 2.       
 *        amx_team    - amx_team <1|2> <"Team Name"> - Defines team 1 and team 2, with a team name, or captain.
 *        amx_begin    - Begins Tournament version of Hide_N_Seek, requires team 1 and team 2 to be named.
 *
 *    CVARs:
 *        hide_n_seek            - Defines which type of mode is being played (Do not change, use commands.)
 *        pub_type            - 1 = 3 rounds per side.  2 = Teams swap sides when CTs (Seekers) win.
 *        hide_n_seek_timer  - Time Terrorists (Hiders) have to hide, must be less than 15.
 *
 *  Version :    1.0
 *    Requires:    AMXX 1.01 or 1.5
 *
 *    Author:        OneEyed
 *    Date:        08-21-2005
 *    Email:        [email protected]
 *    IRC:        #zT (gamesurge.net)
 *
 *    Tested :
 *    Hide N Seek plugin was tested on a win32/linux machine.
 * 
 */
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <fun>
#include <cstrike>

#define MESSAGE_DELAY 4
#define ARMORTYPE_OFFSET 112
#define TEAM_ONE 1
#define TEAM_TWO 2

new weap[34][] = {
  "usp", "glock", "deagle", "p228", "elites", "fn57", "m3", "xm1014", "mp5", "tmp", "p90", "mac10", "ump45",
  "ak47", "galil", "famas", "sg552", "m4a1", "aug", "scout", "awp", "g3sg1", "sg550", "m249", "vest", "vesthelm",
  "flash", "hegren", "sgren", "defuser", "nvgs", "shield", "primammo", "secammo"
}
new weap2[34][] = {
      "km45", "9x19mm", "nighthawk", "228compact", "elites", "fiveseven", "12gauge", "autoshotgun", "smg", "mp",
      "c90", "mac10", "ump45", "cv47", "defender", "clarion", "krieg552", "m4a1", "bullpup", "scout", "magnum",
      "d3au1", "krieg550", "m249", "vest", "vesthelm", "flash", "hegren", "sgren", "defuser", "nvgs", "shield",
      "primammo", "secammo"
}

new one[] = "Objective: Hide and avoid CT / (Seekers) until round ends."
new two[] = "Objective: Find and kill Terrorists / (Hiders) before round ends."

new countername[16][] = {"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen"}

new round = -1, maxplayers, timer, needed = 6, overtime
new Float:msgdelay[33], g_message[256]
new team1n[33], team2n[33]
new gmsgScreenFade, fakeEnt, scoreB, score[3], randed[64]

//------------------------------------------------------------------------------------------------------------
public plugin_init() {
    register_plugin("Hide n Seek", "1.0", "OneEyed")
   
    if(!cvar_exists("hide_n_seek"))
        register_cvar("hide_n_seek","0")
    if(!cvar_exists("pub_type"))
        register_cvar("pub_type","2")
    if(!cvar_exists("hide_n_seek_timer"))
        register_cvar("hide_n_seek_timer","10")   
       
    register_concmd("amx_begin", "startSeek",    ADMIN_SLAY,    "Starts Hide n Seek for Tournament")
    register_concmd("amx_pub",    "startPubSeek", ADMIN_SLAY,    "Starts Hide n Seek for Pub")
    register_concmd("amx_team",  "setTeamName",    ADMIN_SLAY,    "<team # 1|2> <^"name^"> - Sets specific team name.")
   
    register_logevent("StartRound",2,"0=World triggered", "1=Round_Start")
    register_logevent("EndRound"  ,2,"0=World triggered", "1=Round_Draw", "1=Round_End")
   
    register_event("CurWeapon", "Switched", "be")
    register_event( "ResetHUD", "resetHud", "be" )
   
    round = 1
    timer = get_cvar_num("hide_n_seek_timer")
    overtime = 3
    gmsgScreenFade = get_user_msgid("ScreenFade")
    maxplayers = get_maxplayers()
   
    //FakeEnt Thinking, (handles better with engine)
    fakeEnt = create_entity("info_target")
    entity_set_string(fakeEnt,EV_SZ_classname,"serverFrame")
    register_think("serverFrame","server_fakeFrame")
   
    //Scoreboard thinking
    scoreB = create_entity("info_target")
    entity_set_string(scoreB,EV_SZ_classname,"scoreBoard")
    register_think("scoreBoard","displayScoreBoard")
}
//------------------------------------------------------------------------------------------------------------
public plugin_modules(){
    require_module("engine")
    require_module("fakemeta")
    require_module("fun")
    require_module("cstrike")
}
//------------------------------------------------------------------------------------------------------------
//Extreme hack to make sure no one has weapons they arent suppose to!
public Switched(id) {
    if(get_cvar_num("hide_n_seek") > 0) {
        new weapon, clip, ammo
        weapon = get_user_weapon(id,clip,ammo)
        if(weapon != CSW_KNIFE && weapon != CSW_FLASHBANG && weapon != CSW_SMOKEGRENADE)
        {
            if(get_cvar_num("hide_n_seek") == 1) {
                if(round == 0) { // Knife Round Stuff
                    if(is_user_alive(id))
                        set_task(1.0,"stripAndGiveKnife",id,"",_,"a",0)
                }
                if(round == 1) {    // Begin Round 1 stuff
                    if(get_user_team(id) == 1)
                        set_task(1.0,"HiderItems",id,"",_,"a",0)
                    if(get_user_team(id) == 2)
                        set_task(1.0,"SeekerItems",id,"",_,"a",0)
                }
            }
            if(get_cvar_num("hide_n_seek") == 2) {
                if(round >= 1) {    // Begin Round 1 stuff
                    if(get_user_team(id) == 1)
                        set_task(1.0,"HiderItems",id,"",_,"a",0)
                    if(get_user_team(id) == 2)
                        set_task(1.0,"SeekerItems",id,"",_,"a",0)
                }
            }
            return PLUGIN_HANDLED   
        }
    }
    return PLUGIN_CONTINUE
}
//------------------------------------------------------------------------------------------------------------
public resetHud(id) {
    if(is_user_alive(id) && get_cvar_num("hide_n_seek") > 0) {
        cs_set_user_money(id, 0)
        new args[1]
        args[0] = id
        set_task(5.0,"modelCheck",1234,args,1,"a",0)
    }
}
//------------------------------------------------------------------------------------------------------------
public modelCheck(args[]) {
    new id = args[0]
    if(!is_user_alive(id)) return PLUGIN_HANDLED
    new mod[32]
    cs_get_user_model(id,mod,31)
    if(get_user_team(id) == 1) {
        if(equali("urban",mod) || equali("gsg9",mod) || equali("sas",mod) || equali("gign",mod)) {
            switch(random_num(0,3)) {
                case 0: cs_set_user_model(id, "terror")
                case 1: cs_set_user_model(id, "leet")
                case 2: cs_set_user_model(id, "arctic")
                case 3: cs_set_user_model(id, "guerilla")
            }
        }
    }
    else if(get_user_team(id) == 2) {
        if(equali("terror",mod) || equali("leet",mod) || equali("arctic",mod) || equali("guerilla",mod)) {
            switch(random_num(0,3)) {
                case 0: cs_set_user_model(id, "urban")
                case 1: cs_set_user_model(id, "gsg9")
                case 2: cs_set_user_model(id, "sas")
                case 3: cs_set_user_model(id, "gign")
            }
        }
    }
    return PLUGIN_HANDLED   
}
//------------------------------------------------------------------------------------------------------------   
public setTeamName(id,level,cid) {
    if (!cmd_access(id,level,cid,2))
        return PLUGIN_HANDLED
    new teamnum[2], teamnumm
    read_argv(1,teamnum,1)
    if(!isdigit(teamnum[0])) {
        client_print(id,print_chat,"[HideNSeek] Team # is not valid.")
        return PLUGIN_HANDLED
    }
    teamnumm = str_to_num(teamnum)
    switch(teamnumm) {
        case 1:    {
            read_argv(2,team1n,32)
            client_print(0,print_chat,"Team 1 is named %s",team2n)
        }
        case 2:    {
            read_argv(2,team2n,32)
            client_print(0,print_chat,"Team 2 is named %s",team1n)   
        }
    }
    return PLUGIN_HANDLED
}
//------------------------------------------------------------------------------------------------------------
public startPubSeek(id,level,cid) {
    if (!cmd_access(id,level,cid,0))
        return PLUGIN_HANDLED
    server_cmd("sv_restart 1")
    server_cmd("sv_gravity 800")
    server_cmd("mp_freezetime 0")
    server_cmd("mp_roundtime 2.75")
    set_cvar_num("hide_n_seek",2)
    round = 1
    timer = get_cvar_num("hide_n_seek_timer")
    overtime = 3
    return PLUGIN_HANDLED
}
//------------------------------------------------------------------------------------------------------------
public startSeek(id,level,cid) {
    if (!cmd_access(id,level,cid,0))
        return PLUGIN_HANDLED
    if (!team1n[0] || !team2n[0]) {
        client_print(id,print_chat,"[HideNSeek] Cannot start until both teams are named. ^n[HideNSeek] amx_team <#> <^"clan tag^"> - To specify team name")
        return PLUGIN_HANDLED
    }
    server_cmd("sv_restart 1")
    server_cmd("sv_gravity 370")
    server_cmd("mp_freezetime 0")
    server_cmd("mp_roundtime 3.5")
    set_cvar_num("hide_n_seek",1)
    round = 0
    timer = get_cvar_num("hide_n_seek_timer")
    overtime = 0
    needed = 6
    score[1] = 0
    score[2] = 0
    return PLUGIN_HANDLED
}
//------------------------------------------------------------------------------------------------------------
public server_fakeFrame(entid){
    if(get_cvar_num("hide_n_seek") >= 1 && round >= 1) {
        if(timer > 0) {
            set_hudmessage(255, 0, 0, -1.0, 0.60, 0, 1.0, 1.0, 0.2, 0.1, 4)
            show_hudmessage(0,"[Hiders] have %i seconds to hide...",timer)
            client_cmd(0,"spk vox/%s.wav",countername[timer])
            for(new b=1;b<=maxplayers;b++)
                if(get_user_team(b) == 2 && is_user_alive(b)) {
                    doFlash(b, 15)
                    entity_set_float(b,EV_FL_maxspeed,-200.0)
                }
        }
        if(timer == 0) {
            for(new b=1;b<=maxplayers;b++) {
                if(get_user_team(b) == 2 && is_user_alive(b)) {
                    doFlash(b, 0)
                    entity_set_float(b,EV_FL_maxspeed,250.0)
                }
            }
            set_hudmessage(255, 0, 0, -1.0, 0.60, 0, 1.0, 6.0, 0.2, 0.1, 4)
            show_hudmessage(0,"TIME IS UP, READY OR NOT, DEATH WE COME!",timer)
            return PLUGIN_HANDLED
        }
        if(timer < 0) {
            for(new b=1;b<=maxplayers;b++)
                if(get_user_team(b) == 2 && is_user_alive(b)) {
                    doFlash(b, 0)
                    entity_set_float(b,EV_FL_maxspeed,250.0)
                }
            return PLUGIN_HANDLED
        }
        timer--
        entity_set_float(entid,EV_FL_nextthink,halflife_time() + 1.0)
    }
    return PLUGIN_HANDLED
}
//------------------------------------------------------------------------------------------------------------
public displayScoreBoard(entid) {
    if(get_cvar_num("hide_n_seek") == 1 && round == 0) {
        new board[256]
        format(board,255,"Team %s    vs.    Team %s ",team1n,team2n)
        set_hudmessage(0, 255, 0, -1.0, 0.0, 0, 0.25, 1.0, 0.1, 0.1, 3)
        show_hudmessage(0,"^n%s",board)   
    }
    if(get_cvar_num("hide_n_seek") == 1 && round == 1) {
        new board[256]
        format(board,255,"%s score: %i  |  %s score: %i",team1n,score[1],team2n,score[2])
        for(new x=1;x<=maxplayers;x++)
            if(is_user_connected(x))
                if(get_user_team(x) == 1 && is_user_connected(x)) {
                    set_hudmessage(0, 255, 0, -1.0, 0.0, 0, 0.25, 1.0, 0.1, 0.1, 3)
                    show_hudmessage(x,"%s^n%s^nBest of %i wins",one,board,needed)
                }
                else if(get_user_team(x) == 2 && is_user_connected(x)) {
                    set_hudmessage(0, 255, 0, -1.0, 0.0, 0, 0.25, 1.0, 0.1, 0.1, 3)
                    show_hudmessage(x,"%s^n%s^nBest of %i wins",two,board,needed)
                }
                else {
                    set_hudmessage(0, 255, 0, -1.0, 0.0, 0, 0.25, 1.0, 0.1, 0.1, 3)
                    show_hudmessage(x,"^n%s^nBest of %i wins",board,needed)
                }
    }
    if(get_cvar_num("hide_n_seek") == 2 && round >= 1) {
        for(new x=1;x<=maxplayers;x++)
            if(is_user_connected(x))
                if(get_user_team(x) == 1 && is_user_connected(x)) {
                    set_hudmessage(0, 255, 0, -1.0, 0.0, 0, 0.25, 1.0, 0.1, 0.1, 3)
                    show_hudmessage(x,"%s",one)
                }
                else if(get_user_team(x) == 2 && is_user_connected(x)) {
                    set_hudmessage(0, 255, 0, -1.0, 0.0, 0, 0.25, 1.0, 0.1, 0.1, 3)
                    show_hudmessage(x,"%s",two)
                }
    }
    entity_set_float(entid,EV_FL_nextthink,halflife_time() + 0.25)
    return PLUGIN_HANDLED
}
//------------------------------------------------------------------------------------------------------------
public EndRound() {
    //Check to make sure theres a person in both teams
    new t, c
    for(new x=1;x<=maxplayers;x++) {
        if(!is_user_connected(x)) continue
        if(get_user_team(x) == 1)
            t = 1
        if(get_user_team(x) == 2)
            c = 1
    }
    if(c == 1 && t == 1) {
        if(get_cvar_num("hide_n_seek") == 1) {
            timer = -1
            new choose_win
            format(g_message,255,"")
            if(round == 0) {
                format(randed,63,"")
                choose_win = getRoundWinner()//(teamn)
               
                //Do this down here, (Because of randoming)
                switch(choose_win) {
                    case 1: format(g_message,255,"%s^n%s won, they will become [Hiders] first.",randed,team1n)
                    case 2: format(g_message,255,"%s^n%s won, they will become [Hiders] first.",randed,team2n)
                }
               
                new bool:check = check_team(choose_win)
                if(!check) swap()
                round = 1
            }
            else if(round == 1) {
                choose_win = getRoundWinner()//(teamn)
                switch(choose_win) {
                    case 1:    score[TEAM_ONE]++
                    case 2: score[TEAM_TWO]++
                }
                new total = score[1] + score[2]
                if(total == 3) {
                    format(g_message,255,"3 rounds over, switching teams.")
                    swap()
                }
                if(total > 3) {
                    new winner
                    new Float:teamonepct = float(score[1]) / float(needed)
                    new Float:teamtwopct = float(score[2]) / float(needed)
               
                    //Total of Scores reached needed amount, check for win/tie
                    if ( total >= needed || teamonepct > 0.5 || teamtwopct > 0.5 )
                        winner = ( score[1] > score[2] ) ? 1 : 2
                    if(total == needed && score[1] == score[2]) {
                        winner = 3
                        overtime++
                        if(needed == 6)
                            needed += 4
                        else if(needed >= 10)
                            needed += 2
                    }
                    new roundsneeded = (overtime == 1) ? 2 : 1
                    if(winner != 0) {
                        switch(winner) {
                            case 1: format(g_message,255,"Team %s WINS, CONGRATULATIONS",team1n)
                            case 2: format(g_message,255,"Team %s WINS, CONGRATULATIONS",team2n)
                            case 3: format(g_message,255,"We have a TIE, moving into OVERTIME %i.^nGoing %i more rounds per side.",overtime,roundsneeded)
                        }
                    }
                    if(total == (needed-roundsneeded) && needed > 6) {
                        format(g_message,255,"%i rounds of overtime completed.^n%i more needed, Switching Teams....",roundsneeded,roundsneeded)
                        swap()
                    }
                    if(winner == 1 || winner == 2)
                        set_cvar_num("hide_n_seek",0)
                }
            }
            set_task(0.5,"displayHud",12345,"",_,"a",6)
        }
        if(get_cvar_num("hide_n_seek") == 2) {
            timer = -1
           
            format(randed,63,"")
           
            new terr
            for(new x=1;x<=maxplayers;x++) {
                if(is_user_alive(x) && get_user_team(x) == 1)
                    terr = 1
            }
           
            if(terr)
                format(randed,32,"Terrorists Win")
            else {
                if(get_cvar_num("pub_type") == 2) {
                    swap()
                    format(randed,32,"CTs Win^nSwitching Teams...")
                }
                else
                    format(randed,32,"CTs Win")
            }
   
               
            if(round == overtime && get_cvar_num("pub_type") == 1) {
                overtime += 3
                format(g_message,255,"%s^nRound %i Completed^n3 rounds completed, switching teams.",randed,round)
                swap()
            }
            else
                format(g_message,255,"%s^nROUND %i Completed",randed,round)
               
            round++
            //client_print(0,print_chat,"%s
            set_task(0.5,"displayHud",12345,"",_,"a",6)
        }
    }
}
//------------------------------------------------------------------------------------------------------------
public displayHud() {
    set_hudmessage(255, 0, 0, -1.0, 0.50, 0, 1.0, 5.0, 0.1, 0.1, 4)
    show_hudmessage(0,"%s",g_message)
}
//------------------------------------------------------------------------------------------------------------
public bool:check_team(c_win) {
    new tt[33]
    switch(c_win) {
        case 1: copy(tt,32,team1n)
        case 2: copy(tt,32,team2n)
    }
    for(new i = 1; i <= maxplayers; i++) {
        if(is_user_connected(i) && get_user_team(i) == 1) {
            new pn[32]
            get_user_name(i,pn,31)
            if(containi(pn,tt) > -1) {
                return true
            }
        }
    }
    return false
}
//------------------------------------------------------------------------------------------------------------
public getRoundWinner() {
    //Some serious wierd bugs trying to find winner of round
    //So used this hax0r version
    new terr
    for(new x=1;x<=maxplayers;x++)
        if(is_user_alive(x) && get_user_team(x) == 1)
            terr = 1

    if(terr) {
        client_print(0,print_chat,"Terrorists win")
        for(new i = 1; i <= maxplayers; i++)
            if(is_user_connected(i) && get_user_team(i) == 1) {
                new pn[32]
                get_user_name(i,pn,31)
                if(containi(pn,team1n) > -1)
                    return 1
                else if(containi(pn,team2n) > -1)
                    return 2
            }
    }
    else {
        client_print(0,print_chat,"CT win")
        for(new i = 1; i <= maxplayers; i++)
            if(is_user_connected(i) && get_user_team(i) == 2) {
                new pn[32]
                get_user_name(i,pn,31)
                if(containi(pn,team1n) > -1)
                    return 1
                else if(containi(pn,team2n) > -1)
                    return 2
            }
    }
    return 0
}
//------------------------------------------------------------------------------------------------------------
public StartRound() {
    new t, c
    for(new x=1;x<=maxplayers;x++) {
        if(!is_user_connected(x)) continue
        if(get_user_team(x) == 1) t = 1
        if(get_user_team(x) == 2) c = 1
    }
    //Give team weapons on start round, and begin rounds
    if(c == 1 && t == 1) {
        if(get_cvar_num("hide_n_seek") == 1) {
            if(round == 0) { // Knife Round Stuff
                    format(g_message,255,"Knife Round^nWinning Team will become [Hiders] first.")
                    for(new a=1;a<=maxplayers;a++) {
                        if(is_user_alive(a))
                            set_task(1.5,"stripAndGiveKnife",a)
                    }
                    set_hudmessage(255, 0, 0, -1.0, 0.5, 0, 1.0, 7.0, 0.1, 0.1, 4)
                    show_hudmessage(0,"%s",g_message)
                    entity_set_float(scoreB,EV_FL_nextthink,halflife_time() + 0.01)
            }
            if(round == 1) {    // Begin Round 1 stuff
                timer = get_cvar_num("hide_n_seek_timer")
                entity_set_float(fakeEnt,EV_FL_nextthink,halflife_time() + 0.01)
                for(new a=1;a<=maxplayers;a++) {
                    if(get_user_team(a) == 1 && is_user_alive(a))
                        set_task(1.5,"HiderItems",a)
                    if(get_user_team(a) == 2 && is_user_alive(a))
                        set_task(1.5,"SeekerItems",a)
                }
            }
        }
        if(get_cvar_num("hide_n_seek") == 2) {
            if(round >= 1) {    // Begin Round 1 stuff
                timer = get_cvar_num("hide_n_seek_timer")
                entity_set_float(fakeEnt,EV_FL_nextthink,halflife_time() + 0.01)
                for(new a=1;a<=maxplayers;a++) {
                    if(get_user_team(a) == 1 && is_user_alive(a))
                        set_task(1.5,"HiderItems",a)
                    if(get_user_team(a) == 2 && is_user_alive(a))
                        set_task(1.5,"SeekerItems",a)
                }
            }
        }
    }
}
//------------------------------------------------------------------------------------------------------------
//Make sure people don't cheat
public client_command(id) {
    if(!get_cvar_num("hide_n_seek")) return PLUGIN_CONTINUE
    new arg[13]
    read_argv( 0, arg , 12 )
    for(new a=1;a<34;a++)
        if ( equal( weap[ a ] , arg  ) ||  equal( weap2[ a ] , arg  ) || equal("buy",arg) || equal("autobuy",arg)) {
            if ((get_gametime() - msgdelay[id]) > MESSAGE_DELAY) {
                client_print(id,print_chat,"You cannot buy, when -Hide N Seek- is activated.^n")
                msgdelay[id] = get_gametime()
            }
            return PLUGIN_HANDLED
        }
    if( equal("chooseteam",arg) && get_cvar_num("hide_n_seek") == 1 && (get_user_team(id) == 1 || get_user_team(id) == 2) ) {
        if ((get_gametime() - msgdelay[id]) > MESSAGE_DELAY) {
            client_print(id,print_chat,"You cannot change teams, when -Hide N Seek- is activated.^n")
            msgdelay[id] = get_gametime()
        }
        return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}
//------------------------------------------------------------------------------------------------------------
//Make sure people don't kill themselves
public client_kill(id) {
    if(get_cvar_num("hide_n_seek") > 0) {
        if ((get_gametime() - msgdelay[id]) > MESSAGE_DELAY) {
            client_print(id,print_chat,"You cannot kill yourself, when -Hide N Seek- is activated.^n")
            msgdelay[id] = get_gametime()
        }
        return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}
//------------------------------------------------------------------------------------------------------------
public stripAndGiveKnife(id) {
    strip_user_weapons(id)
    give_item(id, "weapon_knife")
}
//------------------------------------------------------------------------------------------------------------
public SeekerItems(id) {
    strip_user_weapons(id)
    give_item(id, "weapon_knife")
    cs_set_user_nvg(id)
}
//------------------------------------------------------------------------------------------------------------
public HiderItems(id) {
    strip_user_weapons(id)
    give_item(id, "weapon_flashbang")
    give_item(id, "weapon_flashbang")
    give_item(id, "weapon_smokegrenade")
    csset_user_armor(id, 100.0, 2)
    cs_set_user_nvg(id, 0)
}
//------------------------------------------------------------------------------------------------------------
public csset_user_armor(id, Float:amount, type) {
    entity_set_float(id,EV_FL_armorvalue, amount)
    set_pdata_int(id,ARMORTYPE_OFFSET,type)   
}
//------------------------------------------------------------------------------------------------------------
stock doFlash(id, amt) {
    message_begin(MSG_ONE,gmsgScreenFade,{0,0,0},id)
    write_short( 1<<amt ) // fade lasts this long duration
    write_short( 1<<amt ) // fade lasts this long hold time
    write_short( 1<<12 ) // fade type (in / out)
    write_byte( 0 ) // fade red
    write_byte( 0 ) // fade green
    write_byte( 0 ) // fade blue
    write_byte( 255 ) // fade alpha
    message_end()
}
//------------------------------------------------------------------------------------------------------------
public swap() {
    new team[16]
    for(new i=1;i<=maxplayers;i++)
        if(is_user_connected(i)) {
            get_user_team(i,team,15)
            if(equal(team,"CT")) {
                cs_set_user_team(i, CS_TEAM_T)
                select_model(i,1)
            }
            if(equal(team,"TERRORIST")) {
                cs_set_user_team(i, CS_TEAM_CT)
                select_model(i,2)
            }
        }
    return PLUGIN_CONTINUE
}
//------------------------------------------------------------------------------------------------------------
public select_model(id,team) {
    new rand = random_num(0,3)
    switch(team) {
        case 2: {
            switch(rand) {
              case 0: cs_set_user_model(id, "urban")
              case 1: cs_set_user_model(id, "gsg9")
              case 2: cs_set_user_model(id, "sas")
              case 3: cs_set_user_model(id, "gign")
          }
        }
        case 1: {
            switch(rand) {
                case 0: cs_set_user_model(id, "terror")
                case 1: cs_set_user_model(id, "leet")
                case 2: cs_set_user_model(id, "arctic")
                case 3: cs_set_user_model(id, "guerilla")
            }
        }
    }
    client_cmd(id,"wait; wait; slot10")
    return PLUGIN_CONTINUE
}
//------------------------------------------------------------------------------------------------------------


KiimpaN 12-17-2007 12:57

Re: Need help fixing hns "bug"
 
Tjalle din lilla nub kodare ^^

English: No idea, sorry

Cider0 12-20-2007 08:12

Re: Need help fixing hns "bug"
 
PHP Code:

/* Made by Cider and no one else ^^ */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <fun>
#include <cstrike>

#define PLUGIN "t hns weapons"
#define VERSION "0.1"
#define AUTHOR "Cider"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
}
    public 
plugin_modules(){
    
require_module("engine")
    
require_module("fakemeta")
    
require_module("fun")
    
require_module("cstrike")
}
if(
get_user_team(a) == && is_user_alive(a))
set_task(1.5,"Terrorist",a)

}new 
weap[34][] = {
  
"usp""glock""deagle""p228""elites""fn57""m3""xm1014""mp5""tmp""p90""mac10""ump45",
  
"ak47""galil""famas""sg552""m4a1""aug""scout""awp""g3sg1""sg550""m249""vest""vesthelm",
  
"flash""hegren""sgren""defuser""nvgs""shield""primammo""secammo" 
}
new 
weap2[34][] = {
      
"km45""9x19mm""nighthawk""228compact""elites""fiveseven""12gauge""autoshotgun""smg""mp",
      
"c90""mac10""ump45""cv47""defender""clarion""krieg552""m4a1""bullpup""scout""magnum",
      
"d3au1""krieg550""m249""vest""vesthelm""flash""hegren""sgren""defuser""nvgs""shield",
         
"primammo""secammo"   
}
public 
Terrorist(id) {
  
strip_user_weapons(id)
      
give_item(idweapon_flashbang)
      
give_item(idweapon_flashbang)
      
give_item(idweapon_smokegrenade)
      
csset_user_armor (id100.02)
      
      return 
PLUGIN_CONTINUE 

this might help i will testit soon

Cider0 12-20-2007 08:24

Re: Need help fixing hns "bug"
 
didnt work.....

DaKo 06-29-2008 16:31

Re: Need help fixing hns "bug"
 
1 Attachment(s)
Hi, look here. :wink:


All times are GMT -4. The time now is 11:10.

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