#1

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

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

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"
Reply
#4

I wrote a fix for this:

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

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
Reply
#6

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

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
Reply
#8

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.
Reply
#9

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

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:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)