Jump to content
  • 0

pomoc Chat


Stellet

Dotaz

Ahoj mám dotaz, proč mi to píše 2x ? Code: 

 

public OnPlayerText(playerid, text[])
{
new Name[64];
GetPlayerName(playerid,Name,64);
new str[500];
format(str,sizeof(str),"%s (%d): %s",Name,playerid,text);
SendClientMessageToAll(COLOR_WHITE,str);
return 1;
}

Ale ve hře to ukáže 2x, ten základní a ten můj:

JjocXaU.png?1

Link to comment
Share on other sites

6 odpovědí na tuto otázku

Recommended Posts

  • 0

možnost číslo 1

format(str,sizeof(str),"{RRGGBB}%s {FFFFFF}(%d): %s",Name,playerid,text);  //misto RRGGBB si dej hexadecimalni hodnotu barvy kterou chces

možnost číslo 2

format(str,sizeof(str),"%s {FFFFFF}(%d): %s",Name,playerid,text);
SendClientMessageToAll(COLOR_YELLOW,str);// si nadefinuj COLOR_YELLOW jestli nemas 
Link to comment
Share on other sites

  • 0

format(str,sizeof(str),"{%06X}%s {FFFFFF}(%d): %s",GetPlayerColor(playerid),Name,playerid,text); //toto by malo fungovať

 

alebo

 

SendClientMessageToAll(GetPlayerColor(playerid),str);

Link to comment
Share on other sites

  • 0

format(str,sizeof(str),"{%06X}%s {FFFFFF}(%d): %s",GetPlayerColor(playerid),Name,playerid,text); //toto by malo fungovať

 

alebo

 

SendClientMessageToAll(GetPlayerColor(playerid),str);

netestoval sem to ale nemelo by to bejt

format(str,sizeof(str),"{%06X}%s {FFFFFF}(%d): %s",GetPlayerColor(playerid) >>> 8,Name,playerid,text);

jelikoz GetPlayerColor ti to vrati ve formatu 0xRRGGBBAA.. ale v tomhle pripade potrebujes hodnotu bez 0x a bez alpha hodnoty. takze musis pouzit bitovej posun.

Link to comment
Share on other sites

  • 0

netestoval sem to ale nemelo by to bejt

format(str,sizeof(str),"{%06X}%s {FFFFFF}(%d): %s",GetPlayerColor(playerid) >>> 8,Name,playerid,text);

jelikoz GetPlayerColor ti to vrati ve formatu 0xRRGGBBAA.. ale v tomhle pripade potrebujes hodnotu bez 0x a bez alpha hodnoty. takze musis pouzit bitovej posun.

 

Je to možné, ja som si to len našiel na pawno wiki, nikdy som to nepoužíval a nerozumiem sa tomu :) Dík že si ma opravil

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...