SA-MP Forums Archive
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: OnPlayerText (/showthread.php?tid=470227)



OnPlayerText - Aleksabre - 16.10.2013

How can I make when I type something I get ID and the green colour for the text.

e.g: Aleksabre(0): Hello.
this "hello" to be in the green colour, can you help me please?


Re: OnPlayerText - DanishHaq - 16.10.2013

pawn Код:
public OnPlayerText(playerid, text[])
{
    new chat[200], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(chat, sizeof(chat), "%s (%d): {009900}%s", name, playerid, text);
    SendClientMessageToAll(0xFFFFFFFF, string);
    return 0;
}
You're lucky I was just helping someone else with the same function, so that's why you got a quick reply :P.

Explanation:

The {009900} is a HEX code for dark green, that's how you use color embedding in your script. Check this site for a HTML Color Picker: http://www.w3schools.com/tags/ref_colorpicker.asp, and check this part of the wiki for a color embedding tutorial: https://sampwiki.blast.hk/wiki/Colour_Em...olor_embedding.


Re: OnPlayerText - xVIP3Rx - 16.10.2013

pawn Код:
public OnPlayerText(playerid, text[])
{
    new String[128], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(String, 128, "%s (%d): {1AFF00}%s", pName, playerid, text);
    SendClientMessageToAll(pInfo[playerid][pColor], String);
    return 0;
}
That's light green..


Re: OnPlayerText - Aleksabre - 16.10.2013

and by the way, how to make so "timestamp" of the time shows me the green colour too, thanks guys.
Sorry for double message, lols.


Re: OnPlayerText - Patrick - 16.10.2013

Quote:
Originally Posted by Aleksabre
Посмотреть сообщение
and by the way, how to make so "timestamp" of the time shows me the green colour too, thanks guys.
Sorry for double message, lols.
/timestamp is a default sa-mp command, you don't need to script it.

This forum requires that you wait 240 seconds between posts. Please try again in 3 seconds. - fuck you.


Re: OnPlayerText - Aleksabre - 16.10.2013

After doing the first thing from VIP3R and Danish:
pawn Код:
public OnPlayerText(playerid, text[])
{
    new chat[200], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(chat, sizeof(chat), "%s (%d): {009900}%s", name, playerid, text);
    SendClientMessageToAll(0xFFFFFFFF, string);
    return 0;
}
I've got a error, please help.
pawn Код:
C:\Users\Ilic\Desktop\GoGoGo druga verzija\GoGoGo server\gamemodes\rlg.pwn(2205) : error 017: undefined symbol "string"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: OnPlayerText - DanishHaq - 16.10.2013

Edit: Check below. Silly me.

Edit 2: Lol, you've been redirected from below to above, just stick with this, full fix :P :

pawn Код:
public OnPlayerText(playerid, text[])
{
    new chat[200], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(chat, sizeof(chat), "%s (%d): {009900}%s", name, playerid, text);
    SendClientMessageToAll(0xFFFFFFFF, chat);
    return 0;
}
That was my mistake, sorry.


Re: OnPlayerText - Another1 - 16.10.2013

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
pawn Код:
public OnPlayerText(playerid, text[])
{
    new chat[200], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(chat, sizeof(chat), "%s (%d): {009900}%s", name, playerid, text);
    SendClientMessageToAll(0xFFFFFFFF, string);
    return 0;
}
You're lucky I was just helping someone else with the same function, so that's why you got a quick reply :P.

Explanation:

The {009900} is a HEX code for dark green, that's how you use color embedding in your script. Check this site for a HTML Color Picker: http://www.w3schools.com/tags/ref_colorpicker.asp, and check this part of the wiki for a color embedding tutorial: https://sampwiki.blast.hk/wiki/Colour_Em...olor_embedding.
this my script =( next time give me credit :P


Re: OnPlayerText - DanishHaq - 16.10.2013

Quote:
Originally Posted by Another1
Посмотреть сообщение
this my script =( next time give me credit :P
It's 4 lines... I'll just change it later if that makes you happy.


Re: OnPlayerText - Another1 - 16.10.2013

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
It's 4 lines... I'll just change it later if that makes you happy.
even if it 1line give me credit or make ur own