[HELP] show id in chat
#6

Quote:
Originally Posted by PrawkC
Посмотреть сообщение
What is this? i dont even...

pawn Код:
public OnPlayerText(playerid, text[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new string[128];
            new temp[48];
            GetPlayerName(playerid, temp, sizeof(temp));
            format(string, sizeof(string), "%s (%i) says:{FFFFFF} %s", temp, playerid, text);
            SendClientMessage(i, 0xFFFF00AA, string);
        }
    }
    return 0;
}
A shorter and more efficient version would be CyberGhost's.
There is no need to:
a) declare 2 strings and format them for once for every connected player.
b) Use a loop for a function that has an alternative for All Players (SendClientMessageToAll)
c) Use IsPlayerConnected. You can assume that they have to be connected to text, and SendClientMessageToAll already includes this in its internal workings.

Just some tips.
Reply


Messages In This Thread
[HELP] show id in chat - by [ITS]StatickShock - 13.06.2011, 22:55
Re: [HELP] show id in chat - by ColdIce - 13.06.2011, 23:02
Re: [HELP] show id in chat - by PrawkC - 13.06.2011, 23:29
Re: [HELP] show id in chat - by ColdIce - 13.06.2011, 23:33
Re: [HELP] show id in chat - by Laronic - 13.06.2011, 23:33
Re: [HELP] show id in chat - by randomkid88 - 14.06.2011, 01:36
Re: [HELP] show id in chat - by Tee - 14.06.2011, 02:00
Re: [HELP] show id in chat - by [ITS]StatickShock - 14.06.2011, 16:53
Re: [HELP] show id in chat - by [ITS]StatickShock - 14.06.2011, 17:02

Forum Jump:


Users browsing this thread: 2 Guest(s)