dcmd_rulebreakers HELP!!!!
#1

I have constructed this command:
pawn Код:
dcmd_rulebreakers(playerid,params[])
{
    #pragma unused params
    new Count;
    new name[24];
    new string[128];
    new i;
    if(PlayerInfo[playerid][Admin] >= 1)
    {
        for(i = 0; i < MAX_PLAYERS; i++)
        if(IsPlayerConnected(i) && Jail[i] == 1)
        {
            Count++;
        }
        if(!Count) return SendClientMessage(playerid,orange,"Server: No players jailed");
        if(Count == 1)
        {
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Jail[i] == 1) break;
            GetPlayerName(i,name,sizeof(name));
            format(string,sizeof(string),"Server: [JAILED]%s (id:%d)\n",name,i);
            return SendClientMessage(playerid,orange,string);
        }
        if(Count >= 1)
        {
            new bool:First = false;
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Jail[i] == 1)
            {
                GetPlayerName(i,name,sizeof(name));
                if(!First)
                {
                    format(string,sizeof(string),"Server: [JAILED]%s (id:%d)\n",name,i);
                    First = true;
                }
                else
                {
                    format(string,sizeof(string),"Server: [JAILED]%s (id:%d)\n",name,i);
                }
            }
            return SendClientMessage(playerid,orange,string);
        }
        if(IsPlayerConnected(i) && Muted[i] == 1)
        {
            Count++;
        }
        if(!Count) return SendClientMessage(playerid,orange,"Server: No players muted");
        if(Count == 1)
        {
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Muted[i] == 1) break;
            GetPlayerName(i,name,sizeof(name));
            format(string,sizeof(string),"Server: [MUTED]%s (id:%d)\n",name,i);
            return SendClientMessage(playerid,orange,string);
        }
        if(Count >= 1)
        {
            new bool:First = false;
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Muted[i] == 1)
            {
                GetPlayerName(i,name,sizeof(name));
                if(!First)
                {
                    format(string,sizeof(string),"Server: [MUTED]%s (id:%d)\n",name,i);
                    First = true;
                }
                else
                {
                    format(string,sizeof(string),"Server: [MUTED]%s (id:%d)\n",name,i);
                }
            }
            return SendClientMessage(playerid,orange,string);
        }
        if(IsPlayerConnected(i) && Freeze[i] == 1)
        {
            Count++;
        }
        if(!Count) return SendClientMessage(playerid,orange,"Server: No players frozen");
        if(Count == 1)
        {
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Freeze[i] == 1) break;
            GetPlayerName(i,name,sizeof(name));
            format(string,sizeof(string),"Server: [FROZEN]%s (id:%d)\n",name,i);
            return SendClientMessage(playerid,orange,string);
        }
        if(Count >= 1)
        {
            new bool:First = false;
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Freeze[i] == 1)
            {
                GetPlayerName(i,name,sizeof(name));
                if(!First)
                {
                    format(string,sizeof(string),"Server: [FROZEN]%s (id:%d)\n",name,i);
                    First = true;
                }
                else
                {
                    format(string,sizeof(string),"Server: [FROZEN]%s (id:%d)\n",name,i);
                }
            }
            return SendClientMessage(playerid,orange,string);
        }
        return 1;
    }
    else
    {
        return SendClientMessage(playerid,orange,"Server: You do not have sufficient privileges to use this command");
    }
}
Could someone modify this command so it is a dialog like this:

[title]Rule Breakers[/title]

Jailed Players:
No jailed players

Muted Players:
No muted players

Frozen Players:
No frozen players

Could someone modify this command to make it like this please? Your help will be much appreciated.
Reply
#2

Quote:
Originally Posted by Tigerbeast11
Посмотреть сообщение
I have constructed this command:
pawn Код:
dcmd_rulebreakers(playerid,params[])
{
    #pragma unused params
    new Count;
    new name[24];
    new string[128];
    new i;
    if(PlayerInfo[playerid][Admin] >= 1)
    {
        for(i = 0; i < MAX_PLAYERS; i++)
        if(IsPlayerConnected(i) && Jail[i] == 1)
        {
            Count++;
        }
        if(!Count) return SendClientMessage(playerid,orange,"Server: No players jailed");
        if(Count == 1)
        {
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Jail[i] == 1) break;
            GetPlayerName(i,name,sizeof(name));
            format(string,sizeof(string),"Server: [JAILED]%s (id:%d)\n",name,i);
            return SendClientMessage(playerid,orange,string);
        }
        if(Count >= 1)
        {
            new bool:First = false;
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Jail[i] == 1)
            {
                GetPlayerName(i,name,sizeof(name));
                if(!First)
                {
                    format(string,sizeof(string),"Server: [JAILED]%s (id:%d)\n",name,i);
                    First = true;
                }
                else
                {
                    format(string,sizeof(string),"Server: [JAILED]%s (id:%d)\n",name,i);
                }
            }
            return SendClientMessage(playerid,orange,string);
        }
        if(IsPlayerConnected(i) && Muted[i] == 1)
        {
            Count++;
        }
        if(!Count) return SendClientMessage(playerid,orange,"Server: No players muted");
        if(Count == 1)
        {
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Muted[i] == 1) break;
            GetPlayerName(i,name,sizeof(name));
            format(string,sizeof(string),"Server: [MUTED]%s (id:%d)\n",name,i);
            return SendClientMessage(playerid,orange,string);
        }
        if(Count >= 1)
        {
            new bool:First = false;
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Muted[i] == 1)
            {
                GetPlayerName(i,name,sizeof(name));
                if(!First)
                {
                    format(string,sizeof(string),"Server: [MUTED]%s (id:%d)\n",name,i);
                    First = true;
                }
                else
                {
                    format(string,sizeof(string),"Server: [MUTED]%s (id:%d)\n",name,i);
                }
            }
            return SendClientMessage(playerid,orange,string);
        }
        if(IsPlayerConnected(i) && Freeze[i] == 1)
        {
            Count++;
        }
        if(!Count) return SendClientMessage(playerid,orange,"Server: No players frozen");
        if(Count == 1)
        {
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Freeze[i] == 1) break;
            GetPlayerName(i,name,sizeof(name));
            format(string,sizeof(string),"Server: [FROZEN]%s (id:%d)\n",name,i);
            return SendClientMessage(playerid,orange,string);
        }
        if(Count >= 1)
        {
            new bool:First = false;
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Freeze[i] == 1)
            {
                GetPlayerName(i,name,sizeof(name));
                if(!First)
                {
                    format(string,sizeof(string),"Server: [FROZEN]%s (id:%d)\n",name,i);
                    First = true;
                }
                else
                {
                    format(string,sizeof(string),"Server: [FROZEN]%s (id:%d)\n",name,i);
                }
            }
            return SendClientMessage(playerid,orange,string);
        }
        return 1;
    }
    else
    {
        return SendClientMessage(playerid,orange,"Server: You do not have sufficient privileges to use this command");
    }
}
Could someone modify this command so it is a dialog like this:

[title]Rule Breakers[/title]

Jailed Players:
No jailed players

Muted Players:
No muted players

Frozen Players:
No frozen players

Could someone modify this command to make it like this please? Your help will be much appreciated.
Try adding {} (Brackets) in your loops.
Reply
#3

Just format the strings and do

pawn Код:
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, "Rule Breakers", string "\n" string1"\n" string2, "Ok", "Close");
Reply
#4

Could you please modify the original script I have given you. I think the this code will give me errors:

pawn Код:
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, "Rule Breakers", string "\n" string1"\n" string2, "Ok", "Close");
Reply
#5

Help?

So far, this is what my script looks like:

pawn Код:
dcmd_rulebreakers(playerid,params[])
{
    #pragma unused params
    new Count1;
    new Count2;
    new Count3;
    new Count4;
    new name[24];
    new string1[128];
    new string2[128];
    new string3[128];
    new string4[128];
    new i;
    if(PlayerInfo[playerid][Admin] >= 1)
    {
        for(i = 0; i < MAX_PLAYERS; i++)
        if(IsPlayerConnected(i) && Jail[i] == 1)
        {
            Count1++;
        }
        if(!Count1) return format(string1,sizeof(string1),"No Players Jailed");
        else if(Count1 == 1)
        {
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Jail[i] == 1) break;
            GetPlayerName(i,name,sizeof(name));
            format(string1,sizeof(string1),"[JAILED]%s (id:%d)\n",name,i);
        }
        else if(Count1 >= 1)
        {
            new bool:First = false;
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Jail[i] == 1)
            {
                GetPlayerName(i,name,sizeof(name));
                if(!First)
                {
                    format(string1,sizeof(string1),"[JAILED]%s (id:%d)\n",name,i);
                    First = true;
                }
                else
                {
                    format(string1,sizeof(string1),"[JAILED]%s (id:%d)\n",name,i);
                }
            }
        }
        if(IsPlayerConnected(i) && Muted[i] == 1)
        {
            Count2++;
        }
        if(!Count2) return format(string2,sizeof(string2),"No Players Muted");
        else if(Count2 == 1)
        {
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Muted[i] == 1) break;
            GetPlayerName(i,name,sizeof(name));
            format(string2,sizeof(string2),"[MUTED]%s (id:%d)\n",name,i);
        }
        else if(Count2 >= 1)
        {
            new bool:First = false;
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Muted[i] == 1)
            {
                GetPlayerName(i,name,sizeof(name));
                if(!First)
                {
                    format(string2,sizeof(string2),"[MUTED]%s (id:%d)\n",name,i);
                    First = true;
                }
                else
                {
                    format(string2,sizeof(string2),"[MUTED]%s (id:%d)\n",name,i);
                }
            }
        }
        if(IsPlayerConnected(i) && Freeze[i] == 1)
        {
            Count3++;
        }
        if(!Count3) return format(string3,sizeof(string3),"No Players Frozen");
        else if(Count3 == 1)
        {
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Freeze[i] == 1) break;
            GetPlayerName(i,name,sizeof(name));
            format(string3,sizeof(string3),"[FROZEN]%s (id:%d)\n",name,i);
        }
        else if(Count3 >= 1)
        {
            new bool:First = false;
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Freeze[i] == 1)
            {
                GetPlayerName(i,name,sizeof(name));
                if(!First)
                {
                    format(string3,sizeof(string3),"[FROZEN]%s (id:%d)\n",name,i);
                    First = true;
                }
                else
                {
                    format(string3,sizeof(string3),"[FROZEN]%s (id:%d)\n",name,i);
                }
            }
        }
        return ShowPlayerDialog(playerid,999,DIALOG_STYLE_MSGBOX,"Rule Breakers",string1 "\n" string2 "\n" string3,"OK","");
    }
    else
    {
        return SendClientMessage(playerid,orange,"Server: You do not have sufficient privileges to use this command");
    }
}

I have made this line:

pawn Код:
return ShowPlayerDialog(playerid,999,DIALOG_STYLE_MSGBOX,"Rule Breakers",string1 "\n" string2 "\n" string3,"OK","");
But it gives me these errors:

Код:
test.pwn(1034) : error 001: expected token: "-string end-", but found "-identifier-"
test.pwn(1034) : warning 215: expression has no effect
test.pwn(1034) : error 001: expected token: ";", but found "-identifier-"
test.pwn(1034) : error 001: expected token: "-string end-", but found "-identifier-"
test.pwn(1034) : fatal error 107: too many error messages on one line
Can somebody please help me:
Reply
#6

Use format.
Reply
#7

Thanks!
Reply
#8

you have a problem here:

Код:
,"OK","");
do it like this:
Код:
,"OK","EXIT");
it must be like this:
pawn Код:
return ShowPlayerDialog(playerid,999,DIALOG_STYLE_MSGBOX,"Rule Breakers",string1 "\n" string2 "\n" string3,"OK","EXIT");
Reply
#9

pawn Код:
dcmd_rulebreakers(playerid,params[])
{
    #pragma unused params
    new Count1;
    new Count2;
    new Count3;
    new name[24];
    new string1[128];
    new string2[128];
    new string3[128];
    new string4[128];
    new i;
    if(PlayerInfo[playerid][Admin] >= 1)
    {
        for(i = 0; i < MAX_PLAYERS; i++)
        if(IsPlayerConnected(i) && Jail[i] == 1)
        {
            Count1++;
        }
        if(!Count1) return format(string1,sizeof(string1),"No Players Jailed");
        else if(Count1 == 1)
        {
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Jail[i] == 1) break;
            GetPlayerName(i,name,sizeof(name));
            format(string1,sizeof(string1),"[JAILED]%s (id:%d)\n",name,i);
        }
        else if(Count1 >= 1)
        {
            new bool:First = false;
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Jail[i] == 1)
            {
                GetPlayerName(i,name,sizeof(name));
                if(!First)
                {
                    format(string1,sizeof(string1),"[JAILED]%s (id:%d)\n",name,i);
                    First = true;
                }
                else
                {
                    format(string1,sizeof(string1),"[JAILED]%s (id:%d)\n",name,i);
                }
            }
        }
        if(IsPlayerConnected(i) && Muted[i] == 1)
        {
            Count2++;
        }
        if(!Count2) return format(string2,sizeof(string2),"No Players Muted");
        else if(Count2 == 1)
        {
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Muted[i] == 1) break;
            GetPlayerName(i,name,sizeof(name));
            format(string2,sizeof(string2),"[MUTED]%s (id:%d)\n",name,i);
        }
        else if(Count2 >= 1)
        {
            new bool:First = false;
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Muted[i] == 1)
            {
                GetPlayerName(i,name,sizeof(name));
                if(!First)
                {
                    format(string2,sizeof(string2),"[MUTED]%s (id:%d)\n",name,i);
                    First = true;
                }
                else
                {
                    format(string2,sizeof(string2),"[MUTED]%s (id:%d)\n",name,i);
                }
            }
        }
        if(IsPlayerConnected(i) && Freeze[i] == 1)
        {
            Count3++;
        }
        if(!Count3) return format(string3,sizeof(string3),"No Players Frozen");
        else if(Count3 == 1)
        {
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Freeze[i] == 1) break;
            GetPlayerName(i,name,sizeof(name));
            format(string3,sizeof(string3),"[FROZEN]%s (id:%d)\n",name,i);
        }
        else if(Count3 >= 1)
        {
            new bool:First = false;
            for(i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i) && Freeze[i] == 1)
            {
                GetPlayerName(i,name,sizeof(name));
                if(!First)
                {
                    format(string3,sizeof(string3),"[FROZEN]%s (id:%d)\n",name,i);
                    First = true;
                }
                else
                {
                    format(string3,sizeof(string3),"[FROZEN]%s (id:%d)\n",name,i);
                }
            }
        }
        format(string4,sizeof(string4),"%s\n%s\n%s\n",string1,string2,string3);
        return ShowPlayerDialog(playerid,999,DIALOG_STYLE_MSGBOX,"Rule Breakers",string4,"OK","");
    }
    else
    {
        return SendClientMessage(playerid,orange,"Server: You do not have sufficient privileges to use this command");
    }
}
When I type /rulebreakers nothing happens :/
Reply
#10

Quote:
Originally Posted by [GTA]AmericanGangster
Посмотреть сообщение
you have a problem here:

Код:
,"OK","");
do it like this:
Код:
,"OK","EXIT");
it must be like this:
pawn Код:
return ShowPlayerDialog(playerid,999,DIALOG_STYLE_MSGBOX,"Rule Breakers",string1 "\n" string2 "\n" string3,"OK","EXIT"
I think you should read this:
https://sampwiki.blast.hk/wiki/ShowPlayerDialog
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)