Raised This Month: $ Target: $400
 0% 

invalid function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Groven
AlliedModders Donor
Join Date: Apr 2011
Location: Sweden
Old 07-12-2011 , 17:56   invalid function
Reply With Quote #1

Hello.

I'm new to scripting and i am making a Prefix cvar so you can change prefix name in the plugin with a cvar but i get a error.

PHP Code:
//Cvar
new g_szPrefixg_szPrefixName[32];

g_szPrefix register_cvar("amx_prefix_name""Execute-Gaming"); //Server name prefix
get_pcvar_string(g_szPrefixg_szPrefixNamesizeof(g_szPrefixName)); 

public 
Health(id)
{
    if(
is_user_alive(id))
    {
        
client_print(idprint_chat,"%s You Got 150 Health!"g_szPrefixg_szPrefixName);
        
set_user_health(id150);
    }

__________________
Groven is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 07-12-2011 , 18:00   Re: invalid function
Reply With Quote #2

You cannot have a function outside a forward.

When making cvars you do it like this:

PHP Code:
new pcvar

public plugin_init()
{
     
pcvar register_cvar("cvar_here""value here")

__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 07-12-2011 , 18:05   Re: invalid function
Reply With Quote #3

also you might wanna put '[]' around your %s for prefix... itll look funny
Doc-Holiday is offline
Old 07-12-2011, 18:17
Exolent[jNr]
This message has been deleted by Exolent[jNr]. Reason: Nvm.
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 20:03.


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