Deaf player -
Stefhan - 09.06.2018
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?
Re: Deaf player -
Lokii - 09.06.2018
PHP код:
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
}
Re: Deaf player -
Stefhan - 09.06.2018
Quote:
Originally Posted by Lokii
PHP код:
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
}
|
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.
Re: Deaf player -
Logic_ - 09.06.2018
Stop requesting code and show us your code what you've done so far.
Re: Deaf player -
Stefhan - 09.06.2018
Quote:
Originally Posted by Logic_
Stop requesting code and show us your code what you've done so far.
|
PHP код:
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;
}
Re: Deaf player -
Livity - 09.06.2018
Quote:
Originally Posted by Lokii
PHP код:
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
}
|
Quote:
Originally Posted by Stefhan
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.
|
Thats because the code he gave you only checks for "Deaf" players, but not set them as deaf. So you need to make a command or some system which will set the player Deaf variable to 1.
Re: Deaf player -
Logic_ - 09.06.2018
Quote:
Originally Posted by Stefhan
PHP код:
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;
}
|
That's what Lokii has given you, you've not scripted it. Show us the code that you've scripted or attempted to do.
EDIT: If you're a complete amateur, then go and learn the basics and instead of asking for code.
Re: Deaf player -
Stefhan - 09.06.2018
Quote:
Originally Posted by Livity
Thats because the code he gave you only checks for "Deaf" players, but not set them as deaf. So you need to make a command or some system which will set the player Deaf variable to 1.
|
I have a command that sets it to true and another one that sets it to false.
Re: Deaf player -
Livity - 09.06.2018
Quote:
Originally Posted by Stefhan
I have a command that sets it to true and another one that sets it to false.
|
Thats why @Logic_ is telling you to show all the codes that you use for the system, we cant help if we don't see codes.
Re: Deaf player -
Sew_Sumi - 09.06.2018
What in the actual fuck...
Look at the code people... The loop that Loki gave, is incorrect...
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);
}