OnPlayerText
#1

Hello

Code :

PHP код:
public OnPlayerText(playeridtext[])
{
    if(
P_Data[playerid][pMute] == 1
    {
        
SCM(playeridCOLOR_RED"You are muted, noone can hear you!");
        return 
0;
    }
    if(!
strcmp(xCharstext))
    {
        new
        
string[128],
        
xName[MAX_PLAYER_NAME]
        ;
        
GetPlayerName(playeridxNamesizeof(xName));
        
format(stringsizeof(string), "« \%s\" has won the reaction test. »"xName);
        
SendClientMessageToAll(GREENstring);
        
format(stringsizeof(string), "« You have earned $%d »"xCashxScore);
        
SendClientMessage(playeridGREENstring);
        
GivePlayerMoney(playeridxCash);
        
xReactionTimer SetTimer("xReactionTest"TIME1);
        
xTestBusy false;
        return 
0;
    }
    if(
text[0] == '#' && Info[playerid][indm] == 1)
    {
        new 
str[128], name[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof(name));
        
format(strsizeof(str), ""REDx"[DM CHAT] %s: "WHITEx"%s"nametext[1]);
        for(new 
0MAX_PLAYERSi++)
        {
            if(!
IsPlayerConnected(i)) continue;
            if(
Info[i][indm] == )continue;
            
SendClientMessage(i, -1str);
        }
        return 
0;
    }
    if(
IsPlayerAdmin(playerid))
    {
        new 
pname[128];
        
GetPlayerName(playerid,pname,sizeof(pname));
        new 
stf[128];
        new 
stringig[128];
        
format(stfsizeof(stf), "%s [%d] (Administrator): "WHITEx"%s"pnameplayeridtext);
        
SendClientMessageToAll(GetPlayerColor(playerid), stf);
        
format(stringig,sizeof(stringig),"02[%d] 07%s(Administrator): %s",playeridpname,text);
        
IRC_Say(groupIDIRC_ECHOstringig);
        return 
0;
    } 
    else
    {
        new 
pname[128];
        
GetPlayerName(playerid,pname,sizeof(pname));
        new 
stf[128];
        new 
stringig[128];
        
format(stfsizeof(stf), "%s [%d]: "WHITEx"%s"pnameplayeridtext);
        
SendClientMessageToAll(GetPlayerColor(playerid), stf);
        
format(stringig,sizeof(stringig),"02[%d] 07%s: %s",playeridpname,text);
        
IRC_Say(groupIDIRC_ECHOstringig);
        return 
0;
    } 
      return 
1; <---- Line 79

Error :

PHP код:
D:\pawno-master\include\SAPData/Chat/ChatManager.pwn(79) : warning 225unreachable code 
How the hell i can fix this :/
Reply
#2

Umm I think you need to return 0 at the end, and return 1 where you dos return 0, not sure.
Reply
#3

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Umm I think you need to return 0 at the end, and return 1 where you dos return 0, not sure.
still same
Reply
#4

PHP код:
public OnPlayerText(playeridtext[]) 

    if(
P_Data[playerid][pMute] == 1)  
    { 
        
SCM(playeridCOLOR_RED"You are muted, noone can hear you!"); 
        return 
0
    } 
    if(!
strcmp(xCharstext)) 
    { 
        new 
        
string[128], 
        
xName[MAX_PLAYER_NAME
        ; 
        
GetPlayerName(playeridxNamesizeof(xName)); 
        
format(stringsizeof(string), "« \%s\" has won the reaction test. »"xName); 
        
SendClientMessageToAll(GREENstring); 
        
format(stringsizeof(string), "« You have earned $%d »"xCashxScore); 
        
SendClientMessage(playeridGREENstring); 
        
GivePlayerMoney(playeridxCash); 
        
xReactionTimer SetTimer("xReactionTest"TIME1); 
        
xTestBusy false
        return 
0
    } 
    if(
text[0] == '#' && Info[playerid][indm] == 1
    { 
        new 
str[128], name[MAX_PLAYER_NAME]; 
        
GetPlayerName(playeridnamesizeof(name)); 
        
format(strsizeof(str), ""REDx"[DM CHAT] %s: "WHITEx"%s"nametext[1]); 
        for(new 
0MAX_PLAYERSi++) 
        { 
            if(!
IsPlayerConnected(i)) continue; 
            if(
Info[i][indm] == )continue; 
            
SendClientMessage(i, -1str); 
        } 
        return 
0
    } 
    if(
IsPlayerAdmin(playerid)) 
    { 
        new 
pname[128]; 
        
GetPlayerName(playerid,pname,sizeof(pname)); 
        new 
stf[128]; 
        new 
stringig[128]; 
        
format(stfsizeof(stf), "%s [%d] (Administrator): "WHITEx"%s"pnameplayeridtext); 
        
SendClientMessageToAll(GetPlayerColor(playerid), stf); 
        
format(stringig,sizeof(stringig),"02[%d] 07%s(Administrator): %s",playeridpname,text); 
        
IRC_Say(groupIDIRC_ECHOstringig); 
        return 
0
    }  
    else 
    { 
        new 
pname[128]; 
        
GetPlayerName(playerid,pname,sizeof(pname)); 
        new 
stf[128]; 
        new 
stringig[128]; 
        
format(stfsizeof(stf), "%s [%d]: "WHITEx"%s"pnameplayeridtext); 
        
SendClientMessageToAll(GetPlayerColor(playerid), stf); 
        
format(stringig,sizeof(stringig),"02[%d] 07%s: %s",playeridpname,text); 
        
IRC_Say(groupIDIRC_ECHOstringig); 
    }  
      return 
0

Reply
#5

The reason you're getting that warning is because that return 1 will never be called, being as you use return in the if/else statements and that would end the function.
Reply
#6

Thanks !! it's work




-----------
+REP
-----------
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)