CamerDisco

Untitled

May 31st, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdkhooks>
  3. #include <sdktools>
  4. #include <cstrike>
  5. #include <codmod>
  6.  
  7. new const String:nazwa[] = "El Pistolero";
  8. new const String:opis[] = "Moduł odrzutowy co 5s(CTRL+SPACE), Może kupić każdy pistolet\n15%% redukcji obrażeń, +25 DMG do pistoletów";
  9. new const String:bronie[] = "#weapon_p250#weapon_p250";
  10. new const inteligencja = 0;
  11. new const zdrowie = 20;
  12. new const obrazenia = 0;
  13. new const wytrzymalosc = 20;
  14. new const kondycja = 20;
  15.  
  16. bool ma_klase[MAXPLAYERS+1];
  17. float wartosc_itemu[MAXPLAYERS+1];
  18.  
  19. char pistolety[][] =
  20. {
  21. "glock",
  22. "usp_silencer",
  23. "hkp2000",
  24. "p250",
  25. "tec9",
  26. "fiveseven",
  27. "cz75a",
  28. "deagle",
  29. "revolver",
  30. "elite"
  31. };
  32.  
  33. public Action CS_OnBuyCommand(int client, const char[] weapon)
  34. {
  35. if(!ma_klase[client]) return Plugin_Continue;
  36.  
  37. for(int i = 0; i<sizeof(pistolety); i++)
  38. {
  39. if(StrEqual(weapon, pistolety[i]))
  40. {
  41. return Plugin_Continue;
  42. }
  43. }
  44. return Plugin_Handled;
  45. }
  46.  
  47. public OnPluginStart()
  48. {
  49. CreateTimer(5.0, zaladuj);
  50. CreateConVar(nazwa, "1.0", "Linux`");
  51. HookEvent("player_spawn", OdrodzenieGracza);
  52. }
  53.  
  54. public cod_class_skill_used(client)
  55. {
  56. if(GetGameTime() < wartosc_itemu[client]+5.0)
  57. {
  58. //do nothing
  59. }
  60. else
  61. {
  62. new Float:velocity[3];
  63. new Float:velocity0;
  64. new Float:velocity1;
  65. velocity0 = GetEntPropFloat(client, Prop_Send, "m_vecVelocity[0]");
  66. velocity1 = GetEntPropFloat(client, Prop_Send, "m_vecVelocity[1]");
  67. velocity[0] = (16.0*velocity0)*(1.0/4.1);
  68. velocity[1] = (16.0*velocity1)*(1.0/4.1);
  69. velocity[2] = 0.0;
  70.  
  71. SetEntPropVector(client, Prop_Send, "m_vecBaseVelocity", velocity);
  72. wartosc_itemu[client] = GetGameTime();
  73. }
  74. }
  75.  
  76. public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
  77. {
  78. if(GetGameTime() < wartosc_itemu[client]+5.0) return;
  79.  
  80. if( (buttons & IN_JUMP) && (buttons & IN_DUCK) )
  81. {
  82. if(ma_klase[client])
  83. ClientCommand(client, "useclass");
  84. }
  85. }
  86.  
  87. public Action:OdrodzenieGracza(Handle:event, String:name[], bool:dontBroadcast)
  88. {
  89. new client = GetClientOfUserId(GetEventInt(event, "userid"));
  90. if(!IsValidClient(client) || !ma_klase[client])
  91. return;
  92.  
  93. if(wartosc_itemu[client] != 0.0)
  94. wartosc_itemu[client] = 0.0;
  95. }
  96.  
  97. public Action zaladuj(Handle timer)
  98. {
  99. cod_register_class(nazwa, opis, bronie, inteligencja, zdrowie, obrazenia, wytrzymalosc, kondycja);
  100. }
  101.  
  102. public cod_class_enabled(client)
  103. {
  104. ma_klase[client] = true;
  105. wartosc_itemu[client] = 0.0;
  106. }
  107.  
  108. public cod_class_disabled(client)
  109. {
  110. ma_klase[client] = false;
  111. wartosc_itemu[client] = 0.0;
  112. }
  113.  
  114. public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
  115. {
  116. if(!IsValidClient(victim) || !IsValidClient(attacker))
  117. return Plugin_Continue;
  118.  
  119. if(GetClientTeam(victim) == GetClientTeam(attacker))
  120. return Plugin_Continue;
  121.  
  122. if(!ma_klase[attacker])
  123. {
  124. if(!ma_klase[victim])
  125. return Plugin_Continue;
  126. else
  127. {
  128. if(GetRandomInt(1, 8) == 1)
  129. {
  130. damage = 0.0;
  131. return Plugin_Changed;
  132. }
  133. }
  134. }
  135.  
  136. if(cod_get_user_item(victim) == cod_get_itemid("Betonowa Głowa") && damagetype & CS_DMG_HEADSHOT)
  137. return Plugin_Continue;
  138.  
  139. if(odporny(victim))
  140. return Plugin_Continue;
  141.  
  142. if(damagetype & DMG_BULLET || damagetype & DMG_SLASH)
  143. {
  144. cod_inflict_damage(victim, attacker, 1, 25);
  145. }
  146.  
  147. return Plugin_Changed;
  148. }
  149.  
  150. public cod_skill_class_used(client)
  151. {
  152. new zdrowie_gracza = GetClientHealth(client);
  153. new maksymalne_zdrowie = zdrowie_gracza+cod_get_user_health(client, 1, 1, 1);
  154. int nowe_zdrowie = maksymalne_zdrowie+65;
  155. SetEntData(client, FindDataMapOffs(client, "m_iHealth"), nowe_zdrowie);
  156. }
Advertisement
Add Comment
Please, Sign In to add comment