SA-MP Forums Archive
% = # - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: % = # (/showthread.php?tid=582216)



% = # - flabed18 - 18.07.2015

Hi. When i try to use "%" in the chat, the "%" becomes "#".


Re: % = # - nGen.SoNNy - 18.07.2015

Yeah because % it's used on things like %s %d %e %i


Re: % = # - KayJ - 19.07.2015

See this:
Quote:
You can't use '%' directly in game chat it replace with '#'. You can use % in client message by using '%%' symbol. For example in pawn "SendClientMessage(playerid, -1 "Hi, we are now 100%% sure that you are a human);". Otherwise, if you tried to use "SendClientMessage(playerid -1, "Hi, we are now 100% sure that you are a human);". In script it is all ok but It will show "Hi we are 100# sure that you are human." Instead of "Hi, we are now 100% sure that you are human"



AW: % = # - Kaliber - 20.07.2015

I wrote a fix for this:

http://gta-sa-mp.de/forum/3-san-andr...html#post18855


Re: AW: % = # - liquor - 20.07.2015

Quote:
Originally Posted by Kaliber
View Post
Odd choice of string size, the array is 18 cells bigger than OnPlayerText can send to the client :P


Re: AW: % = # - KingHual - 20.07.2015

Quote:
Originally Posted by Kaliber
View Post
A fix? I'm pretty certain it was sanitized on purpose.


AW: Re: AW: % = # - Kaliber - 20.07.2015

Quote:
Originally Posted by KingHual
View Post
A fix? I'm pretty certain it was sanitized on purpose.
Maybe, but thats doesn't matter.

If he want to use a % in chat...he can use my code


Re: AW: Re: AW: % = # - KingHual - 20.07.2015

Quote:
Originally Posted by Kaliber
View Post
Maybe, but thats doesn't matter.

If he want to use a % in chat...he can use my code
Right, right. Now imagine someone using your code without knowing the consequences and using format() with the player text as an argument.


Re: % = # - Crayder - 03.08.2015

@Kal', wouldn't your "fix" fail if a player wanted to use a '#' in their chat? Yes.


Re: % = # - MarvinPWN - 04.08.2015

Here is a fix:
PHP Code:
stock _Fix(const string[],bool:chat=false) {
    new 
tmp[145],pos strfind(string,"#");
    
strcat(tmp,string);
    if(
pos == -1) return tmp;
    for(;;) {
        if(
tmp[((pos-1) < 0)?0:(pos-1)] != '\\') {
            
strdel(tmp,pos,pos+1),strins(tmp,(!chat)?("%%"):("%%%%"),pos,sizeof tmp);
            
pos strfind(tmp,"#",false,pos+((!chat)?(2):(4)));
        }
        else {
            
strdel(tmp,pos-1,pos);
            
pos strfind(tmp,"#",false,pos);
        }
        if(
pos == -1) break;
    }
    return 
tmp;

# => %
And if you want to write a #, you have to write this in the chat: \#

Have fun. Maybe it will fix in the next changelog? @Kalcor: