Advertisement
milutinke

Death Run: Free Run [CS:GO]

Dec 18th, 2021
1,560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.55 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <sdkhooks>
  4. #include <cstrike>
  5.  
  6. #pragma semicolon 1
  7. #pragma newdecls required
  8.  
  9. public Plugin myinfo = {
  10.     name        = "Death Run: Free Run",
  11.     author      = "Milutinke (ByM)",
  12.     description = "Adds Free Run to deathmatch",
  13.     version     = "0.0.1",
  14.     url         = ""
  15. };
  16.  
  17. bool g_bFreerun = false;
  18.  
  19. public void OnPluginStart() {
  20.     RegConsoleCmd("sm_freerun", Command_Freerun);
  21.     HookEntityOutput("func_button", "OnPressed", OnButtonPressed);
  22. }
  23.  
  24. public Action Command_Freerun(int client, int args) {
  25.     if(IsValidClient(client)) {
  26.         if(GetClientTeam(client) == CS_TEAM_T) {
  27.             if(!g_bFreerun) {
  28.                 g_bFreerun = true;
  29.                 PrintToChat(client, "Free run activated!");
  30.             } else PrintToChat(client, "It's free run already!");
  31.         } else PrintToChat(client, "You do not have permission for this command, only a T player can execute this!");
  32.     }
  33.  
  34.     return Plugin_Handled;
  35. }
  36.  
  37. public Action OnButtonPressed(const char[] output, int caller, int activator, float delay) {
  38.     if(IsValidEntity(caller) && IsValidClient(activator)) {
  39.         if(g_bFreerun) {
  40.             PrintToChat(activator, "It's free run!");
  41.  
  42.             return Plugin_Stop;
  43.         }
  44.     }
  45.  
  46.     return Plugin_Continue;
  47. }
  48.  
  49. stock bool IsValidClient(int client) {
  50.     if(client <= 0 || client > MaxClients || !IsClientInGame(client) || IsFakeClient(client) || IsClientSourceTV(client) || IsClientReplay(client))
  51.         return false;
  52.    
  53.     return true;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement