AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What does public in code means? (https://forums.alliedmods.net/showthread.php?t=143897)

bibu 11-26-2010 12:08

What does public in code means?
 
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.

YamiKaitou 11-26-2010 12:10

Re: What does public in code means?
 
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)

abdul-rehman 11-26-2010 13:00

Re: What does public in code means?
 
"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

bibu 11-26-2010 13:01

Re: What does public in code means?
 
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.

YamiKaitou 11-26-2010 13:09

Re: What does public in code means?
 
http://amxmodx.org/funcwiki.php?sear...task&go=search

bibu 11-26-2010 14:10

Re: What does public in code means?
 
And how can I set iFOV with set_task ?

fysiks 11-26-2010 16:16

Re: What does public in code means?
 
With a public function . . . I thought this was already told to you . . .


All times are GMT -4. The time now is 11:27.

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