Advertisement
Akc3n7

VIP

Feb 10th, 2023
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.76 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < cstrike >
  3. #include < engine >
  4. #include < csx >
  5. #include < fakemeta >
  6. #include < hamsandwich >
  7.  
  8. /* Copyright 2018 © Sorinel / steamcommunity.com/id/jandarmeria */
  9. /* Credits Hattrick for bullet damage */
  10.  
  11. // new const vip_model_t[]  =  "vip_model_t"
  12. // new const vip_model_ct[]  =  "vip_model_ct"
  13.  
  14. const WEAPON_BITSUM = ((1<<CSW_GLOCK18)) | ((1<<CSW_USP))
  15.  
  16. #pragma tabsize 0
  17.  
  18. #define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
  19.  
  20. #define PLUGIN    "area.games vip"
  21. #define VERSION   "1.0"
  22. #define AUTHOR    "Sorinel"
  23.  
  24. //#define PREFIX "[NUMER SERVER]"  // poti pune ce vrei intre paranteze
  25. #define VIP_FLAG ADMIN_LEVEL_H     // flag vip, poti pune ce vrei
  26.  
  27. #define KILL_HP         7          // cat hp primesti cand faci kill
  28. #define HS_HP           14         // cat hp primesti cand dai hs
  29. #define KILL_MONEY      150        // cati bani primesti cand faci kill
  30. #define KILL_MONEY_HS   250        // cati bani primesti cand dai hs
  31. #define FRAG_HP_LIMIT   100        // limita la hp ca sa nu ajunga pe la 300 sau mai mult hp pe runda :))
  32.  
  33. new Round[33] = 0
  34. new g_iPosition[33]
  35. new g_iSize
  36. new cvar_jump
  37. new jumpnum[33]
  38. new bool: dojump[33]
  39.  
  40. new const restricted_maps[ ][ ] =
  41. {
  42.     "awp_",
  43.         "aim_"              
  44. }
  45.  
  46. new const Float: g_flCoords[ ][ ] = {
  47.  
  48.     { 0.50, 0.40 },
  49.     { 0.56, 0.44 },
  50.     { 0.60, 0.50 },
  51.     { 0.56, 0.56 },
  52.     { 0.50, 0.60 },
  53.     { 0.44, 0.56 },
  54.     { 0.40, 0.50 },
  55.     { 0.44, 0.44 }
  56. }
  57.  
  58. enum {
  59.     SCOREATTRIB_ARG_PLAYERID = 1,
  60.     SCOREATTRIB_ARG_FLAGS
  61. }
  62.  
  63. enum ( <<= 1 ) {
  64.     SCOREATTRIB_FLAG_NONE = 0,
  65.     SCOREATTRIB_FLAG_DEAD = 1,
  66.     SCOREATTRIB_FLAG_BOMB,
  67.     SCOREATTRIB_FLAG_VIP
  68. }
  69.  
  70. public plugin_init() {
  71.  
  72.        register_plugin(PLUGIN, VERSION, AUTHOR)
  73.        
  74.        RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
  75.        register_event("DeathMsg", "death_msg", "a", "1>0")
  76.        register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib")
  77.  
  78.        g_iSize = sizeof( g_flCoords )
  79.        cvar_jump = register_cvar("vip_jump", "1")
  80. }
  81.  
  82. /*
  83. public plugin_precache() {
  84.  
  85.         new ModelOrSoundPath[128]
  86.  
  87.     formatex(  ModelOrSoundPath,  sizeof  (  ModelOrSoundPath  )  -1, "models/player/%s/%s.mdl",  vip_model_t,  vip_model_t)
  88.         engfunc( EngFunc_PrecacheModel, ModelOrSoundPath)
  89.  
  90.         formatex(  ModelOrSoundPath,  sizeof  (  ModelOrSoundPath  )  -1, "models/player/%s/%s.mdl",  vip_model_ct,  vip_model_ct)
  91.     engfunc( EngFunc_PrecacheModel, ModelOrSoundPath)
  92. } */
  93.  
  94. public client_putinserver(id)
  95. {    
  96.         if(get_user_flags(id) & VIP_FLAG )
  97.     {
  98.         static name[32]
  99.         get_user_name(id, name, charsmax(name))
  100.         print_color(0, "!eVIP-ul !g%s !es-a conectat", name)   
  101.     }
  102.    
  103.     new map_name[32], i
  104.     get_mapname(map_name, charsmax(map_name))
  105.    
  106.     for(i = 0; i < sizeof(restricted_maps); i++)
  107.     {
  108.         if(equali(map_name, restricted_maps[i]))
  109.         {
  110.             remove_user_flags(id, VIP_FLAG)
  111.         }
  112.     }
  113. }
  114.  
  115. public MessageScoreAttrib(iMsgId, iDest, iReceiver) {
  116.  
  117.        new iPlayer = get_msg_arg_int(SCOREATTRIB_ARG_PLAYERID)
  118.    
  119.        if(get_user_flags(iPlayer) & VIP_FLAG)
  120.           set_msg_arg_int(SCOREATTRIB_ARG_FLAGS, ARG_BYTE, SCOREATTRIB_FLAG_VIP)
  121. }
  122.  
  123. public client_damage( iAttacker, iVictim, iDamage ) {
  124.    
  125.     if(is_user_alive(iAttacker) && get_user_flags(iAttacker) & VIP_FLAG ) {
  126.        
  127.         if( ++g_iPosition[ iAttacker ] == g_iSize )
  128.             g_iPosition[ iAttacker ] = 0;
  129.        
  130.         set_hudmessage(random_num(0, 255), random_num(0, 255), random_num(0, 255), Float: g_flCoords[ g_iPosition[ iAttacker ] ][ 0 ], Float: g_flCoords[ g_iPosition[ iAttacker ] ][ 1 ], 0, 0.1, 2.5, 0.02, 0.02, -1 )
  131.         show_hudmessage( iAttacker, "%i", iDamage )
  132.     }
  133. }
  134.  
  135. bonus_health(id, health)
  136. {
  137.     if( is_user_bot(id) )
  138.           return PLUGIN_HANDLED
  139.    
  140.     static limit
  141.     limit = FRAG_HP_LIMIT
  142.    
  143.     if( is_user_alive( id ) && get_user_flags( id ) & VIP_FLAG )
  144.     {
  145.         limit = FRAG_HP_LIMIT
  146.     }
  147.        
  148.     fm_set_user_health(id, clamp((get_user_health(id) + health), 1, limit))
  149.     return PLUGIN_HANDLED
  150. }
  151.  
  152. public death_msg()
  153. {
  154.     new killer = read_data(1)
  155.     new victim = read_data(2)
  156.         new headshot = read_data(3)
  157.  
  158.     if(killer == victim || !is_user_connected(victim) || !is_user_alive(killer))
  159.                      return PLUGIN_HANDLED
  160.  
  161.         if (headshot)
  162.         {
  163.                 bonus_health(killer, HS_HP)
  164.                
  165.                 if(is_user_alive(killer) && get_user_flags(killer) & VIP_FLAG)
  166.                 {
  167.                       cs_set_user_money(killer, cs_get_user_money(killer) + KILL_MONEY_HS)
  168.                 }
  169.         }
  170.         else
  171.         {
  172.                 bonus_health(killer, KILL_HP)
  173.                
  174.                 if(is_user_alive(killer) && get_user_flags(killer) & VIP_FLAG)  
  175.                 {
  176.                       cs_set_user_money(killer, cs_get_user_money(killer) + KILL_MONEY)
  177.                 }
  178.         }
  179.         return PLUGIN_CONTINUE
  180. }
  181.  
  182. public fwHamPlayerSpawnPost(id) {
  183.    
  184.     if(is_user_alive(id) && get_user_flags(id) & VIP_FLAG )
  185.     {
  186.         drop_primary(id)
  187.         fm_give_item(id, "weapon_deagle")
  188.         cs_set_user_bpammo(id, CSW_DEAGLE, 35)
  189.         fm_give_item(id, "weapon_hegrenade")
  190.         fm_give_item(id, "weapon_flashbang")
  191.         cs_set_user_bpammo(id, CSW_FLASHBANG, 2)  
  192.         cs_set_user_armor(id, 100, CS_ARMOR_VESTHELM)          
  193.        
  194.     /*  switch(cs_get_user_team(id))
  195.         {
  196.                    case CS_TEAM_T:  cs_set_user_model(id, vip_model_t)
  197.                    case CS_TEAM_CT: cs_set_user_model(id, vip_model_ct)
  198.         } */
  199.            
  200.         if(Round[id] > 3) {
  201.                
  202.             vip_menu(id)
  203.         }      
  204.         else {
  205.             Round[id]++
  206.         }
  207.     }
  208. }
  209.  
  210. public client_PreThink(id)
  211. {
  212.     if(is_user_alive(id)) {
  213.        
  214.         new BUTON = get_user_button(id)
  215.         new OLDBUTON = get_user_oldbutton(id)
  216.         new JUMP_VIP = get_pcvar_num(cvar_jump)
  217.        
  218.         if((BUTON & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(OLDBUTON & IN_JUMP))
  219.         {
  220.             if(((get_user_flags(id) & VIP_FLAG) && (jumpnum[id] < JUMP_VIP)))
  221.             {
  222.                 dojump[id] = true
  223.                 jumpnum[id]++
  224.             }
  225.         }
  226.        
  227.         if((BUTON & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
  228.         {
  229.             jumpnum[id] = 0
  230.         }
  231.     }
  232. }
  233.  
  234. public client_PostThink(id)
  235. {
  236.     if(is_user_alive(id)) {
  237.        
  238.         if(dojump[id] == true)
  239.         {
  240.             new Float: velocity[3] 
  241.             entity_get_vector(id, EV_VEC_velocity, velocity)
  242.             velocity[2] = random_float(265.0, 285.0)
  243.             entity_set_vector(id, EV_VEC_velocity, velocity)
  244.             dojump[id] = false
  245.         }
  246.     }
  247. }
  248.  
  249. public vip_menu( id ) {
  250.    
  251.     new menu = menu_create( "\rVIP MENU", "menu_handler" )  
  252.     menu_additem( menu, "\yM4A1", "", 1, VIP_FLAG)
  253.     menu_additem( menu, "\yAK47", "", 1, VIP_FLAG)
  254.     menu_setprop( menu, MPROP_EXIT, MEXIT_ALL)
  255.         menu_display( id, menu, 0 )
  256.  
  257. }
  258.  
  259. public menu_handler( id, menu, item )
  260. {
  261.    
  262.     switch( item )
  263.     {
  264.         case 0:
  265.         {
  266.                 fm_give_item(id, "weapon_m4a1")
  267.                         cs_set_user_bpammo(id, CSW_M4A1, 90)
  268.    
  269.         }
  270.         case 1:
  271.         {
  272.                 fm_give_item(id, "weapon_ak47")
  273.                         cs_set_user_bpammo(id, CSW_AK47, 90)
  274.  
  275.         }
  276.     }
  277.    
  278.     menu_destroy( menu )
  279.     return PLUGIN_HANDLED
  280. }
  281.  
  282. drop_primary(id)
  283. {
  284.     static weapons[32], num
  285.     get_user_weapons(id, weapons, num)
  286.  
  287.     for (new i = 0; i < num; i++)
  288.     {
  289.         if (WEAPON_BITSUM & (1<<weapons[i]))
  290.         {
  291.             static wname[32];
  292.             get_weaponname(weapons[i], wname, sizeof wname - 1)
  293.  
  294.             engclient_cmd(id, "drop", wname)
  295.         }
  296.     }
  297. }
  298.  
  299.  
  300. /* Stock-uri */
  301.  
  302. stock fm_set_user_health(index, health) {
  303.     health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index)
  304.  
  305.     return 1
  306. }
  307.  
  308. stock fm_give_item(index, const item[]) {
  309.     if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
  310.         return 0
  311.  
  312.     new ent = fm_create_entity(item)
  313.     if (!pev_valid(ent))
  314.         return 0
  315.  
  316.     new Float:origin[3]
  317.     pev(index, pev_origin, origin)
  318.     set_pev(ent, pev_origin, origin)
  319.     set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
  320.     dllfunc(DLLFunc_Spawn, ent)
  321.  
  322.     new save = pev(ent, pev_solid)
  323.     dllfunc(DLLFunc_Touch, ent, index)
  324.     if (pev(ent, pev_solid) != save)
  325.         return ent
  326.  
  327.     engfunc(EngFunc_RemoveEntity, ent)
  328.  
  329.     return -1
  330. }
  331.  
  332. stock print_color( const id, const input[ ], any:... )
  333. {
  334.     new count = 1, players[ 32 ]
  335.    
  336.     static msg[ 191 ]
  337.     vformat( msg, 190, input, 3 )
  338.    
  339.     replace_all( msg, 190, "!v", "^4" ) //- verde
  340.     replace_all( msg, 190, "!g", "^1" ) //- galben
  341.     replace_all( msg, 190, "!e", "^3" ) //- echipa
  342.     replace_all( msg, 190, "!n", "^0" ) //- normal
  343.    
  344.     if( id ) players[ 0 ] = id; else get_players( players, count, "ch" )
  345.         {
  346.  
  347.     for( new i = 0; i < count; i++ )
  348.     {
  349.         if( is_user_connected( players[ i ] ) )
  350.         {
  351.             message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] )
  352.             write_byte( players[ i ] );
  353.             write_string( msg );
  354.             message_end( );
  355.         }
  356.     }
  357. }
  358. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement