Raised This Month: $ Target: $400
 0% 

logevent hook


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-14-2012 , 03:02   Re: logevent hook
Reply With Quote #6

Ok...I've been testing this for a while and it's really weird why it won't give the frags. Maybe one of y'all can see something i missed.

PHP Code:
// init
        // Thanks snow for these events in your Mod Points plugin. 
        //    http://forums.alliedmods.net/showthread.php?p=717780
    
register_event("SendAudio""event_CTvictory""a""2=%!MRAD_ctwin")
    
register_event("SendAudio""event_Tvictory""a""2=%!MRAD_terwin")

public 
event_CTvictory()
{
    
client_print(0print_chat"[BKF-CTvict] CTs won!")
    if(!
get_pcvar_num(toggle_pcvar) || !get_pcvar_num(frags_pcvar) || !get_pcvar_num(sc_pcvar))
        return     
PLUGIN_CONTINUE    
        
    
new players[32], num
    get_players
(playersnum"aceh""CT")

    for(new 
i=0idi<numi++)
    {
        
id players[i]
        
client_print(idprint_chat"YOU WON!")
        if(
g_bknuckles[id] && is_user_connected(id) )
            
giveFrags(id1"SC_WIN")
    }
    
    return 
PLUGIN_CONTINUE
}
public 
event_Tvictory()
{
    
client_print(0print_chat"[BKF-Tvic] Terrors win!")
    if(!
get_pcvar_num(toggle_pcvar) || !get_pcvar_num(frags_pcvar) || !get_pcvar_num(sc_pcvar))
        return 
PLUGIN_CONTINUE    
        
    
new players[32], num
    get_players
(playersnum"aceh""TERRORIST")
    
    for(new 
i=0,idi<numi++)
    {
        
id players[i]
        
client_print(idprint_chat"YOU WON!")
        if(
g_bknuckles[id] && is_user_connected(id) )
            
giveFrags(id1"SC_WIN")
    }
    
    return 
PLUGIN_CONTINUE
}
stock giveFrags(idpoints, const reason[]="NO_REASON")    // RETURNS: 1 if successful 0 if fail
{
    if(!
is_user_connected(id) || is_user_bot(id) || get_pcvar_num(frags_pcvar) == 0)
        return 
0
        
    
if(g_idPending[id])    // check if ID is pending: authorize accordingly
    
{
        new 
sid[32]; get_user_authid(idsidcharsmax(sid) )
        if( 
equali(sid"steam_id_pending") )
        {
            
client_print_color(idDontChange"[BKF] You are not currently authorized. No frags will be given.")
            return 
0
        
}
        else 
            
retrieveFrags(id)
    }
        
    new 
message[200]
    new 
crntLvl getLevel(id)  // get user's current level so we can see if they level up
    
    
gi_playerFrags[id]+= points  // give them the points. 
    
    
if(points 0)    // show message to reflect weather points are negative or positive
        
formatex(messagecharsmax(message), "%L %L (%L)"id"LOSE_FRAGS"abs(points), idreasonid"LEVEL"getLevel(id) )
    else
        
formatex(messagecharsmax(message), "%L %L (%L)"id"WIN_FRAGS"pointsidreasonid"LEVEL"getLevel(id) )
    
    
// if recieved frags for winning the round SC Mode is on; we want to reflect that
    
if(equal(reason"WIN_ROUND") )
        
client_print_color(idDontChange"[BKF-sc] %L %L"id"WIN_FRAGS"pointsidreason)
    else        
// display the message
        
client_print_color(idDontChange"[BKF] %s"message)
    
        
// SuperCharged mode's functionality
    
if(get_pcvar_num(sc_pcvar) == 1)
    {
        
gi_playerFrags[id]++
        
client_print_color(idDontChange"[BKF-sc] %L"id"SC_FRAG_MSG")
    }
    
        
// Announcement & check about levelup
    
if(crntLvl getLevel(id) && get_pcvar_num(printall_pcvar))
    {
        new 
sz_name[32]; get_user_name(idsz_namecharsmax(sz_name) )
        
client_print_color(0DontChange"[BKF] %L"LANG_PLAYER"LVL_UP_MSG"sz_namegetLevel(id) )
        
client_cmd(0LEVELUP_SOUND)
        
giveFrags(id1"LEVEL_UP")
    }
    return 
1

all client_print statements print properly, just not when it gets to giveFrags anyone see what i'm missing?
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 06-14-2012 at 03:03.
Liverwiz is offline
 



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 06:17.


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