Raised This Month: $ Target: $400
 0% 

Hamsandwich Forward, Return values


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
t3hNox
Senior Member
Join Date: Oct 2009
Old 06-14-2010 , 11:31   Hamsandwich Forward, Return values
Reply With Quote #1

Hi.
I've never worked with hamsandwich module before. Basically I'm making a plugin that would block Ts from clicking any button if IsFreeRun is "true", however, CTs would be still able to use them (no matter the IsFreeRun value).
The code is mainly taken from another plugin - Use Button Once.

PHP Code:
public plugin_init() {
//     ...code...
    
if( engfunc(EngFunc_FindEntityByString,-,"classname""func_button"))
        
RegisterHam(Ham_Use"func_button""fwButtonUsed");

    if(
engfunc(EngFunc_FindEntityByString,-,"classname","func_rot_button"))
        
RegisterHam(Ham_Use"func_rot_button""fwButtonUsed");
        
    if(
engfunc(EngFunc_FindEntityByString,-,"classname""button_target"))
        
RegisterHam(Ham_Use"button_target""fwButtonUsed");
}

//The function.. I know it's not the best way to use IFs
public fwButtonUsed(idcaller) {
    if(
IsFreeRun == true && get_user_team(idcaller) == 1) {
        return 
HAM_SUPERCEDE;
    }
    if(
IsFreeRun == true && get_user_team(idcaller) == 2) {
        return 
FMRES_IGNORED;
    }
    return 
PLUGIN_HANDLED;

Not the full code (obviously), only the part that is not working, plugin completes fine - no errors. However, that button clicking thing is not working. Either no one can click them or buttons are usable no matter the IsFreeRun value.
Currently I'm not really interested in any optimizations (if any is possible), I just need to get the code to work.
t3hNox 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 14:57.


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