Raised This Month: $ Target: $400
 0% 

What the fuck is wrong here?? [no errors]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RuleBreaker
Senior Member
Join Date: May 2011
Old 10-23-2011 , 16:48   What the fuck is wrong here?? [no errors]
Reply With Quote #1

I tooked code from this plugin to test something:
http://forums.alliedmods.net/showthread.php?p=1038382

And now when I want to send money it doesn`t work:
PHP Code:
money(idsay[]) {
    new 
amount str_to_num(say)
    new 
victim gidPlayer[id]
    
ColorChat(idTEAM_COLOR,"[^4BCG^3] Test")
    if( 
victim ) {
        
ColorChat(idTEAM_COLOR,"[^4BCG^3] Test2")
        new 
name[32], vname[32]
        new 
idMoney cs_get_user_money(id)
        
        
get_user_name(idnamecharsmax(name))
        
get_user_name(victimvname31)
        
        if(
amount idMoney)
        {
            
ColorChat(idTEAM_COLOR,"[^4BCG^3] Tes3")
            
ColorChat(idTEAM_COLOR,"[^4BCG^3] Nemas dovoljno para!")
            
client_cmd(id"messagemode playermoney")
            return 
PLUGIN_HANDLED
        
}
        else {
            
ColorChat(idTEAM_COLOR,"[^4BCG^3] Test5")
            
cs_set_user_money(idcs_get_user_money(id) - amount)
            
cs_set_user_money(victimcs_get_user_money(victim) + amount)
            
            
ColorChat(idTEAM_COLOR,"[^4BCG^3] Poslao si mu %d$ ((%s))",amountvname)
            
ColorChat(victimTEAM_COLOR,"[^4BCG^3] %s ti je poslao %d$",nameamount)
        }
        
openmenu[id] = false
    
}
    else {
        
ColorChat(idTEAM_COLOR,"[^4BCG^3] Test6")
        return 
PLUGIN_HANDLED
    
}
    
ColorChat(idTEAM_COLOR,"[^4BCG^3] Test10")
    
    return 
PLUGIN_HANDLED

Note: I added these few prints so I can know where`s to problem and probles is with "if( victim > 0 )". Plugins skips that part like victim isn`t > 0. Vistims is victims's id...
RuleBreaker is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-23-2011 , 17:26   Re: What the fuck is wrong here?? [no errors]
Reply With Quote #2

Show where gidPlayer[ id ] is assigned a value. Relax with the foul language too, we are mostly friendly here.
__________________

Last edited by Bugsy; 10-23-2011 at 17:27.
Bugsy is offline
e12harry
Member
Join Date: Apr 2010
Old 10-24-2011 , 08:43   Re: What the fuck is wrong here?? [no errors]
Reply With Quote #3

I am not sure if gidPlayer[ id ] is set correctly:
In
PHP Code:
public GiveMoneyHandler(idwMenuitem
there is:
PHP Code:
new key str_to_num(Data
gidPlayer[key] = id 
shouldn't it be :
PHP Code:
new key str_to_num(Data)
gidPlayer[id] = key 
e12harry 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 00:33.


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