Raised This Month: $ Target: $400
 0% 

Hamsandwich Forward, Return values


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 06-14-2010 , 14:54   Re: Hamsandwich Forward, Return values
Reply With Quote #1

Quote:
Originally Posted by NiHiLaNTh View Post

Actually it should be
Code:
#define IsPlayer(%1) ( 1 <= %1 <= 32 )
Anyway, to filter valid player you can also use
Code:
     is_user_alive(id)


Code:
public fwButtonUsed(idcaller) 
{    
    if ( !is_user_alive ( idcaller ) )           
        return HAM_IGNORED
    
    static CsTeams:iTeam
    iTeam = cs_get_user_team ( idcaller )   
    
    if ( IsFreeRun && iTeam == CS_TEAM_T )           
        return HAM_SUPERCEDE
    
    return HAM_IGNORED
}

1. Lol, what is the difference? o.O

My code = 1 to 32, your code = 1 to 32... is the same thing with differents operators...

2. Yeah, i thinked about that check, but i didn't sure about that...

@ t3hNox

mMm, strange, should work, i think...

Test this:

Code:
public fwButtonUsed(idcaller) {         if (IsFreeRun && cs_get_user_team(idCaller) == CS_TEAM_T && is_user_alive(idCaller) )                   return HAM_SUPERCEDE;         return HAM_IGNORED; }

But is practicaly the same thing...
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
t3hNox
Senior Member
Join Date: Oct 2009
Old 06-14-2010 , 14:49   Re: Hamsandwich Forward, Return values
Reply With Quote #2

Unfortunately, no success. With this version everyone can click buttons.
PHP Code:
public fwButtonUsed(idcaller
{    
    if ( !
is_user_alive idcaller ) )           
        return 
HAM_IGNORED
    
    
static CsTeams:iTeam
    iTeam 
cs_get_user_team idcaller )   
    
    if ( 
IsFreeRun == true && iTeam == CS_TEAM_T )           
        return 
HAM_SUPERCEDE
    
    
return HAM_IGNORED

t3hNox is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 06-14-2010 , 15:05   Re: Hamsandwich Forward, Return values
Reply With Quote #3

No, with this version no one can use the buttons + debug error:
Code:
L 06/14/2010 - 22:02:37: [AMXX]    [0] freerun.sma::fwButtonUsed (line 83)
L 06/14/2010 - 22:02:41: [CSTRIKE] Player out of range (97)
L 06/14/2010 - 22:02:41: [AMXX] Displaying debug trace (plugin "freerun.amxx")
L 06/14/2010 - 22:02:41: [AMXX] Run time error 10: native error (native "cs_get_
user_team")
btw. With this code there were no errors.
I suppose the fault is with this team checking..
t3hNox is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-14-2010 , 15:22   Re: Hamsandwich Forward, Return values
Reply With Quote #4

idcaller is the entity number of the button, so it will always be over 32, thus meaning it is not a player. Use idactivator to get the entity that used the button.
PHP Code:
     /**
     * Description:        Called whenver one entity uses another.
     * Forward params:    function(this, idcaller, idactivator, use_type, Float:value)
     * Return type:        None.
     * Execute params:    ExecuteHam(Ham_Use, this, idcaller, idactivator, use_type, Float:value);
     */
    
Ham_Use 
EDIT: Hi wrecked_
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-14-2010 , 15:23   Re: Hamsandwich Forward, Return values
Reply With Quote #5

The player id is the 2nd param passed through the function. The one you guys are using is the button id.

PHP Code:
public fwButtonUsedidbuttonidplayer 
EDIT: Damnit, Yami.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 06-14-2010 , 15:40   Re: Hamsandwich Forward, Return values
Reply With Quote #6

Yes, it's working. Thanks
Em, no +karma button ? Damn buttons..
t3hNox is offline
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 06-14-2010 , 18:30   Re: Hamsandwich Forward, Return values
Reply With Quote #7

Quote:
Originally Posted by t3hNox View Post
Yes, it's working. Thanks
Em, no +karma button ? Damn buttons..
It was removed a while ago.
__________________
"There is no knowledge, that is not power"
fezh is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 06-15-2010 , 05:07   Re: Hamsandwich Forward, Return values
Reply With Quote #8

I'm grateful for your help but the problem is already solved and that define was not necessary at all.
The solution is explained in YamiKaitou and wrecked_ posts.
t3hNox is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-15-2010 , 05:41   Re: Hamsandwich Forward, Return values
Reply With Quote #9

Quote:
Originally Posted by t3hNox View Post
I'm grateful for your help but the problem is already solved and that define was not necessary at all.
The solution is explained in YamiKaitou and wrecked_ posts.
Sometimes buttons are activated by another entity, so you should also check first is_user_alive(id), or check id range with IsPlayer define, TRUST ME LOL.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 06-15-2010 , 06:30   Re: Hamsandwich Forward, Return values
Reply With Quote #10

The final version looks like this:
PHP Code:
public fwButtonUsed(buttonplayer
{    
    if ( !
is_user_alive player ) )           
        return 
HAM_IGNORED
    
    
static CsTeams:iTeam
    iTeam 
cs_get_user_team player )   
    
    if ( 
IsFreeRun == true && iTeam == CS_TEAM_T )           
        return 
HAM_SUPERCEDE
    
    
return HAM_IGNORED

Will it be ok ?
t3hNox 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 14:56.


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