SA-MP Forums Archive
Chat ID [Help] - 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: Chat ID [Help] (/showthread.php?tid=392160)



Chat ID [Help] - Sting. - 13.11.2012

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?


Re: Chat ID [Help] - Glad2BeHere - 13.11.2012

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


Re: Chat ID [Help] - Sting. - 13.11.2012

Alright, I will test it out.


Re: Chat ID [Help] - NumbSkull - 13.11.2012

@ 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;
}



Re: Chat ID [Help] - Glad2BeHere - 13.11.2012

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



Re: Chat ID [Help] - Sting. - 13.11.2012

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.



Re: Chat ID [Help] - Sting. - 13.11.2012

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


Re: Chat ID [Help] - NumbSkull - 13.11.2012

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


Re: Chat ID [Help] - Sting. - 13.11.2012

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.



Re: Chat ID [Help] - NumbSkull - 13.11.2012

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);