Need a little help on player id.
#1

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

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)