Raised This Month: $51 Target: $400
 12% 

Bad Camper 1.4.239


Post New Thread Reply   
 
Thread Tools Display Modes
Trunks1
Junior Member
Join Date: May 2006
Old 05-17-2010 , 10:51   Re: Bad Camper 1.4.239
Reply With Quote #631

Hey guys, did someone have a Link for the Monster Mod (Snark Attack) ? Can't find it -.-
Trunks1 is offline
Send a message via ICQ to Trunks1
`666
AlliedModders Donor
Join Date: Jan 2006
Old 05-17-2010 , 11:07   Re: Bad Camper 1.4.239
Reply With Quote #632

http://forums.alliedmods.net/showthr...075#post759075
`666 is offline
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 05-18-2010 , 01:45   Re: Bad Camper 1.4.239
Reply With Quote #633

A while ago I've made a request for a camper plugin on the Suggestions/Requests forum that will resemble as much as it can a beacon and sound effect from a source mod camp plugin and you've pointed me to your bad-camper plugin while someone posted some code for that beacon efect. I've forgot about that for some time but not that I've remembered it, I've tacked that piece of code and modded it a bit to look a little more like that source mod beacon effect (double rings and beacon sound) Also I've optimized the code a bit since it was a little buggy when crouching/standing up (for example if you were crouching by holding the "+duck" key the rings were placed at your feet, but if you were in the situation when you are force crouching like when you are in a tunnel/duct or something like that and you didn't need to press "+duck" key to crouch, the rings were rendered below your feet)

So I want to ask you if you can integrate this beacon effect into your plugin ...

Thanks in advance if you consider that.

Here's the code:

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta>
#define MAX_PLAYERS 32
#define UPDATE_INTERVAL 3.0
#define TID_TIMER 9124
// new g_snd_path[] = "buttons/blip1.wav"
// new g_snd_path[] = "buttons/blip2.wav"
new g_snd_path[] = "misc/beacon.wav"
new g_sprite_path[] = "sprites/white.spr"
new bool:g_got_beacon[MAX_PLAYERS+1]
new g_max_players
new Float:g_t_time
new g_timer_entid
new g_sprite

public plugin_init(){
    register_plugin("Beacon", "1.0", "Sylwester")
    g_max_players = get_maxplayers()
    register_clcmd("amx_beacon_set", "cmd_beacon_set", ADMIN_KICK, "<@all|@t|@ct|#userid|name> ")
    register_clcmd("amx_beacon_rem", "cmd_beacon_rem", ADMIN_KICK, "<@all|@t|@ct|#userid|name> ")
    create_timer()
}

public plugin_precache(){
    precache_sound(g_snd_path)
    g_sprite = precache_model(g_sprite_path)
}

public client_connect(id){
    g_got_beacon[id] = false
}

public cmd_beacon_set(id, level, cid){
    static players[MAX_PLAYERS], pnum, arg[32], tmp, i, name[32]
    if (!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED
    read_argv(1, arg, 31)
    pnum = 0
    if(equali(arg, "@all")){
        for(i=1; i<=g_max_players; i++)
            if(is_user_connected(i))
                players[pnum++] = i
    }else if(equali(arg, "@t")){
        for(i=1; i<=g_max_players; i++)
            if(is_user_connected(i) && get_user_team(i)==1)
                players[pnum++] = i
    }else if(equali(arg, "@ct")){
        for(i=1; i<=g_max_players; i++)
            if(is_user_connected(i) && get_user_team(i)==2)
                players[pnum++] = i
    }else if(arg[0] == '#'){
        tmp = str_to_num(arg[1])
        for(i=1; i<=g_max_players; i++)
            if(is_user_connected(i) && get_user_userid(i)==tmp)
                players[pnum++] = i
    }else{
        for(i=1; i<=g_max_players; i++)
            if(is_user_connected(i)){
                get_user_name(i, name, 31)
                if(equal(name, arg)){
                    pnum = 0
                    players[pnum++] = i
                    break
                }else if(contain(name, arg)>-1){
                    players[pnum++] = i
                }
            }
    }
    
    if(pnum<=0){
        client_print(id, print_console, "[Beacon]Error: target not found")
        return PLUGIN_HANDLED
    }
    for(i=0; i<pnum; i++){
        g_got_beacon[players[i]] = true
    }
    return PLUGIN_HANDLED
}

public cmd_beacon_rem(id, level, cid){
    static players[MAX_PLAYERS], pnum, arg[32], tmp, i, name[32]
    if (!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED
    read_argv(1, arg, 31)
    pnum = 0
    if(equali(arg, "@all")){
        for(i=1; i<=g_max_players; i++)
            if(is_user_connected(i))
                players[pnum++] = i
    }else if(equali(arg, "@t")){
        for(i=1; i<=g_max_players; i++)
            if(is_user_connected(i) && get_user_team(i)==1)
                players[pnum++] = i
    }else if(equali(arg, "@ct")){
        for(i=1; i<=g_max_players; i++)
            if(is_user_connected(i) && get_user_team(i)==2)
                players[pnum++] = i
    }else if(arg[0] == '#'){
        tmp = str_to_num(arg[1])
        for(i=1; i<=g_max_players; i++)
            if(is_user_connected(i) && get_user_userid(i)==tmp)
                players[pnum++] = i
    }else{
        for(i=1; i<=g_max_players; i++)
            if(is_user_connected(i)){
                get_user_name(i, name, 31)
                if(equal(name, arg)){
                    pnum = 0
                    players[pnum++] = i
                    break
                }else if(contain(name, arg)>-1){
                    players[pnum++] = i
                }
            }
    }
    
    if(pnum<=0){
        client_print(id, print_console, "[Beacon]Error: target not found")
        return PLUGIN_HANDLED
    }
    for(i=0; i<pnum; i++){
        g_got_beacon[players[i]] = false
    }
    return PLUGIN_HANDLED
}

public create_timer(){
    g_timer_entid = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"))
    if(pev_valid(g_timer_entid)){
        set_pev(g_timer_entid, pev_classname, "beacon_timer")
        global_get(glb_time, g_t_time)
        set_pev(g_timer_entid, pev_nextthink, g_t_time + UPDATE_INTERVAL)
        register_forward(FM_Think,"fwd_Think")
    }else{
        log_amx("Warning: Failed to create timer entity, using task instead")
        set_task(UPDATE_INTERVAL, "timer_cycle", TID_TIMER, "", 0, "b")
    }
}

public fwd_Think(Ent){
    if(Ent != g_timer_entid)
        return FMRES_IGNORED
    g_t_time += UPDATE_INTERVAL
    set_pev(Ent, pev_nextthink, g_t_time)
    timer_cycle()
    return FMRES_IGNORED
}

public plugin_unpause(){
    if(pev_valid(g_timer_entid)){
        global_get(glb_time, g_t_time)
        g_t_time += UPDATE_INTERVAL
        set_pev(g_timer_entid, pev_nextthink, g_t_time)
    }
}

public timer_cycle(){
    static id
    for(id=1; id<=g_max_players; id++)
    if(g_got_beacon[id] && is_user_alive(id)){
        show_beacon(id)
        set_task(0.2, "show_beacon2", id)
    }
}

public show_beacon(id){
    static origin[3]
    // emit_sound(id, CHAN_ITEM, g_snd_path, 1.0, ATTN_NORM, 0, PITCH_NORM)
    get_user_origin(id, origin)
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte(TE_BEAMCYLINDER)
    write_coord(origin[0])                    //position.x
    write_coord(origin[1])                    //position.y
    new flags = entity_get_int(id, EV_INT_flags)
    if (flags & FL_DUCKING) write_coord(origin[2]-8)        //position.z (in duck)
    else write_coord(origin[2]-26)                //position.z
    write_coord(origin[0])                    //axis.x
    write_coord(origin[1])                    //axis.y
    write_coord(origin[2]+200)                    //axis.z
    write_short(g_sprite)                    //sprite index
    write_byte(0)                        //starting frame
    write_byte(1)                        //frame rate in 0.1's
    write_byte(6)                        //life in 0.1's
    write_byte(10)                        //line width in 0.1's
    write_byte(1)                        //noise amplitude in 0.01's
    if(cs_get_user_team(id) == CS_TEAM_T){
        write_byte(255)                        //red
        write_byte(0)                        //green
        write_byte(0)                        //blue
    }
    else if(cs_get_user_team(id) == CS_TEAM_CT){
        write_byte(0)                        //red
        write_byte(0)                        //green
        write_byte(255)                        //blue
    }
    write_byte(200)                        //brightness
    write_byte(6)                        //scroll speed in 0.1's
    message_end()
}

public show_beacon2(id){
    static origin[3]
    emit_sound(id, CHAN_ITEM, g_snd_path, 1.0, ATTN_NORM, 0, PITCH_NORM)
    get_user_origin(id, origin)
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte(TE_BEAMCYLINDER)
    write_coord(origin[0])                    //position.x
    write_coord(origin[1])                    //position.y
    new flags = entity_get_int(id, EV_INT_flags)
    if (flags & FL_DUCKING) write_coord(origin[2]-8)        //position.z (in duck)
    else write_coord(origin[2]-26)                //position.z
    write_coord(origin[0])                    //axis.x
    write_coord(origin[1])                    //axis.y
    write_coord(origin[2]+200)                    //axis.z
    write_short(g_sprite)                    //sprite index
    write_byte(0)                        //starting frame
    write_byte(1)                        //frame rate in 0.1's
    write_byte(6)                        //life in 0.1's
    write_byte(10)                        //line width in 0.1's
    write_byte(1)                        //noise amplitude in 0.01's
    if(cs_get_user_team(id) == CS_TEAM_T){
        write_byte(255)                        //red
        write_byte(0)                        //green
        write_byte(0)                        //blue
    }
    else if(cs_get_user_team(id) == CS_TEAM_CT){
        write_byte(0)                        //red
        write_byte(0)                        //green
        write_byte(255)                        //blue
    }
    write_byte(200)                        //brightness
    write_byte(6)                        //scroll speed in 0.1's
    message_end()
}
Here are some screenies :
And the beacon sound...

Edit:

BTW... I've found the Suggestions/Requests Topic where I've requested the source-ish camper effect: http://forums.alliedmods.net/showthr...ghlight=camper
Attached Thumbnails
Click image for larger version

Name:	beacon_ct.jpg
Views:	303
Size:	60.6 KB
ID:	65842   Click image for larger version

Name:	beacon_te.jpg
Views:	261
Size:	87.1 KB
ID:	65843  
Attached Files
File Type: zip beacon.zip (6.4 KB, 133 views)

Last edited by Costin83; 05-18-2010 at 01:49.
Costin83 is offline
Send a message via Yahoo to Costin83
Oneshox
BANNED
Join Date: May 2010
Location: Germany
Old 05-19-2010 , 11:56   Re: Bad Camper 1.4.239
Reply With Quote #634

Can you make that the camp meter only work for terrorists team ?
Oneshox is offline
western
Junior Member
Join Date: Dec 2004
Old 05-19-2010 , 20:11   Re: Bad Camper 1.4.239
Reply With Quote #635

Bad Camper 1.4.239
Immunity does not work, changed all flags from "a" to "j"
__________________


Last edited by western; 05-19-2010 at 20:14.
western is offline
Jewz
BANNED
Join Date: May 2010
Old 05-20-2010 , 02:29   Re: Bad Camper 1.4.239
Reply With Quote #636

Nice
Jewz is offline
s3rserii
Senior Member
Join Date: Jan 2010
Old 05-28-2010 , 04:52   Re: Bad Camper 1.4.239
Reply With Quote #637

i need a cvar to set the the plugins for only CT or only T.
That the plugin only works for only one team.
can anyone or u update this function pls :/?
s3rserii is offline
s3rserii
Senior Member
Join Date: Jan 2010
Old 06-01-2010 , 13:15   Re: Bad Camper 1.4.239
Reply With Quote #638

nobody can help? :/
s3rserii is offline
redpanama
Member
Join Date: Mar 2009
Location: KGB
Old 06-05-2010 , 21:55   Re: Bad Camper 1.4.239
Reply With Quote #639

GJ! but this plug-in need this badly:

While using this setting: badcamper_check_all 0,

when T plant the C4 then camp detection switches to CT, allowing the T to guard the site.
redpanama is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 06-06-2010 , 08:58   Re: Bad Camper 1.4.239
Reply With Quote #640

Quote:
Originally Posted by redpanama View Post
GJ! but this plug-in need this badly:

While using this setting: badcamper_check_all 0,

when T plant the C4 then camp detection switches to CT, allowing the T to guard the site.
That's exactly how it works, when using that setting.

Quote:
Originally Posted by Brad View Post
badcamper_check_all <0|1>
Specifies whether only the team with the current primary objective should be checked for camping or if both teams should.
  • 0: only check the team with the current primary objective
  • 1: always check both teams
The default is 1.

The current primary objective is defined as follows:
  • if the map is not a "de" map, the CTs have the primary objective
  • if the map is a "de" map and the bomb hasn't been planted, the Ts have the primary objective
  • if the map is a "de" map and the bomb has been planted, the CTs have the primary objective
__________________
Brad is offline
Reply



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

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

Forum Jump


All times are GMT -4. The time now is 07:06.


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