SA-MP Forums Archive
Percent sign - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Percent sign (/showthread.php?tid=443477)



Percent sign - dubyabeast - 12.06.2013

Is it possible to send the percent sign (%) ingame? As I want to say something is '25% complete'


Re: Percent sign - Vince - 12.06.2013

Doesn't work in client messages at all. I know it works with textdraws, though. Not sure about gametext or dialogs. Take note that if you want to insert a literal percent sign with the format function you need to use '%%', e.g.

pawn Код:
format(countstr, sizeof(countstr), "%d%%", percent);



Re: Percent sign - dubyabeast - 12.06.2013

I did some testing. It works in client messages.
pawn Код:
SendClientMessage(playerid, -1, "The script is 40%% complete.");
// Shows in-game as: The script is 40% complete.



Re: Percent sign - feartonyb - 12.06.2013

Код:
public OnPlayerText(playerid, text[])
{
  new perstring[128], PlayerNM[MAX_PLAYER_NAME];
  GetPlayerName(playerid, PlayerNM, sizeof(PlayerNM));
  for(new percentsign; percentsign < 256; percentsign++)
  {
    if(text[percentsign] == '%') text[percentsign] = '%%';
  }
  format(perstring, sizeof(perstring), "%s: %s", PlayerNM, text);
  return 1;
}