Chat ID [Help]
#1

When I talk on my server it will say my name with what I said. Etc. Troll: Hi, Im Troll!

Now I want this thing I've seen before in many other servers. How do I add or put the players id to the right of his name. Etc. Troll(0): Hi, I'm Troll!

How?
Reply
#2

pawn Код:
public OnPlayerText(playerid, text[])
{
    new text[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof (name));
    format(textv2, sizeof (text), "(%d) %s: %s",playerid, name, text);
    SendPlayerMessageToAll(-1, textv2);
    return 0;
}
did i fail then try here
https://sampforum.blast.hk/showthread.php?tid=335123
Reply
#3

Alright, I will test it out.
Reply
#4

@ gladtobehere you kinda failed xD he wanted the id after the name like this hahahaha but close enough
pawn Код:
public OnPlayerText(playerid, text[])
{
    new text[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof (name));
    format(textv2, sizeof (text), "%s(%d): %s",name, playerid, text);
    SendPlayerMessageToAll(-1, textv2);
    return 0;
}
Reply
#5

pawn Код:
[ pawn]
new got it?;
[ /pawn]
Reply
#6

I get this error's.
Код:
C:\Program Files\GtaSan\Rockstar Games\GTA San Andreas\Server 0.3e\gamemodes\Killer.pwn(1308) : warning 219: local variable "text" shadows a variable at a preceding level
C:\Program Files\GtaSan\Rockstar Games\GTA San Andreas\Server 0.3e\gamemodes\Killer.pwn(1310) : error 017: undefined symbol "textv2"
C:\Program Files\GtaSan\Rockstar Games\GTA San Andreas\Server 0.3e\gamemodes\Killer.pwn(1310) : error 035: argument type mismatch (argument 1)
C:\Program Files\GtaSan\Rockstar Games\GTA San Andreas\Server 0.3e\gamemodes\Killer.pwn(1311) : error 017: undefined symbol "textv2"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#7

@NumbSkull and Glad, still got errors. Like the errors I posted.
Reply
#8

pawn Код:
public OnPlayerText(playerid, text[])
{
    new textv2[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof (name));
    format(textv2, sizeof (text), "%s(%d): %s",name, playerid, text);
    SendPlayerMessageToAll(-1, textv2);
    return 0;
}
xD didnt even notice that this is it
Reply
#9

It works but one more error.
Код:
C:\Program Files\GtaSan\Rockstar Games\GTA San Andreas\Server 0.3e\gamemodes\Killer.pwn(1310) : warning 224: indeterminate array size in "sizeof" expression (symbol "")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#10

or replace this one line and it is good xD
format(textv2, sizeof (text), "%s(%d): %s",name, playerid, text);
into
format(textv2, sizeof (textv2), "%s(%d): %s",name, playerid, text);
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)