Help [/wanted] dialog.
#1

Hello, I order /wanted dialogue and want to show everyone that they wanted not just one, you have to do to look at all not just one? Please help me.

Command:
PHP код:
    if(strcmp(cmd"/wanted"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
           {
            if(
IsACop(playerid))
            {
                new 
jobs[1024];
                for(new 
i=0MAX_PLAYERSi++)
                {
                    if(
IsPlayerConnected(i))
                    {
                        if(
WantedLevel[i] > 0)
                        {
                            
GetPlayerName(igiveplayersizeof(giveplayer));
                            
format(jobssizeof(jobs), "%s - Wanted Level {FF0000}%d\n{FFFFFF}",giveplayer,WantedLevel[i]);
                              
ShowPlayerDialog(playerid,153,DIALOG_STYLE_LIST,"Suspecti cu wanted",jobs,"Ok""");
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_BANI"Momentan nu sunt suspecti cu wanted.");
                        }
                    }
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"* Nu esti politist!");
            }
        }
//not connected
        
return 1;
    } 
Reply
#2

pawn Код:
if(strcmp(cmd, "/wanted", true) == 0)
    {
        if(IsPlayerConnected(playerid))
           {
            if(IsACop(playerid))
            {
                new jobs[1024];
                for(new i=0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(WantedLevel[i] > 0)
                        {
                            GetPlayerName(i, giveplayer, sizeof(giveplayer));
                            format(jobs, sizeof(jobs), "%s - Wanted Level {FF0000}%d\n{FFFFFF}",giveplayer,WantedLevel[i]);
                              ShowPlayerDialog(i,153,DIALOG_STYLE_LIST,"Suspecti cu wanted",jobs,"Ok", "");
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_BANI, "Momentan nu sunt suspecti cu wanted.");
                        }
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "* Nu esti politist!");
            }
        }//not connected
        return 1;
    }
Reply
#3

Back to edit, I'm going to test.
Reply
#4

Do not go ... just look at the player and wantedu older, I want to show that they wanted all players, not just one
Reply
#5

pawn Код:
if(strcmp(cmd, "/wanted", true) == 0)
    {
        if(IsPlayerConnected(playerid))
           {
            if(IsACop(playerid))
            {
                new jobs[1024];
                for(new i=0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(WantedLevel[i] > 0)
                        {
                            GetPlayerName(i, giveplayer, sizeof(giveplayer));
                            format(jobs, sizeof(jobs), "%s %s- Wanted Level {FF0000}%d\n{FFFFFF}",jobs,giveplayer,WantedLevel[i]);
                              ShowPlayerDialog(i,153,DIALOG_STYLE_LIST,"Suspecti cu wanted",jobs,"Ok", "");
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_BANI, "Momentan nu sunt suspecti cu wanted.");
                        }
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "* Nu esti politist!");
            }
        }//not connected
        return 1;
    }
Reply
#6

pawn Код:
if(strcmp(cmd, "/wanted", true) == 0)
    {
        if(IsPlayerConnected(playerid))
           {
            if(IsACop(playerid))
            {
                new jobs[254];
                new string[1024];
                for(new i=0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(WantedLevel[i] > 0)
                        {
                            GetPlayerName(i, giveplayer, sizeof(giveplayer));
                            format(jobs, sizeof(jobs), "%s%s - Wanted Level {FF0000}%d\n{FFFFFF}",string,giveplayer,WantedLevel[i]); //you don't need a big size for this thinggy
                            strcat(string,jobs);
                        }
                    }
                }
                ShowPlayerDialog(playerid,153,DIALOG_STYLE_LIST,"Suspecti cu wanted",string,"Ok", "");
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "* Nu esti politist!");
            }
        }//not connected
        return 1;
    }
hope this help
Reply
#7

pawn Код:
if(strcmp(cmdtext, "/wanted", true) == 0)
    {
        if(!IsPlayerConnected(playerid)) return 1;
        if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "* Nu esti politist!");
        new jobs[1024], count = 0, fstr[65], wantedname[MAX_PLAYER_NAME];
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(!IsPlayerConnected(i)) continue;
            if(!WantedLevel[i]) continue;
            count++;
            if(count > 15) continue;
            GetPlayerName(i, wantedname, sizeof(wantedname));
            format(fstr, sizeof(fstr), "%s - Wanted Level {FF0000}%d\n{FFFFFF}", wantedname, WantedLevel[i]);
            strcat(jobs, fstr);
        }
        if(!count) return SendClientMessage(playerid, COLOR_BANI, "Momentan nu sunt suspecti cu wanted.");\
        else if(count > 15)
        {
            format(fstr, sizeof(fstr), "{FF0000}Exista o suplimentare de %d vrut jucatori online.", (count - 15));
            strcat(jobs, fstr);
        }
        ShowPlayerDialog(playerid, 153, DIALOG_STYLE_MSGBOX, "Suspecti cu wanted", jobs, "Ok", "");
        return 1;
    }
Sorry if my translation isn't correct, lol.
Reply
#8

AiRaLoKa, the id 0 show 2 times when someone has wanted and the id 1 shows correctly.
Reply
#9

sorry about that, it's my mistake :3

i don't know is it work or not....
pawn Код:
if(strcmp(cmd, "/wanted", true) == 0)
    {
        if(IsPlayerConnected(playerid))
           {
            if(IsACop(playerid))
            {
                new jobs[254];
                new string[1024];
                new count=0;
                for(new i=0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(WantedLevel[i] > 0)
                        {
                            GetPlayerName(i, giveplayer, sizeof(giveplayer));
                            if(count == 0)
                            {
                                format(jobs, sizeof(jobs), "%s - Wanted Level {FF0000}%d\n{FFFFFF}",giveplayer,WantedLevel[i]); //you don't need a big size for this thinggy
                            }
                            else if(count > 0)
                            {
                                format(jobs, sizeof(jobs), "%s%s - Wanted Level {FF0000}%d\n{FFFFFF}",string,giveplayer,WantedLevel[i]); //you don't need a big size for this thinggy
                            }
                            strcat(string,jobs);
                            count++;
                        }
                    }
                }
                ShowPlayerDialog(playerid,153,DIALOG_STYLE_LIST,"Suspecti cu wanted",string,"Ok", "");
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "* Nu esti politist!");
            }
        }//not connected
        return 1;
    }
Reply
#10

Thanks, I'll come back to edit if it works or not
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)