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

Garbage code help trigger


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
uraganas
Member
Join Date: Feb 2016
Location: Lithuania
Old 06-10-2017 , 11:25   Garbage code help trigger
Reply With Quote #1

Guys why it's not triggering the first ones but its triggering the CheckPoints without catching the headshot or grenade. it should ignore the checkpoints.

PHP Code:
public PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    
g_bKm_enabled GetConVarBool(g_hKm_enabled);    
    new 
userId GetEventInt(event"userid"); 
    new 
attackerId GetEventInt(event"attacker");
    new 
attacker GetClientOfUserId(attackerId);
    new 
victim GetClientOfUserId(userId); 
    
    if(
IsValidClient(victim) && (g_bKm_enabled)){
        new 
String:weapon[32];
        
GetEventString(event"weapon",weaponsizeof(weapon));
        if(
StrEqual(weapon,"hegrenade")){
            if(
IsValidClient(attacker)){
                if(
g_bClientPrefSounds[attacker]){
                    
EmitSoundToClientAny(attacker"Km/crossfire/Grenadekill_GR.mp3");
                }
                if(
g_bClientPrefOverlays[attacker]){
                    
SetClientOverlay(attacker"event_overlay/balticon/badge_grenade");
                }
                
CreateTimer(2.0DeleteOverlayattacker);
            }        
        }
        if(
strncmp(weapon"knife"5) == 0){
            if(
IsValidClient(attacker)){
                if(
g_bClientPrefSounds[attacker]){
                    
EmitSoundToClientAny(attacker"Km/crossfire/Grenadekill_GR.mp3");
                }
                if(
g_bClientPrefOverlays[attacker]){
                    
SetClientOverlay(attacker"event_overlay/balticon/badge_knife");
                }
                
CreateTimer(2.0DeleteOverlayattacker);
            }        
        }
        if (
GetEventBool(event"headshot") && IsValidClient(victim)){
            if(
IsValidClient(attacker)){
                if(
g_bClientPrefSounds[attacker]){
                    
EmitSoundToClientAny(attacker"Km/crossfire/Headshot_GR.mp3");
                }
                if(
g_bClientPrefOverlays[attacker]){
                    
SetClientOverlay(attacker"event_overlay/balticon/badge_headshot");
                }
                
CreateTimer(2.0DeleteOverlayattacker);
            }
        }
        
g_hPoints[victim] = 0;
        if(
IsValidClient(attacker))
            
g_hPoints[attacker] += 1;
            
CheckPoints(attacker);
            
//PrintToConsole(attacker, " %d",g_hPoints[attacker]);
            
CreateTimer(2.0DeleteOverlayattacker);
        }
        if (
attacker == victim){
            if(
IsValidClient(victim)){
                if(
g_bClientPrefSounds[attacker]){
                    
EmitSoundToClientAny(victim"Km/crossfire/lopas.mp3");
                }
                if(
g_bClientPrefOverlays[attacker]){
                    
SetClientOverlay(victim"event_overlay/balticon/lopas");
                }
                
CreateTimer(2.0DeleteOverlayvictim);
                
g_hPoints[victim] = 0;
                
g_hPoints[attacker] = 0;
            }
        }
    }

uraganas is offline
B3none
AlliedModders Donor
Join Date: Oct 2016
Location: United Kingdom
Old 06-13-2017 , 16:43   Re: Garbage code help trigger
Reply With Quote #2

My oh my, that is a clusterfuck, have you tried debugging it yourself first to find exactly where the problem is instead of just posting the entire function and expecting us to instantly figure it out? FYI i'd be happy to help you just need to do atleast some of the work yourself!
__________________
B3none is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-13-2017 , 18:57   Re: Garbage code help trigger
Reply With Quote #3

The code is missing braces and not indented correctly...

Gg
__________________
Neuro Toxin 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 02:23.


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