Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- #include <cstrike>
- #pragma semicolon 1
- #pragma newdecls required
- public Plugin myinfo = {
- name = "Death Run: Free Run",
- author = "Milutinke (ByM)",
- description = "Adds Free Run to deathmatch",
- version = "0.0.1",
- url = ""
- };
- bool g_bFreerun = false;
- public void OnPluginStart() {
- RegConsoleCmd("sm_freerun", Command_Freerun);
- HookEntityOutput("func_button", "OnPressed", OnButtonPressed);
- }
- public Action Command_Freerun(int client, int args) {
- if(IsValidClient(client)) {
- if(GetClientTeam(client) == CS_TEAM_T) {
- if(!g_bFreerun) {
- g_bFreerun = true;
- PrintToChat(client, "Free run activated!");
- } else PrintToChat(client, "It's free run already!");
- } else PrintToChat(client, "You do not have permission for this command, only a T player can execute this!");
- }
- return Plugin_Handled;
- }
- public Action OnButtonPressed(const char[] output, int caller, int activator, float delay) {
- if(IsValidEntity(caller) && IsValidClient(activator)) {
- if(g_bFreerun) {
- PrintToChat(activator, "It's free run!");
- return Plugin_Stop;
- }
- }
- return Plugin_Continue;
- }
- stock bool IsValidClient(int client) {
- if(client <= 0 || client > MaxClients || !IsClientInGame(client) || IsFakeClient(client) || IsClientSourceTV(client) || IsClientReplay(client))
- return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement