Advertisement
Guest User

Untitled

a guest
Feb 14th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.90 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <cstrike>
  3. #include <sdktools>
  4.  
  5. #pragma semicolon 1
  6. #pragma newdecls required
  7.  
  8. char tag[64] = "VIP";
  9.  
  10. int offsetHe;
  11. int offsetFlash;
  12. int offsetSmoke;
  13. int offsetInc;
  14. int offsetMol;
  15. int g_fLastButtons[MAXPLAYERS+1], g_fLastFlags[MAXPLAYERS+1], g_iJumps[MAXPLAYERS+1];
  16.  
  17. public void OnPluginStart()
  18. {
  19.     HookEvent("bomb_planted", EventBombPlanted);
  20.     HookEvent("bomb_defused", EventBombDefused);
  21.     HookEvent("player_spawn", PlayerSpawn);
  22.     HookEvent("player_death", PlayerDeath);
  23. }
  24.  
  25. public void OnMapStart()
  26. {
  27.    
  28.     int entindex;
  29.  
  30.     entindex = CreateEntityByName("weapon_hegrenade");
  31.     DispatchSpawn(entindex);
  32.     offsetHe = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  33.     AcceptEntityInput(entindex, "Kill");
  34.  
  35.     entindex = CreateEntityByName("weapon_flashbang");
  36.     DispatchSpawn(entindex);
  37.     offsetFlash = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  38.     AcceptEntityInput(entindex, "Kill");
  39.  
  40.     entindex = CreateEntityByName("weapon_smokegrenade");
  41.     DispatchSpawn(entindex);
  42.     offsetSmoke = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  43.     AcceptEntityInput(entindex, "Kill");
  44.  
  45.     entindex = CreateEntityByName("weapon_incgrenade");
  46.     DispatchSpawn(entindex);
  47.     offsetInc = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  48.     AcceptEntityInput(entindex, "Kill");
  49.    
  50.     entindex = CreateEntityByName("weapon_molotov");
  51.     DispatchSpawn(entindex);
  52.     offsetMol = GetEntProp(entindex, Prop_Send, "m_iPrimaryAmmoType");
  53.     AcceptEntityInput(entindex, "Kill");
  54.  
  55. }
  56.  
  57. public Action PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
  58. {
  59.     int client = GetClientOfUserId(GetEventInt(event, "userid"));
  60.     if(IsValidPlayer(client) && IsPlayerVIP(client))
  61.     {
  62.         if(IsPlayerAlive(client))
  63.         {
  64.             CreateTimer(0.1, GiveEquipment, GetEventInt(event, "userid"), TIMER_FLAG_NO_MAPCHANGE);
  65.         }
  66.     }
  67. }
  68. public Action GiveEquipment(Handle timer, any userid) {
  69.     int client = GetClientOfUserId(userid);
  70.    
  71.     if(!IsPlayerAlive(client) || !IsValidPlayer(client)) return;
  72.    
  73.         SetEntProp(client, Prop_Send, "m_ArmorValue", 100);
  74.         SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
  75.         SetEntityHealth(client, GetEntProp(client, Prop_Send, "m_iHealth") + 5);
  76.  
  77.     if(GetTeamScore(CS_TEAM_CT) + GetTeamScore(CS_TEAM_T) != 0)
  78.     {  
  79.  
  80.         if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetHe) < 1)
  81.             GivePlayerItem(client, "weapon_hegrenade");
  82.         if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetFlash) < 1)
  83.             GivePlayerItem(client, "weapon_flashbang");
  84.         if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetSmoke) < 1)
  85.             GivePlayerItem(client, "weapon_smokegrenade");
  86.         if(GetClientTeam(client) == CS_TEAM_CT)
  87.             if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetInc) < 1)
  88.                 GivePlayerItem(client, "weapon_incgrenade");
  89.         if(GetClientTeam(client) == CS_TEAM_T)
  90.             if(GetEntProp(client, Prop_Send, "m_iAmmo", _, offsetMol) < 1)
  91.                 GivePlayerItem(client, "weapon_molotov");
  92.         if(GetClientTeam(client) == CS_TEAM_CT)
  93.             if (GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0)
  94.                 GivePlayerItem(client, "item_defuser");
  95.     }
  96. }
  97. public Action PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
  98. {
  99.     int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  100.     if(!IsValidPlayer(attacker) || !IsPlayerVIP(attacker)) return;
  101.     int health = GetClientHealth(attacker);
  102.     SetEntityHealth(attacker, health+5);
  103.     int money = GetEntProp(attacker, Prop_Send, "m_iAccount");
  104.     SetEntProp(attacker, Prop_Send, "m_iAccount", money+100);
  105.     bool headshot = GetEventBool(event, "headshot", false);
  106.     if(headshot)
  107.     {
  108.         health = GetClientHealth(attacker);
  109.         SetEntityHealth(attacker, health+5);
  110.         money = GetEntProp(attacker, Prop_Send, "m_iAccount");
  111.         SetEntProp(attacker, Prop_Send, "m_iAccount", money+200);
  112.     }
  113.     if(GetClientHealth(attacker) > 105)
  114.                 SetEntityHealth(attacker, 105);
  115. }
  116.  
  117. public Action EventBombPlanted(Event event, const char[] name, bool dontBroadcast)
  118. {
  119.     int client = GetClientOfUserId(GetEventInt(event, "userid"));
  120.     int money = GetEntProp(client, Prop_Send, "m_iAccount");
  121.     if(IsPlayerVIP(client))
  122.         SetEntProp(client, Prop_Send, "m_iAccount", money+250);
  123. }
  124. public Action EventBombDefused(Event event, const char[] name, bool dontBroadcast)
  125. {
  126.     int client = GetClientOfUserId(GetEventInt(event, "userid"));
  127.     int money = GetEntProp(client, Prop_Send, "m_iAccount");
  128.     if(IsPlayerVIP(client))
  129.         SetEntProp(client, Prop_Send, "m_iAccount", money+250);
  130. }
  131.  
  132. public void OnClientPostAdminCheck(int client)
  133. {
  134.     if(IsPlayerVIP(client))
  135.     {
  136.            
  137.         PrintToChatAll(" %s \x03%N\x01 \x01", tag, client);
  138.     }
  139. }
  140.  
  141. public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
  142. {
  143.     if (IsValidPlayer(client) && IsPlayerVIP(client))
  144.     {
  145.         int fCurFlags = GetEntityFlags(client);
  146.         int fCurButtons = GetClientButtons(client);
  147.                    
  148.         if (g_fLastFlags[client] & FL_ONGROUND)
  149.         {      
  150.             if (!(fCurFlags & FL_ONGROUND) &&!(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP)
  151.             {
  152.                 g_iJumps[client]++;        
  153.             }
  154.         }
  155.         else if (fCurFlags & FL_ONGROUND)
  156.         {
  157.             g_iJumps[client] = 0;                      
  158.         }
  159.         else if (!(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP)
  160.         {
  161.             if ( 1 <= g_iJumps[client] < 2)
  162.             {                      
  163.                 g_iJumps[client]++;                                        
  164.                 float vVel[3];
  165.                 GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel);
  166.                                
  167.                 vVel[2] = 250.0;
  168.                 TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vVel);
  169.             }                          
  170.         }
  171.         g_fLastFlags[client] = fCurFlags;              
  172.         g_fLastButtons[client] = fCurButtons;
  173.     }
  174. }
  175.  
  176. stock bool IsValidPlayer(int client)
  177. {
  178.     if(client >= 1 && client <= MaxClients && IsClientInGame(client) && IsClientConnected(client) && !IsFakeClient(client) && !IsClientReplay(client) && !IsClientSourceTV(client))
  179.         return true;
  180.     return false;
  181. }
  182.  
  183. stock bool IsPlayerVIP(int client)
  184. {
  185.     if(GetUserFlagBits(client) & ADMFLAG_CUSTOM6)
  186.         return true;
  187.     return false;
  188. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement