Raised This Month: $32 Target: $400
 8% 

percent symbol


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
orel56000
Member
Join Date: Apr 2015
Old 06-24-2018 , 14:10   percent symbol
Reply With Quote #1

Hello, before the last cs update percent symbol used to be working with "%%%", and now its don't working. any suggestions?
orel56000 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-24-2018 , 14:25   Re: percent symbol
Reply With Quote #2

In what context? If you are formatting a string and you want to show a % then you need to escape it with a %. So, "%%" will give you "%". I'm not sure why you are showing three, that doesn't make sense.
__________________
fysiks is offline
orel56000
Member
Join Date: Apr 2015
Old 06-24-2018 , 14:37   Re: percent symbol
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
In what context? If you are formatting a string and you want to show a % then you need to escape it with a %. So, "%%" will give you "%". I'm not sure why you are showing three, that doesn't make sense.
because before the 2017 update only %%% worked for me, and now nothing is woking for me.. idk why, I have tried %% and %%% and "%s", "%" and even "%s", "%%".
and nothing works..
orel56000 is offline
orel56000
Member
Join Date: Apr 2015
Old 06-24-2018 , 14:47   Re: percent symbol
Reply With Quote #4

I have checked now and if I do this:
PHP Code:
formatex(str2sizeof(str2), "(%s+%i%%^1)"rand 34 ? (won == ? ("^4") : ("")) : ("^1"), percentBonus); 
its now working and prints only the %i, like this (+7 ).

but if I'm doing this:
PHP Code:
ColorChat(0"%%"); 
it is working (prints %).


how to fix it?

Last edited by orel56000; 06-24-2018 at 14:48.
orel56000 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-24-2018 , 16:38   Re: percent symbol
Reply With Quote #5

Does it happen if you don't use colored chat (i.e. use client_print() without any color-based formatting)? If it works without colored chat, there is probably a problem with the colored chat function you are using.
__________________

Last edited by fysiks; 06-24-2018 at 16:38.
fysiks is offline
orel56000
Member
Join Date: Apr 2015
Old 06-24-2018 , 16:47   Re: percent symbol
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Does it happen if you don't use colored chat (i.e. use client_print() without any color-based formatting)? If it works without colored chat, there is probably a problem with the colored chat function you are using.
No, its the same..
maybe there is a problem with my code?:
PHP Code:
new str[256], str2[16];
formatex(str2sizeof(str2), "(%s+%i%%^1)"rand 34 ? (won == ? ("^4") : ("")) : ("^1"), percentBonus);
formatex(strsizeof(str), ", total cash - %s"AddCommas(cash));
for(new 
133i++)if(is_user_loggedin(i))
        
ColorChat(i"^3%s ^1has gambled%s on %s and %s%s%s",GetName(client), allin == 1? ("^4 allin^1") : (""), AddCommas(amount), won == ? ("Won"): ("Lost"),percentBonus ? (str2) : (""), totalcash[client] == ? (".") : (str)); 
    return 
1
orel56000 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-24-2018 , 17:04   Re: percent symbol
Reply With Quote #7

Are you using the latest official release of AMX Mod X (v1.8.2)? If you are using the current dev beta, try using the official release instead and see if that changes.

What if you print only str2? does it show the % correctly there? Try this:

Code:
ColorChat(0, "(%s+%i%%^1)", rand > 34 ? (won == 1 ? ("^4") : ("")) : ("^1"), percentBonus)
__________________
fysiks is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 06-24-2018 , 17:05   Re: percent symbol
Reply With Quote #8

Try this method:
Quote:
formatex( string, len, "%s+%i%c^1", text, int, '%' )
__________________
My English is A0
E1_531G is offline
orel56000
Member
Join Date: Apr 2015
Old 06-24-2018 , 17:22   Re: percent symbol
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
Are you using the latest official release of AMX Mod X (v1.8.2)? If you are using the current dev beta, try using the official release instead and see if that changes.

What if you print only str2? does it show the % correctly there? Try this:

Code:
ColorChat(0, "(%s+%i%%^1)", rand > 34 ? (won == 1 ? ("^4") : ("")) : ("^1"), percentBonus)
Quote:
Originally Posted by E1_531G View Post
Try this method:
Yes, I'm using AMX Mod X v 1.8.2.

That the result from both suggestions:

PHP Code:
E1_531G Player has gambled on 300 and Lost(+).
fysiks - (+7
orel56000 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-24-2018 , 21:50   Re: percent symbol
Reply With Quote #10

Try writing str2 to a file and then attach the file to your next post (don't edit or change it in any way before attaching it).
__________________
fysiks is offline
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 16:33.


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