Dialog buggy + rep for those who help !!!
#1

I'm doing a command / report with the information that players are online or offline, only the second line of dialogue informs properly if the player is online or not, the second line down is all offline, help please?

PHP код:
command(relatoplayeridparams[]) { 
    new 
OtherPlayerName[24], Reason[128], Msg[128]; 
    
SendAdminText(playerid"/relato"params); 
    if (
APlayerData[playerid][LoggedIn] == true
    { 
        if (
sscanf(params"us[128]"OtherPlayerReason)) SendClientMessage(playerid0xFF0000AA"Uso: \"/relato [id] [causa]"); 
        else 
        { 
            if (
APlayerData[OtherPlayer][LoggedIn] == true
            { 
                
SendReportToAdmins(OtherPlayerReason); 
                
GetPlayerName(OtherPlayerNamesizeof(Name)); 
                
format(Msg128"Seu relato contra jogador(a) %s foi enviado aos administradores "Name)); 
                
SendClientMessage(playerid0x808080FFMsg); 
                 
                if (
AReports[0][ReportUsed] == true
                
format(ReportList5000"%s: %s - %s\n"AReports[0][ReportName], AReports[0][ReportReason], IsPlayerConnected(OtherPlayer) ? ("Online") : ("Offline")); 
            for (new 
150i++) 
            { 
                if (
AReports[i][ReportUsed] == true
                { 
                    
format(ReportList5000"%s%s: %s - %s\n"ReportListAReports[i][ReportName], AReports[i][ReportReason], IsPlayerConnected(i) ? ("Online") : ("Offline")); 
                } 
            } 
            
ShowPlayerDialog(playeridDialogReportsDIALOG_STYLE_MSGBOX"Relatуrio:"ReportList"OK""Cancelar"); 
            } 
            else 
                
SendClientMessage(playerid0xff000099"ERRO:O jogador nao estб conectado."); 
        } 
    } 
    else 
        return 
0
     
    return 
1

Reply
#2

Hello!

Can you send us your code of this command?


- Mencent
Reply
#3

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

Can you send us your code of this command?


- Mencent
Yes friend, added code
Reply
#4

Yes, thanks!

Try this, please:
PHP код:
command(relato,playerid,params[])
{
    new 
OtherPlayer,Name[24],Reason[128],Msg[145];
    
SendAdminText(playerid,"/relato",params);
    if(
APlayerData[playerid][LoggedIn] == true)
    {
        if(
sscanf(params,"us[128]",OtherPlayer,Reason))return SendClientMessage(playerid,0xFF0000AA,"Uso: \"/relato [id] [causa]");
        if(
APlayerData[OtherPlayer][LoggedIn] == true)
        {
            
SendReportToAdmins(OtherPlayer,Reason);
            
GetPlayerName(OtherPlayer,Name,sizeof Name);
            
format(Msg,sizeof Msg,"Seu relato contra jogador(a) %s foi enviado aos administradores",Name);
            
SendClientMessage(playerid,0x808080FF,Msg);
            for(new 
i;i<50;i++)
            {
                if(
AReports[i][ReportUsed] == true)
                {
                    
format(ReportList,5000,"%s%s: %s - %s\n",ReportList,AReports[i][ReportName],AReports[i][ReportReason],(IsPlayerConnect(i)) ? ("Online") : ("Offline"));
                }
            }
            
ShowPlayerDialog(playeridDialogReportsDIALOG_STYLE_MSGBOX"Relatуrio:"ReportList"OK""Cancelar");
        }
        return 
SendClientMessage(playerid0xff000099"ERRO:O jogador nao estб conectado.");
    }
    return 
1;

If it doesn't work, can you do a screenshot?

- Mencent
Reply
#5

Thank you for trying to help but it did not work ...

see as it was:

Reply
#6

PHP код:
command(relato,playerid,params[])
{
    new 
OtherPlayer,Name[24],Reason[128],Msg[145];
    
SendAdminText(playerid,"/relato",params);
    if(
APlayerData[playerid][LoggedIn] == true)
    {
        if(
sscanf(params,"us[128]",OtherPlayer,Reason))return SendClientMessage(playerid,0xFF0000AA,"Uso: \"/relato [id] [causa]");
        if(
APlayerData[OtherPlayer][LoggedIn] == true)
        {
            
SendReportToAdmins(OtherPlayer,Reason);
            
GetPlayerName(OtherPlayer,Name,sizeof Name);
            
format(Msg,sizeof Msg,"Seu relato contra jogador(a) %s foi enviado aos administradores",Name);
            
SendClientMessage(playerid,0x808080FF,Msg);
            for(new 
i;i<50;i++)
            {
                if(
AReports[i][ReportUsed] == true)
                {
                    
format(ReportList,5000,"%s%s: %s - %s\n",ReportList,AReports[i][ReportName],AReports[i][ReportReason],(IsPlayerConnected(GetPlayerID(AReports[i][ReportName]))) ? ("Online") : ("Offline"));
                }
            }
            
ShowPlayerDialog(playeridDialogReportsDIALOG_STYLE_MSGBOX"Relatуrio:"ReportList"OK""Cancelar");
        }
        return 
SendClientMessage(playerid0xff000099"ERRO:O jogador nao estб conectado.");
    }
    return 
1;
}
GetPlayerID(name[])//at the end of the script
{
    new 
tmp[MAX_PLAYER_NAME];
    for(new 
i;i<MAX_PLAYERS;i++)
    {
        if(!
GetPlayerName(i,tmp,sizeof tmp))break;
        if(!
strcmp(name,tmp,true))return i;
    }
    return -
1;

And so?
Reply
#7

it was not : '( , I think there's no way to fazer
Reply
#8

up...?
Reply
#9

PHP код:
format(ReportList,5000,"%s%s: %s - %s\n" 
For what is the second %s and the third %s?

• second %s => The player who wrote the report?
• third %s => The title of the report?

Please answer the question so that I can help you.

- Mencent
Reply
#10

pawn Код:
CMD:reportar(playerid, params[])
{
    if(!APlayerData[playerid][LoggedIn]) return 0;
   
    new OtherPlayer, Reason[128];
    if (sscanf(params, "us[128]", OtherPlayer, Reason)) return SendClientMessage(playerid, 0xFF0000AA, "Digite: \"/reportar <Player> <Seu Report>\"");
    if (!APlayerData[OtherPlayer][LoggedIn]) return SendClientMessage(playerid, 0xFFFFFFFF, "O Player nao esta Online");

    new Name[24], Msg[128];
    SendReportToAdmins(OtherPlayer, Reason);

    GetPlayerName(OtherPlayer, Name, sizeof(Name));
   
    format(Msg, 128, "Voce Reportou {FFFFFF}%s", Name);
    SendClientMessage(playerid, 0xFFFFFFFF, Msg);
    return 1;
}

command(relato,playerid,params[])
{
    SendAdminText(playerid,"/relato",params);
    if(!APlayerData[playerid][LoggedIn]) return 0;
   
    new OtherPlayer, Reason[128];
    if(sscanf(params,"us[128]",OtherPlayer,Reason))return SendClientMessage(playerid,0xFF0000AA,"Uso: \"/relato [id] [causa]");
    if(!APlayerData[OtherPlayer][LoggedIn]) return SendClientMessage(playerid, 0xff000099, "ERRO:O jogador nao estб conectado.");

    SendReportToAdmins(OtherPlayer,Reason);

    new Name[24], msg[128], dest[256]
    GetPlayerName(OtherPlayer,Name,sizeof Name);
    format(msg,128,"Seu relato contra jogador(a) %s foi enviado aos administradores", Name);
    SendClientMessage(playerid,0x808080FF,msg);
   
    for(new i;i<sizeof(AReports);i++)
    {
        if(AReports[i][ReportUsed])
        {
            format(ReportList,5000,"%s%s: %s - %s\n",ReportList,AReports[i][ReportName],AReports[i][ReportReason],(IsPlayerConnect(i)) ? ("Online") : ("Offline"));

            strcat(dest, ReportList);
        }
    }
    ShowPlayerDialog(playerid, DialogReports, DIALOG_STYLE_MSGBOX, "Relatуrio:", dest, "OK", "Cancelar");
   
    return 1;
}
Reply
#11

Why do you use "i"?

i has the value of sizeof(AReports) (50).

You should use the playerid...



- Mencent
Reply
#12

To testando aqui ja venho falar se deu certo...
Reply
#13

Well. Does it work now?


- Mencent
Reply
#14

Enfim deu certo Mencent muito obrigado vou reputalo.
Reply
#15

Quote:
Originally Posted by Mencent
View Post
Why do you use "i"?

i has the value of sizeof(AReports) (50).

You should use the playerid...



- Mencent
It isn\'t for the ID/Name, the names are already saved in his "AReports[i][ReportName]" so I don\'t have to get his name again, I didn\'t notice "IsPlayerConnect(i)" though, thanks for pointing that out

pawn Code:
CMD:reportar(playerid, params[])
{
    if(!APlayerData[playerid][LoggedIn]) return 0;

    new OtherPlayer, Reason[128];
    if (sscanf(params, "us[128]", OtherPlayer, Reason)) return SendClientMessage(playerid, 0xFF0000AA, "Digite: \"/reportar <Player> <Seu Report>\"");
    if (!APlayerData[OtherPlayer][LoggedIn]) return SendClientMessage(playerid, 0xFFFFFFFF, "O Player nao esta Online");

    new Name[24], Msg[128];
    SendReportToAdmins(OtherPlayer, Reason);

    GetPlayerName(OtherPlayer, Name, sizeof(Name));

    format(Msg, 128, "Voce Reportou {FFFFFF}%s", Name);
    SendClientMessage(playerid, 0xFFFFFFFF, Msg);
    return 1;
}

command(relato,playerid,params[])
{
    SendAdminText(playerid,"/relato",params);
    if(!APlayerData[playerid][LoggedIn]) return 0;

    new OtherPlayer, Reason[128];
    if(sscanf(params,"us[128]",OtherPlayer,Reason))return SendClientMessage(playerid,0xFF0000AA,"Uso: \"/relato [id] [causa]");
    if(!APlayerData[OtherPlayer][LoggedIn]) return SendClientMessage(playerid, 0xff000099, "ERRO:O jogador nao estб conectado.");

    SendReportToAdmins(OtherPlayer,Reason);

    new Name[24], msg[128], dest[256], bool:OnlineState;
    GetPlayerName(OtherPlayer,Name,sizeof Name);
    format(msg,128,"Seu relato contra jogador(a) %s foi enviado aos administradores", Name);
    SendClientMessage(playerid,0x808080FF,msg);
   
    for(new i;i<sizeof(AReports);i++)
    {
        if(AReports[i][ReportUsed])
        {
            for(new p, j = GetPlayerPoolSize(); i<j; i++) if(IsPlayerConnected(p))
            {
                GetPlayerName(p, name, MAX_PLAYER_NAME);
                if(!strcmp(name, AReports[i][ReportName])) OnlineState = true;
            }

            format(ReportList,5000,"%s%s: %s - %s
"
,ReportList,AReports[i][ReportName],AReports[i][ReportReason],(OnlineState) ? ("Online") : ("Offline"));

            strcat(dest, ReportList);
            OnlineState = false;
        }
    }
    ShowPlayerDialog(playerid, DialogReports, DIALOG_STYLE_MSGBOX, "Relatуrio:", dest, "OK", "Cancelar");

    return 1;
}


This isn\'t the best way to do this though.
Reply


Forum Jump:


Users browsing this thread: 11 Guest(s)