Raised This Month: $ Target: $400
 0% 

shield touch and PLUGIN_HANDLE


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
sentoki
New Member
Join Date: Aug 2015
Old 09-10-2015 , 15:35   shield touch and PLUGIN_HANDLE
Reply With Quote #1

Hello, me again, I found that PLUGIN_CONTINUE allows further command execution and PLUGIN_HANDLED halts it. what i'm trying to do here is when player touch the shield(i want to try using shield as example for myself because after reading a few topics, I found out that shield is not registered as other items/weapons so it's more difficult), find if the player can touch it, if can,then allow pickup if no, don't let it pickup. however, no matter if player has rights to pick up shield or no, walking over shield does nothing as if player didn't have rights(with the excerpt of code i posted bellow) i tried moving things around but nothing works. if i remove all PLUGIN_HANDLED 's ,it lets pickup shield. it also doesn't print any of the messages i wrote to check if it's executed correctly. i also tried 0 instead of id in client_print thinking that id is not passed, but doesn't work either. am i using wrong method?
PHP Code:
<...>
#include <engine>
<...>
register_touch("weapon_shield""player""on_shield_touch")
<...>
public 
on_shield_touch(id){
    
    if((
get_user_flags(id) & VIP_FLAG) && vip_values_hp_or_money[id] == 7){
        
client_print(idprint_center"vip, value, working")
        return 
PLUGIN_CONTINUE
    
}
    if(
get_user_flags(id) & VIP_FLAG){
        if(
vip_values_hp_or_money[id] != 7){
            
client_print(idprint_chat"vip, wrong value, working")
            
            return 
PLUGIN_HANDLED
        
}
    }
    else if(!(
get_user_flags(id) & VIP_FLAG)){
        
client_print(idprint_center"not vip, working")
    
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE // removing this doesnt let pick shield at all ,with no messages. and as i understand i shouldn't delete it anyways

thank you
sentoki 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 22:12.


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