Raised This Month: $ Target: $400
 0% 

[SOLVED] Unknown problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-22-2011 , 02:32   [SOLVED] Unknown problem
Reply With Quote #1

hi,

i am rewriting catchmod and have a problem with turbotask.
i dont know how to explain the problem. i will try to show it witch code.

for first the full code :
Code:
/*
TODO LIST

render cvars
Turbo mods
in public User_has_turbo_ON(id)  status refreshen

*/
/*
DID LIST



*/

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <engine>
#include <amxmisc>
#include <fun>

#define PLUGIN "Catchmod Black Edition"
#define VERSION "1.0.1"
#define AUTHOR "Dr.One"

/*
MAIN HANDELS
*/
new round_counter = 1
new CSTS_ARE_CATCHER = 1
new user_is_catcher[33]
new Catcher_Color_R = 255
new Catcher_Color_G = 0
new Catcher_Color_B = 0
new FLEER_Color_R = 0
new FLEER_Color_G = 255
new FLEER_Color_B = 0
new TURBO[33][2]
new E_MaxPlayers
new chilldown[33]
/*
CVARS
*/
new CV_catchers_speed
new CV_Bonnyhop
new CV_Turbo_Usage_Percent
new CV_Turbo_Usage_Time
new CV_Catch_speed
new CV_Catch_fleer_speed
new CV_Catch_Turbo_speed

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_logevent("newRound",2,"0=World triggered", "1=Round_Start")
    RegisterHam( Ham_Spawn, "player","Players_Spawn",1)
    register_event("ResetHUD","resethud","be")
    set_task(3.0,"Show_Stats",6000,"",0,"ab")
    register_touch("player","player","touch")
    E_MaxPlayers = get_maxplayers()
    /*
    CVARS
    */
    CV_catchers_speed = register_cvar("amx_catch_catchers_speed","1.0")
    CV_Bonnyhop = register_cvar("amx_catch_bunnyhop","1")
    CV_Turbo_Usage_Percent = register_cvar("amx_catch_turbo_percent","10")
    CV_Turbo_Usage_Time = register_cvar("amx_catch_turbo_usage_time","0.25")
    CV_Catch_speed = register_cvar("amx_catch_speed","2.0")
    CV_Catch_fleer_speed = register_cvar("amx_catch_fleer_speed","1.0")
    CV_Catch_Turbo_speed = register_cvar("amx_catch_turbo_speed","1.5")
}
public newRound()
{
    if(round_counter)
    {
        CSTS_ARE_CATCHER = 1
        round_counter = 0
    }
    else if(!round_counter)
    {
        CSTS_ARE_CATCHER = 0
        round_counter = 1
    }
    for(new i=1;i<E_MaxPlayers;i++) {
    reset_stats(i)
    }
}
public reset_stats(id)
{
    TURBO[id][0] = 0
    TURBO[id][1] = 10000
}
public touch(pToucher, pTouched)
{
    if(pToucher > 0 && pToucher < 33 && is_user_alive(pToucher) && user_is_catcher[pToucher]) 
    {
            if (pTouched > 0 && pTouched < 33 && is_user_alive(pTouched) && !user_is_catcher[pTouched]) 
            {                
                new team = get_user_team(pToucher)
                //if(team == 1)
                    //points[0]++
                //else
                    //points[1]++
                
                //set_msg_block(deathMsg,BLOCK_ONCE) 
                //set_msg_block(scoreMsg,BLOCK_ONCE)
                user_silentkill(pTouched)
                make_deathmsg(pToucher,pTouched,0,"his hands")
                
                //entity_set_float(pToucher,EV_FL_frags,float(score[pToucher-1][0]+(score[pToucher-1][3]*UEBERLEBEN)))    
                //apply_scoreboard(pToucher)
                //apply_scoreboard(pTouched)
                
                //update_teamscore()
                
                //if(other_num() == 1)
                speed()
            }
    }
}
public speed() {
    for(new i=1;i<33;i++)
        if(is_user_alive(i))
            Speed_settings(i)
}
public Players_Spawn(id)
{
    if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
    {
        if(CSTS_ARE_CATCHER)
        {
            user_is_catcher[id] = 1
            Speed_settings(id)
            strip_user_weapons(id)
            give_item(id,"weapon_knife")
        }
        else
        {
            user_is_catcher[id] = 0
            Speed_settings(id) 
            strip_user_weapons(id)
            give_item(id,"weapon_knife")
        }
    }
    else if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T)
    {
        if(!CSTS_ARE_CATCHER)
        {
            user_is_catcher[id] = 1
            set_rendering(id,kRenderFxGlowShell,Catcher_Color_R,Catcher_Color_G,Catcher_Color_B,kRenderNormal,125)
            Speed_settings(id) 
            strip_user_weapons(id)
            give_item(id,"weapon_knife")
        }
        else
        {
            user_is_catcher[id] = 0
            set_rendering(id,kRenderFxGlowShell,FLEER_Color_R,FLEER_Color_G,FLEER_Color_B,kRenderNormal,125)
            Speed_settings(id) 
            strip_user_weapons(id)
            give_item(id,"weapon_knife")
        }
    }
    else
    {
        set_rendering(id)
    }
}
public client_PreThink(id)
{
    new buttons = get_user_button(id)
    if(get_pcvar_num(CV_Bonnyhop) == 1) 
    {
        if(buttons & IN_JUMP) 
        {
            new flags = entity_get_int(id, EV_INT_flags)
            
            if(flags|FL_WATERJUMP && entity_get_int(id,EV_INT_waterlevel)<2 && flags&FL_ONGROUND) 
            {
                new Float:velocity[3]
                get_user_velocity(id,velocity)
                velocity[2] += 250.0
                set_user_velocity(id,velocity)
                entity_set_int(id, EV_INT_gaitsequence, 6)
            }
        }
    }
    
    if(buttons & IN_ATTACK2)
    {
        if(TURBO[id][0] == 0 && TURBO[id][1] >= get_pcvar_num(CV_Turbo_Usage_Percent))
        {
            User_has_turbo_ON(id)
        }
        else if(TURBO[id][0] == 1)
        {
            User_has_turbo_OFF(id)
        }
    }
}
public User_has_turbo_ON(id) 
{
    if(is_user_alive(id) && !user_is_catcher[id]) 
    {
        if(TURBO[id][1] < get_pcvar_num(CV_Turbo_Usage_Percent)) 
        {
            TURBO[id][0] = 0
            Speed_settings(id) 
        }
        else if(!chilldown[id])
        {
            TURBO[id][0] = 1
            TURBO[id][1] -= get_pcvar_num(CV_Turbo_Usage_Percent)
            Speed_settings(id) 
            set_task(get_pcvar_float(CV_Turbo_Usage_Time),"turbo_task",id)
            chilldown[id] = 1
        }
        Player_Show_Stats(id)
    }
}
public User_has_turbo_OFF(id) 
{
    if(TURBO[id][0] == 1) 
    {
        TURBO[id][0] = 0
        Speed_settings(id) 
        remove_task(id+10000)
        Player_Show_Stats(id)
    }
}
public Speed_settings(id)  
{
    new Float:speed
    
    if(!user_is_catcher[id])
    {
        speed = 320.0 * get_pcvar_float(CV_Catch_speed) * get_pcvar_float(CV_Catch_fleer_speed)
    }
    else 
    {
        speed = 320.0 * get_pcvar_float(CV_Catch_speed) * get_pcvar_float(CV_catchers_speed)
    }
    
    if(TURBO[id][0] == 1)
    {
        speed *= get_pcvar_float(CV_Catch_Turbo_speed)
    }
    set_user_maxspeed(id,speed)
}
public resethud(id)
{
    set_task(0.1,"apply",id)
}
public apply(id)
{
    Speed_settings(id)
}
public Show_Stats() 
{
    for(new id=1;id <= E_MaxPlayers;id++) 
    {
        if(is_user_connected(id) && is_user_alive(id)) 
        {
            Player_Show_Stats(id)
        }
    }
}
public Player_Show_Stats(id) 
{
    new teams[32], turbos[32]
    if(!user_is_catcher[id]) 
    {
        set_hudmessage(FLEER_Color_R,FLEER_Color_G,FLEER_Color_B,0.02,0.25,0,0.1,5.0,0.0,0.0)
        copy(teams,127,"You´r a FLEER..")
        
        if(TURBO[id][1] >= get_pcvar_num(CV_Turbo_Usage_Percent))
        {
            format(turbos,31,"^n%sTurbo: [===|===] %d%",TURBO[id][0] == 1 ? "+" : "-",TURBO[id][1])
        }
        else if(TURBO[id][1] <= get_pcvar_num(CV_Turbo_Usage_Percent))
        {
            format(turbos,31,"^nTurbo: [|||||||] OFF")
        }
    }
    else if(user_is_catcher[id]) 
    {
        set_hudmessage(Catcher_Color_R,Catcher_Color_G,Catcher_Color_B,0.02,0.25,0,0.1,5.0,0.0,0.0)
        copy(teams,127,"You have to CATCH,Go ,Go ,Go...")
    }
    show_hudmessage(id,"%s %s",teams,turbos)
}
public turbo_task(id) 
{
    if(is_user_alive(id)) 
    {
        if(!user_is_catcher[id] && TURBO[id][0] == 1) 
        {
            if(TURBO[id][1] < get_pcvar_num(CV_Turbo_Usage_Percent)) 
            {
                    TURBO[id][0] = 0
                    Speed_settings(id) 
                    Player_Show_Stats(id)
                    client_print(id,print_chat,"test1")
            }
            else 
            {
                    TURBO[id][1] -= get_pcvar_num(CV_Turbo_Usage_Percent)
                    Player_Show_Stats(id)
                    client_print(id,print_chat,"test2")
            }
        }
        else 
        {
                TURBO[id][0] = 0
                Player_Show_Stats(id)
                Speed_settings(id)
                client_print(id,print_chat,"test3")
                
        }
    }
    else 
    {
        TURBO[id][0] = 0
        client_print(id,print_chat,"test4")
        
    }
    chilldown[id] = 0
}
problem part :
Code:
public User_has_turbo_ON(id) 
{
    if(is_user_alive(id) && !user_is_catcher[id]) 
    {
        if(TURBO[id][1] < get_pcvar_num(CV_Turbo_Usage_Percent)) 
        {
            TURBO[id][0] = 0
            Speed_settings(id) 
        }
        else if(!chilldown[id])
        {
            TURBO[id][0] = 1
            TURBO[id][1] -= get_pcvar_num(CV_Turbo_Usage_Percent)
            Speed_settings(id) 
            set_task(get_pcvar_float(CV_Turbo_Usage_Time),"turbo_task",id)
            chilldown[id] = 1
        }
        Player_Show_Stats(id)
    }
}
and

Code:
public turbo_task(id) 
{
    if(is_user_alive(id)) 
    {
        if(!user_is_catcher[id] && TURBO[id][0] == 1) 
        {
            if(TURBO[id][1] < get_pcvar_num(CV_Turbo_Usage_Percent)) 
            {
                    TURBO[id][0] = 0
                    Speed_settings(id) 
                    Player_Show_Stats(id)
                    client_print(id,print_chat,"test1")
            }
            else 
            {
                    TURBO[id][1] -= get_pcvar_num(CV_Turbo_Usage_Percent)
                    Player_Show_Stats(id)
                    client_print(id,print_chat,"test2")
            }
        }
        else 
        {
                TURBO[id][0] = 0
                Player_Show_Stats(id)
                Speed_settings(id)
                client_print(id,print_chat,"test3")
                
        }
    }
    else 
    {
        TURBO[id][0] = 0        
    }
    chilldown[id] = 0
}
so the problem is when i use turbo i get only the debug message test3 .

in my turbo_task function i just ask if my user is a fleer and if is the turbo[id][0] == 1.

this should give me a true resault.
i am sure my user is a FLEER and i set his turbo[id][0] on 1 ( see :
Code:
 else if(!chilldown[id])
        {
            TURBO[id][0] = 1
            TURBO[id][1] -= get_pcvar_num(CV_Turbo_Usage_Percent)
            Speed_settings(id) 
            set_task(get_pcvar_float(CV_Turbo_Usage_Time),"turbo_task",id)
            chilldown[id] = 1
        }
)

i dont understand why this gives me wrong resault
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
 



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 14:36.


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