Deaf player
#1

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

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

Reply
#3

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

Stop requesting code and show us your code what you've done so far.
Reply
#5

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;

Reply
#6

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

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

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

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

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); 
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)