SA-MP Forums Archive
Dialog format problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog format problem (/showthread.php?tid=502607)



Dialog format problem - DarkLored - 25.03.2014

so i am kinda new on making formats in dialogs with loops

so i am trying to get the name of a player that has placed a hit on but it is just writing my NPC name

here is the Code

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(Hitman[playerid] == 1)
        {
            new BigString[1900];
            format(BigString,sizeof(BigString),"1.%s(%d)",GetName(IsList[i]),IsList[i]);
            ShowPlayerDialog(playerid,Hitlist,DIALOG_STYLE_MSGBOX,"Hit List",BigString,"Ok","");       
           return 1;
        }
    }



Re: Dialog format problem - DarkLored - 25.03.2014

Any help in my problem?


Re: Dialog format problem - HitterHitman - 25.03.2014

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(Hitman[playerid] == 1)
        {
            new BigString[1900];
            new pname[24];
            GetPlayerName(i,pname,sizeof(pname));
            format(BigString,sizeof(BigString),"1.%s(%d)",pname,i);
            ShowPlayerDialog(playerid,Hitlist,DIALOG_STYLE_MSGBOX,"Hit List",BigString,"Ok","");      
            return 1;
        }
    }
<< This is what you wanted?


Re: Dialog format problem - DarkLored - 25.03.2014

i wanted it to detect only the players that were placed in hit i have a command that use a variable named IsList to store the players but i dont know how to detect it in strings


Re: Dialog format problem - HitterHitman - 25.03.2014

pawn Код:
if(Hitman[playerid] == 1);
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
         if(IsList[i] >= 1)
         {
             new string[1900];
             new pname[24];
             GetPlayerName(i,pname,sizeof(pname));
             format(string,sizeof(string),"%s(%d)",pname(i),i);
             ShowPlayerDialog(playerid,Hitlist,DIALOG_STYLE_MSGBOX,"Hit List",string,"Ok","");      
         }
    }
}
Sorry for poor indentation.

EDIT: Fixed

EDIT 2 : Its fine now, try it.