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

Solved How to set SDKHook on round_start correctly?


Post New Thread Reply   
 
Thread Tools Display Modes
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-28-2018 , 06:38   Re: How to set SDKHook on round_start correctly?
Reply With Quote #21

Quote:
Originally Posted by Dragokas View Post
I think checking for "oldteam" will be better:

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

public void OnPluginStart() 

    
HookEvent("player_team"Event_Player_Team); 


public 
Action Event_Player_Team(Event eventchar[] namebool dontBroadcast

    
int UserId event.GetInt("userid"); 
    if (
UserId != 0
    { 
        
int client GetClientOfUserId(UserId); 
        if (
client != 0
        { 
            
int team event.GetInt("team"); 
            if (
team == 2// joined to survivor 
                
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage); 
            else if (
event.GetInt("oldteam") == 2)
            {
                
SDKUnhook(clientSDKHook_OnTakeDamageOnTakeDamage); 
            } 
        } 
    } 


public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3]) 

    return 
Plugin_Handled;         

Confirm that in your game changing team triggers player_spawn. If changing teams triggers player_spawn, sdkhook or unhook accordingly.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 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 00:15.


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