Need help with coding
#1

Allright, so i'm editing my /o cmd. ( Mainchat in RP.)

I'm using this code

Код:
format(string, sizeof(string), "[MC] %s: %s " , sendername, result);
OOCOff(FBI_COLOR,string);
printf("%s", string);
Is it possible to make the [MC] Player_Name: In one color, and the printf in another color?
Thanks,

//HeHu
Reply
#2

printf will show a message in server console not in game
Reply
#3

Quote:
Originally Posted by MadeMan
printf will show a message in server console not in game
Well, that /o CMD is working anyway, the thing i asked for if it was possible to make two seperate colors, one for the text that is printed and one for the [MC] name:
Reply
#4

Text printed in console is always white. But there is a plugin for other colors -> http://forum.sa-mp.com/index.php?topic=84654.0
Reply
#5

Allright, theres the whole code, i'm having one color on the Mainchat.

[MC] Player_Name: It can look this way

[MC] Player_Name: But i want it this way

Код:
GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/o)oc [ooc chat]");
				return 1;
			}
			if(PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
      {
			format(string, sizeof(string), "[MC] %s: %s " , sendername, result);
      OOCOff(LSPD_MAINCHAT,string);
			printf("%s", string);
			}
Reply
#6

use SendPlayerMessageToAll

You mean that?

Wiki reference: https://sampwiki.blast.hk/wiki/SendPlayerMessageToAll
Reply
#7

Nono! I want the [MC] Player_Name: in one color

And the the text "/o text" In another color, is that possible?
Reply
#8

Link in my signature, Better ID with Text, just change the format string to what you want.
Reply
#9

I saw your example, i can't find the color for orange, as the "Player_Name"

Код:
public OnPlayerText(playerid,text[])
{
	new string[2][MAX_PLAYER_NAME];
	GetPlayerName(playerid,string[0],sizeof(string[]));
	GetPlayerName(playerid,string[1],sizeof(string[]));
	format(string[0],sizeof(string[]),"[%d]%s",playerid,string[0]);
	SetPlayerName(playerid,string[0]);
	SendPlayerMessageToAll(playerid,text);
	SetPlayerName(playerid,string[1]);
	return 0;
}
Reply
#10

Quote:
Originally Posted by hehu
I saw your example, i can't find the color for orange, as the "Player_Name"

Код:
public OnPlayerText(playerid,text[])
{
	new string[2][MAX_PLAYER_NAME];
	GetPlayerName(playerid,string[0],sizeof(string[]));
	GetPlayerName(playerid,string[1],sizeof(string[]));
	format(string[0],sizeof(string[]),"[%d]%s",playerid,string[0]);
	SetPlayerName(playerid,string[0]);
	SendPlayerMessageToAll(playerid,text);
	SetPlayerName(playerid,string[1]);
	return 0;
}
Text color is white and player name color is color of SetPlayerColor
Reply


Forum Jump:


Users browsing this thread: