laurentiuarion

AWP & KNIFE

Feb 11th, 2020
102
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <amxmodx>
  2. #include <fun>
  3. #include <cstrike>
  4. #include <hamsandwich>
  5. #include <fakemeta>
  6.  
  7. new g_FwdKeyValue;
  8. new cvar_knife_allow;
  9.  
  10. public plugin_init() {
  11.     register_plugin("AWP & KNIFE", "0.4", "Ex3cuTioN/Arion");
  12.    
  13.     new map[32];
  14.     get_mapname(map,31);
  15.    
  16.     if(equali(map, "awp_", 3)) {
  17.         RegisterHam(Ham_Spawn, "player", "ham_player_spawn", 1);
  18.         unregister_forward(FM_KeyValue, g_FwdKeyValue);
  19.    
  20.         cvar_knife_allow = register_cvar("amx_give_knife","1");
  21.     }
  22. }
  23.  
  24. public plugin_precache() {
  25.     new map[32];
  26.     get_mapname(map,31);
  27.    
  28.     if(equali(map, "awp_", 3))
  29.         g_FwdKeyValue = register_forward(FM_KeyValue, "Forward_KeyValue" );
  30. }
  31.  
  32. public Forward_KeyValue(const EntIndex, const KvdHandle) {
  33.     if(pev_valid(EntIndex)) {
  34.         new szClassName[16];
  35.         get_kvd(KvdHandle, KV_ClassName, szClassName, charsmax(szClassName));
  36.            
  37.         if(equal(szClassName, "armoury_entity")) {
  38.             engfunc(EngFunc_RemoveEntity, EntIndex);
  39.            
  40.             return FMRES_SUPERCEDE;
  41.         }
  42.     }
  43.        
  44.     return FMRES_IGNORED;
  45. }
  46.  
  47. public ham_player_spawn(const id,ent) {
  48.     strip_user_weapons(id);
  49.     set_task(0.5,"cmd_awp",id);
  50.  
  51.     return PLUGIN_CONTINUE;
  52. }
  53.  
  54. public cmd_awp(id) {
  55.     give_item(id,"weapon_awp");
  56.     cs_set_user_bpammo(id, CSW_AWP, 30);
  57.  
  58.     if(get_pcvar_num(cvar_knife_allow) == 1)
  59.         give_item(id,"weapon_knife");
  60.        
  61.     return PLUGIN_HANDLED;
  62. }
RAW Paste Data