Raised This Month: $ Target: $400
 0% 

PreThink BUG!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Veggetta
Member
Join Date: Mar 2008
Location: Portugal
Old 07-08-2012 , 12:25   PreThink BUG!
Reply With Quote #1

PHP Code:
public fwPrethink(id)
{
    if(
cs_get_user_team(id) & CS_TEAM_T)
        return 
PLUGIN_CONTINUE;
        
    if(
get_user_button(id) == IN_ATTACK2)
    {
        if(
KitMedico[id] < 1)
        {
            
ColorChat(id"^x04[Nitro-Team.com]^x01 Ja usou o seu^x03 KitMedico^x01, espere ate receber novamente.");
            return 
PLUGIN_CONTINUE;
        }
        
KitMedico[id]--;
        
set_task(6.0"UsarKitMedico"id);
        
Fazer_BarraTempo(id6);
    }
    return 
PLUGIN_CONTINUE;

In game, when i push Mouse2. The plugin sends me a lot of phrases of that ColorChat instead of just 1. :s
PS: if you want it in English just say

Last edited by Veggetta; 07-08-2012 at 12:27.
Veggetta is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-08-2012 , 14:48   Re: PreThink BUG!
Reply With Quote #2

Try this:
PHP Code:
register_forwardFM_CmdStart "fw_CmdStart" );

public 
fw_CmdStartid uc_handle seed )
{
    if ( 
cs_get_user_teamid ) == CS_TEAM_T )
        return 
PLUGIN_CONTINUE;
        
    static 
iButtons iOldButtons;
    
    
iButtons get_ucuc_handle UC_Buttons );
    
iOldButtons pevid pev_oldbuttons );
    
    if ( ( 
iButtons IN_ATTACK2 ) && !( iOldButtons IN_ATTACK2 ) && !task_existsid ) )
    {
        if( 
KitMedico[id] < 1)
        {
            
ColorChat(id"^x04[Nitro-Team.com]^x01 Ja usou o seu^x03 KitMedico^x01, espere ate receber novamente.");
            return 
PLUGIN_CONTINUE;
        }
        
        
KitMedico[id]--;
        
set_task(6.0"UsarKitMedico"id);
        
Fazer_BarraTempo(id6);
    }
    
    return 
PLUGIN_CONTINUE;

__________________
Bugsy is offline
Veggetta
Member
Join Date: Mar 2008
Location: Portugal
Old 07-08-2012 , 15:03   Re: PreThink BUG!
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Try this:
PHP Code:
public fw_CmdStartid uc_handle seed 
It's getting a lot's of erros in there.
I think it's because of the "seed"

"Error: Invalid expression, assumed zero on line ..."
"Error: Undefined symbol "fw_CmdStart" on line ..."
"Error: Undefined symbol "seed" on line ..."
"Error: Too many error messages on one line on line ..."

Last edited by Veggetta; 07-08-2012 at 15:06.
Veggetta is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-08-2012 , 15:14   Re: PreThink BUG!
Reply With Quote #4

Compiles fine for me.. did you include fakemeta?
__________________
Bugsy is offline
Veggetta
Member
Join Date: Mar 2008
Location: Portugal
Old 07-08-2012 , 15:20   Re: PreThink BUG!
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
Compiles fine for me.. did you include fakemeta?
Yes i have fakemeta and fakemeta_util..
I can't see the problem :s
Veggetta is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-08-2012 , 15:21   Re: PreThink BUG!
Reply With Quote #6

Post or pm me your whole code.
__________________
Bugsy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-08-2012 , 15:21   Re: PreThink BUG!
Reply With Quote #7

Post the WHOLE code as an attachment.
__________________
fysiks is offline
Veggetta
Member
Join Date: Mar 2008
Location: Portugal
Old 07-08-2012 , 15:27   Re: PreThink BUG!
Reply With Quote #8

Sorry guy's. I found the problem, i didn't close a } in the code.
Thank you for your attention

Last edited by Veggetta; 07-08-2012 at 15:27.
Veggetta is offline
Veggetta
Member
Join Date: Mar 2008
Location: Portugal
Old 07-08-2012 , 15:53   Re: PreThink BUG!
Reply With Quote #9

PHP Code:
    if ( ( iButtons IN_ATTACK2 ) && !( iOldButtons IN_ATTACK2 ) && !task_existsid ) )
    {
        if( 
KitMedico[id] < 1)
        {
            
ColorChat(id"^x04[Nitro-Team.com]^x01 Ja usou o seu^x03 KitMedico^x01, espere ate receber novamente.");
            return 
PLUGIN_CONTINUE;
        }
        
        
KitMedico[id]--;
        
set_task(6.0"UsarKitMedico"id);
        
Fazer_BarraTempo(id6);
    }
    
    return 
PLUGIN_CONTINUE;

I've change the "if" to "while", because i want to a player, when is pushing MOUSE2 (attack2), it gives the task "UsarKitMedico" and "Fazer_BarraTempo", but when the player release the button, i want to the tasks stop.
Is possible ?

Last edited by Veggetta; 07-08-2012 at 15:54.
Veggetta is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-08-2012 , 16:07   Re: PreThink BUG!
Reply With Quote #10

This will keep setting tasks for the 6 second interval, and will only chat one time per press\hold-down.
PHP Code:
public fw_CmdStartid uc_handle seed )
{
    if ( 
cs_get_user_teamid ) == CS_TEAM_T )
        return 
PLUGIN_CONTINUE;
        
    static 
iButtons iOldButtons;
    
    
iButtons get_ucuc_handle UC_Buttons );
    
    if ( 
iButtons IN_ATTACK2 )
    {
        
iOldButtons pevid pev_oldbuttons );
        
        if ( ( 
KitMedico[id] < ) && !( iOldButtons IN_ATTACK2 ) )
        {
            
ColorChat(id"^x04[Nitro-Team.com]^x01 Ja usou o seu^x03 KitMedico^x01, espere ate receber novamente.");
            return 
PLUGIN_CONTINUE;
        }
        
        
KitMedico[id]--;
        
set_task(6.0"UsarKitMedico"id);
        
Fazer_BarraTempo(id6);
    }
    
    return 
PLUGIN_CONTINUE;

__________________

Last edited by Bugsy; 07-08-2012 at 16:08.
Bugsy 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 15:14.


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