SA-MP Forums Archive
Deaf player - 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: Deaf player (/showthread.php?tid=654942)



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(playeridtext[])
{
    new 
name[24], str[144];
    
GetPlayerName(playeridnamesizeof(name));
    
format(strsizeof(str), "%s: %s"nametext); //custom chat
    
for(new 0GetPlayerPoolSize(); <= ji++)
    {
        if(
deaf[playerid]) continue; //if deaf skip him
        
SendClientMessage(i, -1str);
    }
    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(playeridtext[])
{
    new 
name[24], str[144];
    
GetPlayerName(playeridnamesizeof(name));
    
format(strsizeof(str), "%s: %s"nametext); //custom chat
    
for(new 0GetPlayerPoolSize(); <= ji++)
    {
        if(
deaf[playerid]) continue; //if deaf skip him
        
SendClientMessage(i, -1str);
    }
    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(playeridtext[])
{
    new 
str[128];
    
format(strsizeof(str), "%s says: %s"GetName(playerid), text);
    for(new 
0GetPlayerPoolSize(); <= ji++)
    {
        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(playeridtext[])
{
    new 
name[24], str[144];
    
GetPlayerName(playeridnamesizeof(name));
    
format(strsizeof(str), "%s: %s"nametext); //custom chat
    
for(new 0GetPlayerPoolSize(); <= ji++)
    {
        if(
deaf[playerid]) continue; //if deaf skip him
        
SendClientMessage(i, -1str);
    }
    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(playeridtext[])
{
    new 
str[128];
    
format(strsizeof(str), "%s says: %s"GetName(playerid), text);
    for(new 
0GetPlayerPoolSize(); <= ji++)
    {
        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 0GetPlayerPoolSize(); <= ji++) 
    { 
        if(
deaf[i]) continue; //if deaf skip him It was playerid, where it should've bee i all along
        
SendClientMessage(i, -1str); 
    }