Need a little help on player id. -
iOxide - 17.11.2013
Hi, i am editing PPC Trucking. When players are chatting, the player id isn't displaying with their name on chat box, how can i make the id shows up in this gamemode? Can anyone please help me?
Re: Need a little help on player id. -
Konstantinos - 17.11.2013
It's a simple formatting and returning 0 at the end of the callback to prevent the default chat from being sent.
You can also read this tutorial about things you can do with that callback:
https://sampforum.blast.hk/showthread.php?tid=335123
It also shows how to do what you asked for.
Re: Need a little help on player id. -
knackworst - 17.11.2013
pawn Код:
public OnPlayerText(playerid, text[])
{
new string[256], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof PlayerName);
format(string, sizeof string, "%s(%i): {FFFFFF}%s", PlayerName, playerid, text);
return SendClientMessageToAll(GetPlayerColor(playerid), string);
}
Something like this should work?
Re: Need a little help on player id. -
iOxide - 17.11.2013
I tried putting this code at public OnPlayerText callback:
public OnPlayerText(playerid, text[])
{
new string[128];
format(string, sizeof(string), "[%d] %s",playerid,text);
SendPlayerMessageToAll(playerid,string);
return 0;
}
But when player is chatting, there are double messages like this
PlayerName[0]: hi
PlayerName: hi
One with id and another without id, the one with id is made by me. So i want to disable the one without id, but can't find its location.
Re: Need a little help on player id. -
SuperViper - 17.11.2013
You have to make sure that at the end of
OnPlayerText, it says
return 0; and not
return 1;. Returning 0 prevents the default built-in message from being sent.
If it still gets sent, then an include or a plugin you're using may be the cause of this problem.
Re: Need a little help on player id. -
iOxide - 18.11.2013
Quote:
Originally Posted by SuperViper
You have to make sure that at the end of OnPlayerText, it says return 0; and not return 1;. Returning 0 prevents the default built-in message from being sent.
If it still gets sent, then an include or a plugin you're using may be the cause of this problem.
|
Oh, i placed return 0; at the end and its working fine now. Thanks for the helping.