Raised This Month: $ Target: $400
 0% 

What does public in code means?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 11-26-2010 , 12:08   What does public in code means?
Reply With Quote #1

What do I need to use of one of them:

PHP Code:
    {
        
SetUserFov(victimget_pcvar_num(cvar))
        
//set_task(0.1, "SetUserFov", victim, get_pcvar_num(cvar))
    

For this code:

PHP Code:
SetUserFov(idiFOV)
{
    
set_pdata_int(idm_iFOViFOVXO_PLAYER)
    
set_pev(idpev_foviFOV)

I tried it like that right now, and it doesn't work, with set_task, I can't even compile it.
bibu is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-26-2010 , 12:10   Re: What does public in code means?
Reply With Quote #2

If you use set_task, the function it calls must be declared as public. If you are calling the function directly, it can be declared as public or private (not putting anything assumes private)
__________________
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
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 11-26-2010 , 13:00   Re: What does public in code means?
Reply With Quote #3

"public" means that it is exposed to the host or in other words to other AMXX plugins so you can execute these public functions even from other plugins by using the callfunc_* natives
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
bibu
Veteran Member
Join Date: Sep 2010
Old 11-26-2010 , 13:01   Re: What does public in code means?
Reply With Quote #4

Why doesn't it compile with set_task then?

Error: Argument type mismatch (argument 4).

But if I replace get_pcvar with "x number" it works. And calling the function directly how I have it in the code doesn't do anything.
bibu is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-26-2010 , 13:09   Re: What does public in code means?
Reply With Quote #5

http://amxmodx.org/funcwiki.php?sear...task&go=search
__________________
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
bibu
Veteran Member
Join Date: Sep 2010
Old 11-26-2010 , 14:10   Re: What does public in code means?
Reply With Quote #6

And how can I set iFOV with set_task ?
bibu is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-26-2010 , 16:16   Re: What does public in code means?
Reply With Quote #7

With a public function . . . I thought this was already told to you . . .
__________________
fysiks 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 11:27.


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