09.06.2018, 19:40
How do I make it so that if someone types a message in the chat ( onplayertext ) someone else doesn't receive it because they are in deaf mode?
new bool:deaf[MAX_PLAYERS] = {false,...};
//usage
//deaf[playerid] = true; deaf[playerid] = false;
public OnPlayerText(playerid, text[])
{
new name[24], str[144];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "%s: %s", name, text); //custom chat
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(deaf[playerid]) continue; //if deaf skip him
SendClientMessage(i, -1, str);
}
return 0; //return 0 so original samp message wont show
}
|
PHP код:
|
|
Stop requesting code and show us your code what you've done so far.
|
new bool:deaf[MAX_PLAYERS] = {false,...};
public OnPlayerText(playerid, text[])
{
new str[128];
format(str, sizeof(str), "%s says: %s", GetName(playerid), text);
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(deaf[playerid]) continue;
ProxDetector(20.0,playerid,str,COLOR_LIGHTGREY,COLOR_LIGHTGREY,COLOR_LIGHTGREY,COLOR_LIGHTGREY,COLOR_LIGHTGREY);
}
return 0;
}
|
PHP код:
|
|
Thanks for your help, but I've found new issues.
Deaf people can't talk ( others don't see their message ) For every player in the server, the message is sent again. ( so if i type "hi" and there's 3 players online it's sent 3 times ) Deaf people still hear others talk. |
|
PHP код:
|
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(deaf[i]) continue; //if deaf skip him It was playerid, where it should've bee i all along
SendClientMessage(i, -1, str);
}