Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.98 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <cstrike>
  4. #include <sdkhooks>
  5. #include <scp>
  6. public Plugin:myinfo = {
  7. name = "VIP",
  8. author = "Ktoś",
  9. description = "",
  10. version = "1",
  11. url = ""
  12. }
  13. int g_fLastButtons[MAXPLAYERS+1], g_fLastFlags[MAXPLAYERS+1], g_iJumps[MAXPLAYERS+1];
  14. int offsetHe, offsetSmoke, offsetFlash, offsetDecoy, offsetHealth, offsetInc, offsetMol, offsetTa;
  15.  
  16. public OnPluginStart() {
  17. HookEvent("player_spawn", Event_PlayerSpawn);
  18. HookEvent("player_death", Event_PlayerDeath);
  19. }
  20. public OnMapStart() {
  21. ServerCommand("sv_disable_immunity_alpha 1");
  22. int entindex = CreateEntityByName("weapon_hegrenade");
  23. DispatchSpawn(entindex);
  24. offsetHe = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  25. AcceptEntityInput(entindex, "Kill");
  26. entindex = CreateEntityByName("weapon_smokegrenade");
  27. DispatchSpawn(entindex);
  28. offsetSmoke = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  29. AcceptEntityInput(entindex, "Kill");
  30. entindex = CreateEntityByName("weapon_flashbang");
  31. DispatchSpawn(entindex);
  32. offsetFlash = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  33. AcceptEntityInput(entindex, "Kill");
  34. entindex = CreateEntityByName("weapon_decoy");
  35. DispatchSpawn(entindex);
  36. offsetDecoy = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  37. AcceptEntityInput(entindex, "Kill");
  38. entindex = CreateEntityByName("weapon_healthshot");
  39. DispatchSpawn(entindex);
  40. offsetHealth = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  41. AcceptEntityInput(entindex, "Kill");
  42. entindex = CreateEntityByName("weapon_incgrenade");
  43. DispatchSpawn(entindex);
  44. offsetInc = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  45. AcceptEntityInput(entindex, "Kill");
  46. entindex = CreateEntityByName("weapon_molotov");
  47. DispatchSpawn(entindex);
  48. offsetMol = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  49. AcceptEntityInput(entindex, "Kill");
  50. entindex = CreateEntityByName("weapon_tagrenade");
  51. DispatchSpawn(entindex);
  52. offsetTa = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  53. AcceptEntityInput(entindex, "Kill");
  54.  
  55. }
  56. public Action Event_PlayerSpawn(Handle event, const char[] name, bool dontBroadcast)
  57. {
  58. int client = GetClientOfUserId(GetEventInt(event, "userid"));
  59. if (IsValidPlayer(client) && IsPlayerVip(client)) {
  60. CS_SetClientClanTag(client, "[VIP]");
  61. SetEntityGravity(client, 0.8);
  62. SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", 1.2);
  63. SetEntityRenderColor(client, 255, 255, 255, 240);
  64. if ((GetTeamScore(CS_TEAM_T) + GetTeamScore(CS_TEAM_CT)) == 0) SetEntProp(client , Prop_Send, "m_bHasHelmet", 1);
  65. if ((GetTeamScore(CS_TEAM_T) + GetTeamScore(CS_TEAM_CT)) > 0) SetEntProp(client ,Prop_Send,"m_ArmorValue",100,1);
  66. if ((GetTeamScore(CS_TEAM_T) + GetTeamScore(CS_TEAM_CT)) > 0) SetEntProp(client , Prop_Send, "m_bHasHelmet", 1);
  67. if (GetClientTeam(client) == CS_TEAM_CT && GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0) GivePlayerItem(client, "item_defuser");
  68. if (PlayerGrenade(client, 3) < 1) GivePlayerItem(client, "weapon_flashbang");
  69. if (PlayerGrenade(client, 5) < 2) GivePlayerItem(client, "weapon_healthshot");
  70. if (PlayerGrenade(client, 5) < 2) GivePlayerItem(client, "weapon_healthshot");
  71. }
  72. }
  73. public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) {
  74. int client = GetClientOfUserId(GetEventInt(event, "attacker"));
  75. bool headshot = GetEventBool(event, "headshot");
  76.  
  77. if (IsValidPlayer(client) && IsPlayerVip(client)) {
  78. SetEntityHealth(client, GetEntProp(client, Prop_Send, "m_iHealth") + 5);
  79. if(headshot) SetEntityHealth(client, GetEntProp(client, Prop_Send, "m_iHealth") + 10);
  80. }
  81. }
  82. public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
  83. {
  84. if (IsValidPlayer(client) && IsPlayerVip(client))
  85. {
  86. int fCurFlags = GetEntityFlags(client);
  87. int fCurButtons = GetClientButtons(client);
  88.  
  89. if (g_fLastFlags[client] & FL_ONGROUND)
  90. {
  91. if (!(fCurFlags & FL_ONGROUND) &&!(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP)
  92. {
  93. g_iJumps[client]++;
  94. }
  95. }
  96. else if (fCurFlags & FL_ONGROUND)
  97. {
  98. g_iJumps[client] = 0;
  99. }
  100. else if (!(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP)
  101. {
  102. if ( 1 <= g_iJumps[client] <= 2)
  103. {
  104. g_iJumps[client]++;
  105. float vVel[3];
  106. GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel);
  107.  
  108. vVel[2] = 250.0;
  109. TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vVel);
  110. }
  111. }
  112. g_fLastFlags[client] = fCurFlags;
  113. g_fLastButtons[client] = fCurButtons;
  114. }
  115. }
  116. public void OnClientPutInServer(int client) {
  117. if (IsValidPlayer(client)) {
  118. SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
  119. if (IsPlayerVip(client)) PrintToChatAll("VIP %N dołącza na serwer.",client);
  120. if (IsPlayerVip(client)) CS_SetClientClanTag(client, "[VIP]");
  121. }
  122. }
  123. public Action OnChatMessage(int &author, Handle recipients, char[] name, char[] message) {
  124. if (IsValidPlayer(author) && IsPlayerVip(author)) {
  125. int MaxMessageLength = MAXLENGTH_MESSAGE - strlen(name) - 5;
  126. Format(name, MaxMessageLength, "[VIP]%s",name);
  127. return Plugin_Changed;
  128. }
  129. return Plugin_Continue;
  130. }
  131. public Action OnTakeDamage(int client, int &attacker, int &inflictor, float &damage, int &damagetype) {
  132. if (IsValidPlayer(attacker)) damage = damage + damage * float(25) / 100.0;
  133. if (IsPlayerVip(client)) {
  134. if(damagetype & DMG_FALL) {
  135. return Plugin_Handled;
  136. }
  137. damage = damage - damage * float(10) / 100.0;
  138. }
  139. return Plugin_Changed;
  140. }
  141. stock bool IsValidPlayer(int client) {
  142. if(client >= 1 && client <= MaxClients && IsClientConnected(client) && !IsFakeClient(client) && IsClientInGame(client) )
  143. return true;
  144. return false;
  145. }
  146. stock int PlayerGrenade(int client, int granat)
  147. {
  148. if (granat == 1) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetHe);
  149. else if (granat == 2) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetSmoke);
  150. else if (granat == 3) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetFlash);
  151. else if (granat == 4) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetDecoy);
  152. else if (granat == 5) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetHealth);
  153. else if (granat == 6) {
  154. if (GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetInc) > GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetMol)) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetInc);
  155. else return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetMol);
  156. }
  157. else if (granat == 7) return GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetTa);
  158. return 0;
  159. }stock bool IsPlayerVip(int client) {
  160. if (CheckCommandAccess(client, "check_vip", ADMFLAG_CUSTOM6, false)) return true;
  161. return false;
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement