[Help] OnPlayerText - 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: [Help] OnPlayerText (
/showthread.php?tid=554788)
[Help] OnPlayerText -
Arxalan - 05.01.2015
Hello all , i want to add some code into my OnPlayerText and i added but now i want that only in case that player type any special command so that code will be followed . E.g. if player type /blue then only in that case player text message color changes to blue and appear his message in blue color. Just tell me where to put the CMD or if(strcmp) etc . i have the code of changing the text to blue.
Re: [Help] OnPlayerText -
ATGOggy - 05.01.2015
It's nearly impossible to do this.
Re: [Help] OnPlayerText -
Schneider - 05.01.2015
You could add as many colors as you want:
pawn Код:
new PlayerTextColor[MAX_PLAYERS];
pawn Код:
COMMAND:setcolor(playerid, params[])
{
if(strcmp(params, "blue", true)==0) PlayerTextColor[playerid] = 0x0000FFFF;
else if(strcmp(params, "red", true)==0) PlayerTextColor[playerid] = 0xFF0000FF;
else if(strcmp(params, "green", true)==0) PlayerTextColor[playerid] = 0x00FF00FF;
else if(strcmp(params, "yellow", true)==0) PlayerTextColor[playerid] = 0xFFFF00FF;
else if(strcmp(params, "purple", true)==0) PlayerTextColor[playerid] = 0xFF00FFFF;
else return SendClientMessage(playerid, -1, "Use: /setcolor [red/blue/green/yellow/purple]");
SendClientMessage(playerid, PlayerTextColor[playerid], "You have changed your textcolor");
return 1;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
if(PlayerTextColor[playerid] != 0)
{
new string[128], pname[24];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "%s: %s", pname, text);
SendClientMessageToAll(PlayerTextColor[playerid], string);
return 0;
}
return 1;
}