Raised This Month: $51 Target: $400
 12% 

Forwards didn't switch off


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 03-27-2015 , 17:48   Forwards didn't switch off
Reply With Quote #1

Function with forwards looks like this:
PHP Code:
SetForwards(bool:bState) {
    if(
bState) {
        if(
hamForwards[0]) EnableHamForward(hamForwards[0]);
        else {
            for(new 
isizeof iBlockUseButtoni++) hamForwards[0] = RegisterHam(Ham_UseiBlockUseButton[i], "BlockUseButton");
        }

        if(
hamForwards[1]) EnableHamForward(hamForwards[1]);
        else {
            for(new 
isizeof iBlockUseHealthi++) hamForwards[1] = RegisterHam(Ham_UseiBlockUseHealth[i], "BlockUseHealth");
        }

        if(
hamForwards[2]) EnableHamForward(hamForwards[2]);
        else {
            for(new 
isizeof iBlockTouchGuni++) hamForwards[2] = RegisterHam(Ham_TouchiBlockTouchGun[i], "BlockTouchGun");
        }

        if(
hamForwards[3]) EnableHamForward(hamForwards[3]);
        else 
hamForwards[3] = RegisterHam(Ham_Touch"trigger_hurt""BlockTouchHealth");

        if(
hamForwards[4]) EnableHamForward(hamForwards[4]);
        else 
hamForwards[4] = RegisterHam(Ham_TakeDamage"player""BlockTakeDamage");

        if(
hamForwards[5]) EnableHamForward(hamForwards[5]);
        else 
hamForwards[5] = RegisterHam(Ham_TraceAttack"player""BlockTraceAttack");

        
msgRadar register_message(112"RadarBlock");
    } else {
        if(
hamForwards[0]) DisableHamForward(hamForwards[0]);
        if(
hamForwards[1]) DisableHamForward(hamForwards[1]);
        if(
hamForwards[2]) DisableHamForward(hamForwards[2]);
        if(
hamForwards[3]) DisableHamForward(hamForwards[3]);
        if(
hamForwards[4]) DisableHamForward(hamForwards[4]);
        if(
hamForwards[5]) DisableHamForward(hamForwards[5]);

        if(
msgRadar) {
            
unregister_message(112msgRadar);
            
msgRadar 0;
        }
    }

and when I want to turn off the forwards they will not switch off
PHP Code:
SetForwards(false); 

Last edited by OnePL; 03-27-2015 at 18:44.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 03-28-2015 , 09:02   Re: Forwards didn't switch off
Reply With Quote #2

How do you expect to turn off all of them, if you keep reassigning your hamForwards array?
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 03-28-2015 , 17:06   Re: Forwards didn't switch off
Reply With Quote #3

Simplified English, please
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 03-29-2015 , 05:11   Re: Forwards didn't switch off
Reply With Quote #4

PHP Code:
if(hamForwards[1])
  
EnableHamForward(hamForwards[1]);
else
{
  
hamForwards[1] = RegisterHam(Ham_UseiBlockUseHealth[0], "BlockUseHealth");
  
hamForwards[1] = RegisterHam(Ham_UseiBlockUseHealth[1], "BlockUseHealth");
  
hamForwards[1] = RegisterHam(Ham_UseiBlockUseHealth[2], "BlockUseHealth");
  
hamForwards[1] = RegisterHam(Ham_UseiBlockUseHealth[3], "BlockUseHealth");
  
hamForwards[1] = RegisterHam(Ham_UseiBlockUseHealth[4], "BlockUseHealth");

Simplified pawn. If you don't see problem, then
PHP Code:
DisableHamForward(hamForwards[1]) 
will only block this:
PHP Code:
iBlockUseHealth[4
If you wish to block all of them(obviously):
PHP Code:
if(hamForwards[1])
  
EnableHamForward(hamForwards[1]);
else
{
  for(new 
isizeof iBlockUseHealthi++)
    
hamForwards[1][i] = RegisterHam(Ham_UseiBlockUseHealth[i], "BlockUseHealth");

you need to add another dimension to array:
PHP Code:
new hamForwards[DIFFERENT_BLOCKS][DIFFERENT_HAMS
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 03-29-2015 , 06:08   Re: Forwards didn't switch off
Reply With Quote #5

PHP Code:
for(new isizeof iBlockUseButtoni++) {
    if(
hamForwards[0][i]) EnableHamForward(hamForwards[0][i]);
    else 
hamForwards[0][i] = RegisterHam(Ham_UseiBlockUseButton[i], "BlockUseButton");

PHP Code:
for(new i3i++)
    for(new 
j9j++) DisableHamForward(hamForwards[i][j]); 
Will it work?

Last edited by OnePL; 03-29-2015 at 06:33.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 03-29-2015 , 07:17   Re: Forwards didn't switch off
Reply With Quote #6

There is only one way to know for sure - test it.
But I think that:
PHP Code:
for(new j9j++) 
</span></span>will raise an error if some of the hamForwards[i][j]have only 4(less than 9) values registered.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS 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 03:53.


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