Raised This Month: $ Target: $400
 0% 

get_pcvar_num Returning strange encoded strings


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cv3
Junior Member
Join Date: Sep 2014
Old 10-25-2014 , 06:42   get_pcvar_num Returning strange encoded strings
Reply With Quote #1

Here is the glitching part of the plugin I am editing:

Code:
new _chserv_mapcycle
Code:
_chserv_mapcycle = register_cvar ( "fps_serverdir", "27021" )
Code:
formatex ( filename, sizeof ( filename ) - 1, "%s/maps/%s/mpv/maprefix.ini", g_configsdir, get_pcvar_num(_chserv_mapcycle) )

L 10/25/2014 - 069:14: [mapsnew.amxx] File "addons/amxmodx/configs/maps/▒;
L 10/25/2014 - 069:14: [mapsnew.amxx] File "addons/amxmodx/configs/maps/▒;

Any ideas why the get_pcvar_num returns the strange encoded string ?

Fixed it: instead of the 2nd %s I used %d

Last edited by Cv3; 10-25-2014 at 06:47. Reason: got a fix
Cv3 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-25-2014 , 07:18   Re: get_pcvar_num Returning strange encoded strings
Reply With Quote #2

You are returning an integer with get_pcvar_num, but you are using %s. %i is for integers.
__________________

Last edited by HamletEagle; 10-25-2014 at 07:20.
HamletEagle is offline
Cv3
Junior Member
Join Date: Sep 2014
Old 10-25-2014 , 11:23   Re: get_pcvar_num Returning strange encoded strings
Reply With Quote #3

That's because before that it was a string but I decided to make it integer since the other way around it was returning me error. Even tho now it's working fine. Thanks for the feedback tho.
Cv3 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-25-2014 , 11:29   Re: get_pcvar_num Returning strange encoded strings
Reply With Quote #4

I think get_pcvar_string didn't worked because you didn't used it correctly.

Code:
new szString[ some_size_here ] get_pcvar_string(some_pcvar_here, szString, charsmax(szString))

This is how you use it.
__________________
HamletEagle 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 17:29.


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