Help whit this warning
#1

Hello, I have this code:

PHP код:
                new string[44];
                new 
clickedplayerid GetPVarInt(playerid,"ClickedPlayer");
                new 
muteID[MAX_PLAYERS];
                new 
id;
                
muteID[clickedplayerid] = id;
                    
format(stringsizeof(string), "%s is muted"GetPlayerNameEx(clickedplayerid) );
                
SendClientMessageToAll(COLOR_ORANGEstring);
                {
                if( 
pDataclickedplayerid ][ P_MUTE ] = )
                return 
SendClientMessage(playeridCOLOR_RED"Player is muted.");
                }
                
pDataclickedplayerid ][P_MUTE] = 1;
                    return 
1
And when I'm compiling:

Код:
warning 211: possibly unintended assignment
The line:
PHP код:
                if( pDataclickedplayerid ][ P_MUTE ] = 
Help please, regards
Reply
#2

pawn Код:
if( pData[ clickedplayerid ][ P_MUTE ] == 1 )
use "==" inside if statements, use "=" if you want to assign a new variable to it, like

pawn Код:
new a = 0;
if( a == 0 ) b = 1;
Reply
#3

thank you very much, another thing: when I use the command gives me "Player is muted." but also sends the message "%s is muted" Why?. Should not appear "% s is muted".
Reply
#4

Just remove these two lines:
pawn Код:
format(string, sizeof(string), "%s is muted", GetPlayerNameEx(clickedplayerid) );
                SendClientMessageToAll(COLOR_ORANGE, string);
Making it look like:
pawn Код:
new string[44];
                new clickedplayerid = GetPVarInt(playerid,"ClickedPlayer");
                new muteID[MAX_PLAYERS];
                new id;
                muteID[clickedplayerid] = id;
                   
                if( pData[ clickedplayerid ][ P_MUTE ] = 1 )
                return SendClientMessage(playerid, COLOR_RED, "Player is muted.");
           
                pData[ clickedplayerid ][P_MUTE] = 1;
                    return 1;
Reply
#5

Quote:
Originally Posted by iFiras
Посмотреть сообщение
Just remove these two lines:
pawn Код:
format(string, sizeof(string), "%s is muted", GetPlayerNameEx(clickedplayerid) );
                SendClientMessageToAll(COLOR_ORANGE, string);
Making it look like:
pawn Код:
new string[44];
                new clickedplayerid = GetPVarInt(playerid,"ClickedPlayer");
                new muteID[MAX_PLAYERS];
                new id;
                muteID[clickedplayerid] = id;
                   
                if( pData[ clickedplayerid ][ P_MUTE ] = 1 )
                return SendClientMessage(playerid, COLOR_RED, "Player is muted.");
           
                pData[ clickedplayerid ][P_MUTE] = 1;
                    return 1;
THANK YOU!!!!!!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)