Raised This Month: $ Target: $400
 0% 

[SOLVED] Get cvar name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
extream87
Senior Member
Join Date: Aug 2011
Old 03-03-2014 , 07:22   [SOLVED] Get cvar name
Reply With Quote #1

What is wrong obtaining the name "Owner"
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "author" new admintag new MyVar[ 15 ]; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         admintag = register_cvar("admin_tag", "Owner"); } public save_points(id) { ColorChat(player, GREEN, "^1O ^4[%s] ^1deu-te skillpoints.", get_pcvar_string(admintag, MyVar, charsmax(MyVar))); }

Last edited by extream87; 03-03-2014 at 10:20.
extream87 is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 03-03-2014 , 07:25   Re: [HELP] Get cvar name
Reply With Quote #2

Code:
static cell AMX_NATIVE_CALL get_pcvar_string(AMX *amx, cell *params)
{
    cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
    if (!ptr)
    {
        LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
        return 0;
    }

    return set_amxstring(amx, params[2], ptr->string ? ptr->string : "", params[3]);
}

get_pcvar_string doesn't return string. Also in pawn you can't return strings anyway.

Code:
public save_points(id)  
{ 
get_pcvar_string(admintag, MyVar, charsmax(MyVar)) 
ColorChat(player, GREEN, "^1O ^4[%s] ^1deu-te skillpoints.", MyVar); 
}

__________________


Last edited by NiHiLaNTh; 03-03-2014 at 07:26. Reason: stupid formatting
NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
extream87
Senior Member
Join Date: Aug 2011
Old 03-03-2014 , 07:35   Re: [HELP] Get cvar name
Reply With Quote #3

Works, thank you.

But why i cant make it all in one line?

Code:
ColorChat(player, GREEN, "^1O ^4[%s] ^1deu-te skillpoints.", get_pcvar_string(admintag, MyVar, charsmax(MyVar)));

Last edited by extream87; 03-03-2014 at 07:39.
extream87 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-03-2014 , 11:29   Re: [HELP] Get cvar name
Reply With Quote #4

Quote:
Originally Posted by extream87 View Post
But why i cant make it all in one line?
Reread his post as he told you why
__________________
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).

Last edited by YamiKaitou; 03-03-2014 at 11:29.
YamiKaitou is offline
Reply


Thread Tools
Display Modes

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 06:00.


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