AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Chat cvars (https://forums.alliedmods.net/showthread.php?t=120422)

fixed 03-04-2010 15:50

Chat cvars
 
I dont know what I shall call the title but I hope that u guys can help me.
I want to make a code where I start call this (I dont know if I do it the right way)

PHP Code:

new Text 

and then I make it to a amx_cvar

PHP Code:

Text register_cvar"amx_Text""Test"); 

PHP Code:

ColorChat(0GREEN"Hello %s" Text); 

I really dont know how to do it, but I hope this help to explain.

ConnorMcLeod 03-04-2010 16:07

Re: Chat cvars
 
Quote:

Originally Posted by wrecked_ (Post 1107484)
The description didn't help very much, but this might benefit you.

You are completely wrong, you should remove your code to prevent some users from being confused.



register_cvar only returns a pointer to this cvar, aka a usable index of cvar that is used with natives [s/g]et_pcvar_XXXX

PHP Code:

new g_cvar_pointer_Text

public plugin_init()
{
    
g_cvar_pointer_Text register_cvar"amx_Text""Test"); 
}

public 
TextFunction()
{
    new 
szStringText[32]
    
get_pcvar_stringg_cvar_pointer_Text szStringText charsmaxszStringText ) )
    
ColorChat(0GREEN"Hello %s" szStringText)



wrecked_ 03-04-2010 16:29

Re: Chat cvars
 
Oh wow, my bad.

I misunderstood his original post. I thought he was registering a normal cvar and didn't understand the 2nd param. Didn't even register to me that he was trying to use a string.

Deleted.

ConnorMcLeod 03-05-2010 01:14

Re: Chat cvars
 
This is a normal cvar (all cvars are normal lol), even if you check only the cvar value, you can't just check the pointer, check the link i put in last post.


All times are GMT -4. The time now is 08:48.

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