18.07.2015, 23:09
Hi. When i try to use "%" in the chat, the "%" becomes "#".
Originally Posted by https://sampwiki.blast.hk/wiki/Format
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"
|
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;
}