MasamuneDate

[Untested] codclass_thief.sma

May 31st, 2022 (edited)
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.65 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <codmod>
  5. #include <engine>
  6. #include <colorchat>
  7.  
  8. new const Name[] = "Thief";
  9. new const Desc[] = "Reduced visibility, 1/4 chance to stole its victim perk ( 50% chance to stole Perk 1 / Perk 2 )";
  10. new const Weapon = 1<<CSW_GALIL | 1<<CSW_FLASHBANG | 1<<CSW_HEGRENADE | 1<<CSW_DEAGLE;
  11. new const HpBonus = 15;
  12. new const Speed = 30;
  13. new const Intelligence = 0;
  14. new const Str = 15;
  15.  
  16. new bool:classEnable[33];
  17.  
  18. new victim[33], victimPerk[33], victimPerkValue[33];
  19. new perkFlag[33];
  20.  
  21. public plugin_init() {
  22.     register_plugin(Name, "1.0", "QTM_Peyote");
  23.     cod_register_class(Name, Desc, Weapon, HpBonus, Speed, Intelligence, Str);
  24.     register_event("DeathMsg", "DeathMsg", "ade");
  25. }
  26.  
  27. public cod_class_enabled(id)
  28. {
  29.     set_rendering(id,kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 125);
  30.     classEnable[id] = true;
  31.     ColorChat(id, RED, "2nd Rework by Datod / TYR", Name);
  32. }
  33.  
  34. public cod_class_disabled(id)
  35. {
  36.     set_rendering(id,kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255);
  37.     classEnable[id] = false;
  38. }
  39.  
  40. public DeathMsg(id)
  41. {
  42.     new killer = read_data(1);
  43.     new target = read_data(2);
  44.    
  45.     if(!is_user_connected(killer))
  46.         return;
  47.  
  48.     if(!classEnable[killer])
  49.         return;
  50.        
  51.     if(random(4))
  52.         return;
  53.    
  54.     if(random(2)){
  55.         if(!(victimPerk[killer] = cod_get_user_perk(target, victimPerkValue[killer], 1)))
  56.         perkFlag[id] = true;
  57.         return;
  58.     }
  59.     else{
  60.         if(!(victimPerk[killer] = cod_get_user_perk(target, victimPerkValue[killer], 0)))
  61.         return;
  62.     }
  63.  
  64.     victim[killer] = target;
  65.    
  66.     ConfirmMenu(killer);
  67. }
  68.  
  69. public ConfirmMenu(id)
  70. {
  71.     new Text[55];
  72.     new perkName[33];
  73.     cod_get_perk_name(victimPerk[id], perkName, 32);
  74.     format(Text, 54, "Do you want to steal perk: %s ?", perkName);
  75.     new menu = menu_create(Text, "ConfirmationAccept");
  76.    
  77.     menu_additem(menu, "Yes");
  78.     menu_setprop(menu, MPROP_EXITNAME, "No");
  79.    
  80.     menu_display(id, menu);
  81. }
  82.  
  83. public ConfirmationAccept(id, menu, item)
  84. {
  85.     if(item)
  86.         return;
  87.    
  88.     if(cod_get_user_perk(victim[id]) != victimPerk[id])
  89.         return;
  90.        
  91.     new thiefName[33];
  92.     get_user_name(id, thiefName, 32);
  93.  
  94.     if(perkFlag[id]){
  95.         ColorChat(victim[id], RED, "Your perk was stolen by %s.", thiefName);
  96.         cod_set_user_perk(victim[id], 1);
  97.         cod_set_user_perk(id, victimPerk[id], victimPerkValue[id], 1);
  98.     }
  99.     else{
  100.         ColorChat(victim[id], RED, "Your perk was stolen by %s.", thiefName);
  101.         cod_set_user_perk(victim[id], 0);
  102.         cod_set_user_perk(id, victimPerk[id], victimPerkValue[id]);
  103.     }
  104. }
  105. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  106. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
  107. */
  108.  
Add Comment
Please, Sign In to add comment