SA-MP Forums Archive
[Ajuda] SendClientMessage - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] SendClientMessage (/showthread.php?tid=462183)



SendClientMessage - ThiagoMK - 05.09.2013

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



Re: SendClientMessage - Russo66 - 05.09.2013

Posta o comando inteiro.


Re: SendClientMessage - Juniiro3 - 05.09.2013

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!"); 



Re : SendClientMessage - ThiagoMK - 05.09.2013

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



Re: SendClientMessage - Juniiro3 - 05.09.2013

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!


Re : SendClientMessage - ThiagoMK - 05.09.2013

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


Re: Re : SendClientMessage - Coe1 - 05.09.2013

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



Re : Re: Re : SendClientMessage - ThiagoMK - 05.09.2013

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


Re: SendClientMessage - Juniiro3 - 05.09.2013

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!


Re : Re: SendClientMessage - ThiagoMK - 06.09.2013

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