[Ajuda] SendClientMessage
#1

Galera fui usar a funзгo SendClientMessage desse jeito:
pawn Код:
if (APlayerData[playerid][PlayerLevel] < 2) return SendClientMessage(playerid, -1, "{FF0000}Vocк nгo tem permissгo para usar esse comando!");
E esta dando os seguintes erros:
pawn Код:
C:\Users\----\Desktop\BmcV2.0\pawno\include\PPC_PlayerCommands.inc(36) : error 029: invalid expression, assumed zero
C:\Users\---\Desktop\BmcV2.0\pawno\include\PPC_PlayerCommands.inc(36 -- 37) : warning 215: expression has no effect
C:\Users\---\Desktop\BmcV2.0\pawno\include\PPC_PlayerCommands.inc(37) : error 001: expected token: ";", but found "return"
C:\Users\---\Desktop\BmcV2.0\pawno\include\PPC_PlayerCommands.inc(43) : warning 225: unreachable code
Reply
#2

Posta o comando inteiro.
Reply
#3

Talvez o problema seja o if. Coloque dessa maneira e veja em qual linha fica o erro:

#Edit: Porque usar um treco de cor {} ao invйs de colocar no lugar do -1 ?

PHP код:
if (APlayerData[playerid][PlayerLevel] < 2
    return 
SendClientMessage(playerid0xFF0000FF"Vocк nгo tem permissгo para usar esse comando!"); 
Reply
#4

Nгo deu certo juniiro
O comando completo й esse:
pawn Код:
COMMAND:relatos(playerid, params[])
{
    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/relatos", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Check if the player's admin-level is at least 1
        if (APlayerData[playerid][PlayerLevel] < 2) return SendClientMessage(playerid, -1, "{FF0000}Vocк nгo й administrador");
        {
            // Add the first report to the list (if it exists)
            if (AReports[0][ReportUsed] == true)
                format(ReportList, 5000, "%s: %s\n", AReports[0][ReportName], AReports[0][ReportReason]);

            // Construct the report-dialog
            for (new i = 1; i < 50; i++)
            {
                // Check if the ReportID has been used already
                if (AReports[i][ReportUsed] == true)
                {
                    format(ReportList, 5000, "%s%s: %s\n", ReportList, AReports[i][ReportName], AReports[i]

[ReportReason]);
                }
            }

            // Show all the reports
            ShowPlayerDialog(playerid, DialogReports, DIALOG_STYLE_LIST, "Lista de Relatos:", ReportList, "Ok",

"Cancelar");
        }
        else
            return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
Reply
#5

Tenta agora

PHP код:
COMMAND:relatos(playeridparams[])
{
    
// Send the command to all admins so they can see it
    
SendAdminText(playerid"/relatos"params);

    
// Check if the player has logged in
    
if (APlayerData[playerid][LoggedIn] == true)
    {
        
// Check if the player's admin-level is at least 1
        
if (APlayerData[playerid][PlayerLevel] < 2
        {
            
// Add the first report to the list (if it exists)
            
if (AReports[0][ReportUsed] == true)
                
format(ReportList5000"%s: %s\n"AReports[0][ReportName], AReports[0][ReportReason]);

            
// Construct the report-dialog
            
for (new 150i++)
            {
                
// Check if the ReportID has been used already
                
if (AReports[i][ReportUsed] == true)
                {
                    
format(ReportList5000"%s%s: %s\n"ReportListAReports[i][ReportName], AReports[i]

[
ReportReason]);
                }
            }

            
// Show all the reports
            
ShowPlayerDialog(playeridDialogReportsDIALOG_STYLE_LIST"Lista de Relatos:"ReportList"Ok",

"Cancelar");
        }
        else
            return 
SendClientMessage(playerid, -1"{FF0000}Vocк nгo й administrador");;
    }
    else
        return 
0;

    
// Let the server know that this was a valid command
    
return 1;

Nгo se abre chaves depois do return!
Reply
#6

Porquк eu nгo posso colocar o SendClientMessage na frnete da variavel if (APlayerData[playerid][PlayerLevel] < 2) ?
Reply
#7

Quote:
Originally Posted by ThiagoMK
Посмотреть сообщение
Porquк eu nгo posso colocar o SendClientMessage na frnete da variavel if (APlayerData[playerid][PlayerLevel] < 2) ?
Pode sim cara. '-'

Exemplo(s):
pawn Код:
if(gay[playerid] != 1) return SendClientMessage(playerid, -1," Vocк nгo й gay, sinto muito.");
pawn Код:
if(gay[playerid] != 1)
{
    SendClientMessage(playerid, -1,"Vocк nгo й gay, sinto muito.");
    return 1;
}
Reply
#8

Quote:
Originally Posted by Coe1
Посмотреть сообщение
Pode sim cara. '-'

Exemplo(s):
pawn Код:
if(gay[playerid] != 1) return SendClientMessage(playerid, -1," Vocк nгo й gay, sinto muito.");
pawn Код:
if(gay[playerid] != 1)
{
    SendClientMessage(playerid, -1,"Vocк nгo й gay, sinto muito.");
    return 1;
}
Eu fiz desse jeito e deu os erros..
Reply
#9

Quote:
Originally Posted by Juniiro3
Посмотреть сообщение
Tenta agora

PHP код:
COMMAND:relatos(playeridparams[])
{
    
// Send the command to all admins so they can see it
    
SendAdminText(playerid"/relatos"params);
    
// Check if the player has logged in
    
if (APlayerData[playerid][LoggedIn] == true)
    {
        
// Check if the player's admin-level is at least 1
        
if (APlayerData[playerid][PlayerLevel] < 2
        {
            
// Add the first report to the list (if it exists)
            
if (AReports[0][ReportUsed] == true)
                
format(ReportList5000"%s: %s\n"AReports[0][ReportName], AReports[0][ReportReason]);
            
// Construct the report-dialog
            
for (new 150i++)
            {
                
// Check if the ReportID has been used already
                
if (AReports[i][ReportUsed] == true)
                {
                    
format(ReportList5000"%s%s: %s\n"ReportListAReports[i][ReportName], AReports[i]
[
ReportReason]);
                }
            }
            
// Show all the reports
            
ShowPlayerDialog(playeridDialogReportsDIALOG_STYLE_LIST"Lista de Relatos:"ReportList"Ok",
"Cancelar");
        }
        else
            return 
SendClientMessage(playerid, -1"{FF0000}Vocк nгo й administrador");;
    }
    else
        return 
0;
    
// Let the server know that this was a valid command
    
return 1;

Nгo se abre chaves depois do return!
Assim й o certo Thiago.. Leia meu post anterior!
Reply
#10

Quote:
Originally Posted by Juniiro3
Посмотреть сообщение
Assim й o certo Thiago.. Leia meu post anterior!
Quero colocar a mensagem em todos os comandos..
Que sґsгo permitidos admin a usar..

@edit
Seu cуdigo deu esse erro:
pawn Код:
C:\Users\---\Desktop\BmcV2.0\pawno\include\PPC_PlayerCommands.inc(41) : error 036: empty statement
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)