OnPlayerText
#1

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?
Reply
#2

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.
Reply
#3

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..
Reply
#4

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.
Reply
#5

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.
Reply
#6

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.
Reply
#7

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.
Reply
#8

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
Reply
#9

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.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)