Raised This Month: $ Target: $400
 0% 

CurWeapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 04-20-2013 , 16:56   CurWeapon
Reply With Quote #1

Does it makes any difference if i return some value in CurWeapon event or don't?

PHP Code:
public EventCurWeapon(id)
{
    if(
get_user_team(id) == 1)
        
engclient_cmd(id"weapon_knife")
    
    return 
PLUGIN_HANDLED
}

public 
EventCurWeapon(id)
{
    if(
get_user_team(id) == 1)
        
engclient_cmd(id"weapon_knife")
    
    return 
PLUGIN_CONTINUED
}

public 
EventCurWeapon(id)
{
    if(
get_user_team(id) == 1)
        
engclient_cmd(id"weapon_knife")


Last edited by GhostMan; 04-20-2013 at 16:59.
GhostMan is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 04-20-2013 , 17:02   Re: CurWeapon
Reply With Quote #2

Why dont you test it out?
mottzi is offline
Send a message via MSN to mottzi
GhostMan
Senior Member
Join Date: Jun 2012
Old 04-21-2013 , 04:13   Re: CurWeapon
Reply With Quote #3

I did, and it don't make any difference for me. But maby there's something i don't notice.

Last edited by GhostMan; 04-21-2013 at 04:13.
GhostMan is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-21-2013 , 06:08   Re: CurWeapon
Reply With Quote #4

You don't need to return any value in events callbacks, once the function is called, message has already been sent.
If you want to exit the function before its end, just put 'return' without any value.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 04-22-2013 , 07:56   Re: CurWeapon
Reply With Quote #5

PHP Code:
return PLUGIN_CONTINUED 
lol you not need this and any return; its only if you want to exit the function or return to other function
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 04-22-2013 at 07:56.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 04-22-2013 , 08:03   Re: CurWeapon
Reply With Quote #6

Quote:
Originally Posted by ^SmileY View Post
PHP Code:
return PLUGIN_CONTINUED 
lol you not need this and any return; its only if you want to exit the function or return to other function
No reason to laugh at new users nor is there a reason to repeat something that was already said.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 04-22-2013 , 08:43   Re: CurWeapon
Reply With Quote #7

is not a laugh comment, its only to remember the return is not needed, and i not really see this wrong return;
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-22-2013 , 09:28   Re: CurWeapon
Reply With Quote #8

I'm pretty sure 'lol' means laugh out loud.
Backstabnoob is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-22-2013 , 14:25   Re: CurWeapon
Reply With Quote #9

Quote:
Originally Posted by Backstabnoob View Post
I'm pretty sure 'lol' means laugh out loud.
You, and the whole world, are wrong !
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 04-22-2013 , 09:48   Re: CurWeapon
Reply With Quote #10

NO!

I only surprised with the unnecessary return;
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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 10:51.


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