SA-MP Forums Archive
Text not showing - 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: Text not showing (/showthread.php?tid=549575)



Text not showing - MrBlake - 07.12.2014

Why this text isn't showing on chat?
No warnings/errors.

Код:
	new coordsstring[256];
		format(coordsstring, sizeof(coordsstring),"            Ч Ч %s Ч Ч",name);
		SendClientMessage(playerid, COLOR_RED,coordsstring);
		format(coordsstring, sizeof(coordsstring), "{fe6347}» {0fab2e}Level: {ffffff}[%d] • {0fab2e}Sex: {ffffff}[%s] • {0fab2e}Varsta: {ffffff}[%d] • {fe6347}Cash: {ffffff}[%s] • {fe6347}Banca: {ffffff}[%s]", level,atext,age, saveGM(cash), saveGM(account));
		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
		format(coordsstring, sizeof(coordsstring), "{fe6347}» {0fab2e}Telefon: {ffffff}[%d] • {0fab2e}Donator: {ffffff}[%s] • {0fab2e}Sot/Sotie: {ffffff}[%s] • {fe6347}Ore Jucate: {ffffff}[%d] • {fe6347}Job: {ffffff}[%s]", pnumber,drank,married,ptime,jtext);
		SendClientMessage(playerid, COLOR_LIGHTBLUE,coordsstring);
		format(coordsstring, sizeof(coordsstring), "{fe6347}» {0fab2e}NextLevel: {ffffff}[%s] • {0fab2e}Respect: {ffffff}[%d/%d] • {0fab2e}Wanted: {ffffff}[%d] • {fe6347}Drugs: {ffffff}[%d] • {fe6347}Pills: {ffffff}[%d/50]",saveGM(costlevel),exp,expamount,wanted,drugs,pills);
		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
		format(coordsstring, sizeof(coordsstring), "{fe6347}» {0fab2e}Materials: {ffffff}[%d] • {0fab2e}Factiune: {ffffff}[%s] • {0fab2e}Rank: {ffffff}[%s] • {fe6347}Warn: {ffffff}[%d/3]• {fe6347}Fish: {ffffff}[%d] ",mats,ttext,rtext,warns,fishes);
		SendClientMessage(playerid, COLOR_LIGHTBLUE,coordsstring);



Re: Text not showing - OsteeN - 07.12.2014

Perhaps it is not getting called?
Show us where you have placed this code.


Re: Text not showing - MrBlake - 07.12.2014

It's called, with a command:

Код:
if (strcmp(cmd, "/stats", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if (gPlayerLogged[playerid] != 0)
			{
				ShowStats(playerid,playerid);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "{30a030}[Kappa]: {ffffff}Ne pare rau, dar trebuie sa fi Logat pentru a utiliza aceasta comanda.");
			}
		}
		return 1;
	}
Код:
public ShowStats(playerid,targetid)
{
    if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
	{

                [....]
               //here is the code
         }
}



Re: Text not showing - PowerPC603 - 07.12.2014

You could remove the "IsPlayerConnected(playerid)" parts in your code, as the player using the command is connected to begin with, otherwise he couldn't use the command.

Other than that, I can't see any problems.


Re: Text not showing - MrBlake - 07.12.2014

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
You could remove the "IsPlayerConnected(playerid)" parts in your code, as the player using the command is connected to begin with, otherwise he couldn't use the command.

Other than that, I can't see any problems.
I have to mention that the [/stats] worked before.
I added those colors {0fab2e} - {ffffff} to make text nicer and now... doesn't work (but no errors).


Re: Text not showing - PowerPC603 - 07.12.2014

Maybe the string is too long.
Messages should only be 144 chars max.
https://sampwiki.blast.hk/wiki/SendClientMessage


Re: Text not showing - Bridge - 07.12.2014

Example for color code {FFFFF}


Re: Text not showing - MrBlake - 07.12.2014

Ok so I DELETED the COLORs.
The text is now working. What the hell? Why I can't use those colors?
How should I color it? (Green - White - Green - White - Green - White)


Re: Text not showing - PowerPC603 - 07.12.2014

The added colors make your text too long.
As said before, the maximum size of your string that gets passed to SendClientMessage can only be 144 characters.

pawn Код:
{fe6347}» {0fab2e}Level: {ffffff}[%d]{0fab2e}Sex: {ffffff}[%s]{0fab2e}Varsta: {ffffff}[%d]{fe6347}Cash: {ffffff}[%s]{fe6347}Banca: {ffffff}[%s]
This string is already 156 characters long, and you still need to insert data from your variables.
It's too long and the text will NOT be sent.

It's clearly stated in the wiki, I posted the link in my previous post.

To see the length of your strings, copy the string in Notepad and put your cursor on the end of the line.
On the bottom-right, you should see how many characters it has (column).

You can also copy the string on an empty line in pawno itself and see how long it is.