Raised This Month: $ Target: $400
 0% 

Menu "case" doesn't work.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reidark
Member
Join Date: Jan 2011
Old 04-18-2012 , 21:30   Menu "case" doesn't work.
Reply With Quote #1

I have this "case".

PHP Code:
        case 6:
        {
            
bhop(id)
        } 
And function bhop is:

PHP Code:
public bhop(id)
{
    new 
money cs_get_user_money(id);
    new 
cost get_pcvar_num(bhopcost);
    
    if(
money cost || money == cost
    {
        
cs_set_user_money(idmoney cost);
        
client_cmd(id"cmdBhopActive")
        
        
        
client_print(idprint_chat"[First DR] Voce comprou o bunnyhop!");
    } else {
        
client_print(idprint_chat"[First DR] Voce nao tem dinheiro suficiente!");
    }

But doesn't work!

Anyways, my plugin of bunnyhop is:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>

#define FL_WATERJUMP    (1<<11)
#define FL_ONGROUND     (1<<9)

new g_has_bhop[33]

public 
plugin_init()
{
    
register_clcmd("bunnyserver" ,"cmdBhopActive")
    
register_clcmd("bunnyserver2" ,"cmdBhopDesactive")
}

public 
cmdBhopActive(id)
{
        if(
g_has_bhop[id])
        {
                
g_has_bhop[id]=0
                
return PLUGIN_HANDLED
        
}
      
        return 
PLUGIN_HANDLED
}

public 
cmdBhopDesactive(id)
{
        if(!
g_has_bhop[id])
        {
                
g_has_bhop[id]=1
                
return PLUGIN_HANDLED
        
}

        return 
PLUGIN_HANDLED
}

public 
client_PreThink(id
{
        if(!
g_has_bhop[id])
                return 
PLUGIN_CONTINUE
        
        entity_set_float
(idEV_FL_fuser20.0)
        
        if(
entity_get_int(idEV_INT_button) & 2
        {
                new 
flags entity_get_int(idEV_INT_flags)
                
                if(
flags FL_WATERJUMP)
                {
                        return 
PLUGIN_CONTINUE
                
}
                
                if(
entity_get_int(idEV_INT_waterlevel) >= 2)
                {
                        return 
PLUGIN_CONTINUE
                
}
                
                if(!(
flags FL_ONGROUND))
                {
                        return 
PLUGIN_CONTINUE
                
}
                
                new 
Float:velocity[3]
                
entity_get_vector(idEV_VEC_velocityvelocity)
                
velocity[2] += 250.0
                entity_set_vector
(idEV_VEC_velocityvelocity)
                
                
entity_set_int(idEV_INT_gaitsequence6)
        }
        return 
PLUGIN_CONTINUE

Pls, i need help!
reidark is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 04-18-2012 , 21:47   Re: Menu "case" doesn't work.
Reply With Quote #2

client_cmd(id, "cmdBhopActive")

client_cmd(id, "cmdBhopDesactive")
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
reidark
Member
Join Date: Jan 2011
Old 04-18-2012 , 22:18   Re: Menu "case" doesn't work.
Reply With Quote #3

PHP Code:
public bhop(id)
{
    new 
money cs_get_user_money(id);
    new 
cost get_pcvar_num(bhopcost);
    
    if(
money cost || money == cost
    {
        
cs_set_user_money(idmoney cost);
        
client_cmd(id"cmdBhopDesactive")
        
        
        
client_print(idprint_chat"[First DR] Voce comprou o bunnyhop!");
    } else {
        
client_print(idprint_chat"[First DR] Voce nao tem dinheiro suficiente!");
    }

rak, i try this, but doesn't work too.
Pls, help me!
reidark is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-19-2012 , 00:33   Re: Menu "case" doesn't work.
Reply With Quote #4

You can't access an internal function of another plugin like that. You have to use the same thing that the client would normally type (aka "bunnyserver").

Quote:
Originally Posted by rak View Post
client_cmd(id, "cmdBhopActive")

client_cmd(id, "cmdBhopDesactive")
That doesn't even make sense. If that would have worked then it would have worked completely wrong. It seems you rarely know what you are saying.
__________________

Last edited by fysiks; 04-19-2012 at 00:35.
fysiks is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 04-19-2012 , 03:21   Re: Menu "case" doesn't work.
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
You can't access an internal function of another plugin like that. You have to use the same thing that the client would normally type (aka "bunnyserver").



That doesn't even make sense. If that would have worked then it would have worked completely wrong. It seems you rarely know what you are saying.
i see wrong.. and you are wrong.. is bunnyserver2
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 04-19-2012 , 03:52   Re: Menu "case" doesn't work.
Reply With Quote #6

Quote:
Originally Posted by rak View Post
i see wrong.. and you are wrong.. is bunnyserver2
Nope, it's "bunnyserver" because the player is supposed to activate the bhop, not deactivate it.
PHP Code:
    // If the player has ENOUGH money to get bhop
    
if(money cost || money == cost
    {
        
cs_set_user_money(idmoney cost);

        
// ACTIVATE bhop
        
client_cmd(id"bunnyserver"
That's not the best way to do things, though. Better would be to directly call
PHP Code:
        //client_cmd(id, "bunnyserver")
        
cmdBhopActive(id); 
And you're removing player's money even if he already has bhop.

Last edited by hleV; 04-19-2012 at 03:56.
hleV is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 04-19-2012 , 08:12   Re: Menu "case" doesn't work.
Reply With Quote #7

Quote:
Originally Posted by hleV View Post
Nope, it's "bunnyserver" because the player is supposed to activate the bhop, not deactivate it.
PHP Code:
    // If the player has ENOUGH money to get bhop
    
if(money cost || money == cost
    {
        
cs_set_user_money(idmoney cost);

        
// ACTIVATE bhop
        
client_cmd(id"bunnyserver"
That's not the best way to do things, though. Better would be to directly call
PHP Code:
        //client_cmd(id, "bunnyserver")
        
cmdBhopActive(id); 
And you're removing player's money even if he already has bhop.
PHP Code:
register_clcmd("bunnyserver2" ,"cmdBhopDesactive"
PHP Code:
public cmdBhopDesactive(id)
{
        if(!
g_has_bhop[id])
        {
                
g_has_bhop[id]=1
                
return PLUGIN_HANDLED
        
}

        return 
PLUGIN_HANDLED
}

public 
client_PreThink(id
{
        if(!
g_has_bhop[id])
                return 
PLUGIN_CONTINUE
        
        entity_set_float
(idEV_FL_fuser20.0)
        
        if(
entity_get_int(idEV_INT_button) & 2
        {
                new 
flags entity_get_int(idEV_INT_flags)
                
                if(
flags FL_WATERJUMP)
                {
                        return 
PLUGIN_CONTINUE
                
}
                
                if(
entity_get_int(idEV_INT_waterlevel) >= 2)
                {
                        return 
PLUGIN_CONTINUE
                
}
                
                if(!(
flags FL_ONGROUND))
                {
                        return 
PLUGIN_CONTINUE
                
}
                
                new 
Float:velocity[3]
                
entity_get_vector(idEV_VEC_velocityvelocity)
                
velocity[2] += 250.0
                entity_set_vector
(idEV_VEC_velocityvelocity)
                
                
entity_set_int(idEV_INT_gaitsequence6)
        }
        return 
PLUGIN_CONTINUE

__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
reidark
Member
Join Date: Jan 2011
Old 04-19-2012 , 19:04   Re: Menu "case" doesn't work.
Reply With Quote #8

Thank guys, but who is right is: rak
I tried this:
PHP Code:
client_cmd(id"bunnyserver2"
And works!
THANKS!
</span>
reidark is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-19-2012 , 21:48   Re: Menu "case" doesn't work.
Reply With Quote #9

Quote:
Originally Posted by reidark View Post
Thank guys, but who is right is: rak
I tried this:
PHP Code:
client_cmd(id"bunnyserver2"
And works!
THANKS!
</span>
According to your first post, he is wrong!
__________________
fysiks is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 04-19-2012 , 21:51   Re: Menu "case" doesn't work.
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
According to your first post, he is wrong!
nop; he put bad the names; nothing more
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
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 07:54.


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