Raised This Month: $51 Target: $400
 12% 

No fall damage on a timer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hiiamu
Member
Join Date: Nov 2018
Old 04-23-2019 , 11:53   No fall damage on a timer
Reply With Quote #1

I want to make T's not take fall damage for the first 10 seconds of the round, but I cant think of a way to make it act on a timer.

PHP Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
#include <sdkhooks>

#define DMG_FALL   (1 << 5)

public Plugin myinfo 
{
    
name "[CS:S/CS:GO] No Fall Damage",
    
author "alexip121093 & Neoxx",
    
description "No Falling Damage & No Fall Damage Sound",
    
version "1.0",
    
url "www.sourcemod.net"
}

public 
void OnPluginStart() {AddNormalSoundHook(SoundHook);}
public 
void OnClientPostAdminCheck(int client) {SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);}

public 
Action SoundHook(int clients[64], int &numClientschar sound[PLATFORM_MAX_PATH], int &Entint &channelfloat &volumeint &levelint &pitchint &flags)
{
    if(
Ent && Ent <= MaxClients && IsClientInGame(Ent) && GetClientTeam(Ent) == CS_TEAM_T)
        for (
int i 13i++) {
            if(
StrEqual(sound"player/damage%i.wav"false), i) return Plugin_Stop;
        }
    return 
Plugin_Continue;
}

public 
Action OnTakeDamage(int clientint &attackerint &inflictorfloat &damageint &damagetype)
{
    if (
damagetype DMG_FALL && GetClientTeam(client) == CS_TEAM_T) {return Plugin_Handled;}
    return 
Plugin_Continue;

hiiamu is offline
farawayf
Senior Member
Join Date: Jan 2019
Old 04-23-2019 , 12:19   Re: No fall damage on a timer
Reply With Quote #2

create a boolean. Set it to true on timer callback. Check in OnTakeDamage if false = return Plugin_Handled , if true = return Plugin_Continue.

Last edited by farawayf; 04-23-2019 at 12:37.
farawayf is offline
Cruze
Veteran Member
Join Date: May 2017
Old 04-23-2019 , 12:26   Re: No fall damage on a timer
Reply With Quote #3

Hello! Try this:
PHP Code:
#include <sourcemod> 
#include <cstrike> 
#include <sdktools> 
#include <sdkhooks> 

#define DMG_FALL   (1 << 5)

Handle tIMER null;

bool fd false;

public 
Plugin myinfo =  

    
name "[CS:S/CS:GO] No Fall Damage"
    
author "alexip121093 & Neoxx"
    
description "No Falling Damage & No Fall Damage Sound"
    
version "1.1"
    
url "www.sourcemod.net" 


public 
void OnPluginStart()
{
    
AddNormalSoundHook(SoundHook);
    
HookEvent("round_start"Event_RoundStart);
}

public 
void Event_RoundStart(Event evchar[] namebool dbc)
{
    
fd false;
    if(
tIMER != null)
    {
        
KillTimer(tIMER);
        
tIMER null;
    }
    
tIMER CreateTimer(10.0STARTDAMAGE);
}

public 
Action STARTDAMAGE(Handle timer)
{
    if(!
fd)
    {
        
fd true;
    }
}
public 
void OnClientPostAdminCheck(int client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);


public 
Action SoundHook(int clients[64], int &numClientschar sound[PLATFORM_MAX_PATH], int &Entint &channelfloat &volumeint &levelint &pitchint &flags

    if(!
fd && Ent && Ent <= MaxClients && IsClientInGame(Ent) && GetClientTeam(Ent) == CS_TEAM_T)
    {
        for (
int i 13i++)
        { 
            if(
StrEqual(sound"player/damage%i.wav"false), i)
                return 
Plugin_Stop
        }
    }
    return 
Plugin_Continue


public 
Action OnTakeDamage(int clientint &attackerint &inflictorfloat &damageint &damagetype

    if (!
fd && damagetype DMG_FALL && GetClientTeam(client) == CS_TEAM_T)
    {
        return 
Plugin_Handled;
    } 
    return 
Plugin_Continue

__________________
Taking paid private requests! Contact me
Cruze is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode