ShowPlayerDialog
#3

There are a number of ways to do this. Here is a way which will make it easier if / when you add new commands to your script.

First, create a global variable.
Naturally you will have to put in your own commands and descriptions.
pawn Код:
new ComGeneral[][] =
{
    { "/login" },
    { "/logout" },
    { "/logkill" },
    { "/kill" },
    { "/register" },
    { "/forum" },
    { "/accept" },
    { "/cancel" },
    { "/graph" },
    { "/joinballas" },
    { "/joinvagos" },
    { "/spawnchange" },
    { "/buyhouse" },
    { "/sellhouse" },
    { "/houseinvite" },
    { "/v" },
    { "/givekey" },
    { "/lock" },
    { "/unlock" },
    { "/winch" },
    { "/join" },
    { "/quitjob" },
    { "/report" },
    { "/paycheck" },
    { "/signcheck" },
    { "/service" },
    { "/lotto" },
    { "/fish" }
};
Then you can use string processing to construct the dialog.
If I were doing it, I would use the list style
pawn Код:
if( !strcmp( cmdtext , "/cmds" , true ) )
{
    new
        dialog[512],
        part[36]
    ;
    format( dialog , sizeof(dialog) , "{FFFFFF}%s" , ComGeneral[0] );
    for( new i = 1; i < sizeof( ComGeneral ); i++ )
    {
        format( part , sizeof(part) , "\n%s" , ComGeneral[i] );
        strcat( dialog , part , sizeof(dialog) );
    }
    printf( "[string check] dialog length %d ( size %d )" , strlen( dialog ) , sizeof(dialog) );
    // use this to check that the size of dialog is sufficient
   
    ShowPlayerDialog( playerid , 5 , DIALOG_STYLE_LIST , "Commands" , dialog , "Close" , "" );
    return 1;
}
The limit for one line in pawno ( ie the editor / compiler ) is lower than the limit on dialog size.
To make sure your dialog string is big enough, adjust the size of 'dialog' until it is at least 5 chars longer than the string length.
Reply


Messages In This Thread
ShowPlayerDialog - by Kostas' - 12.10.2011, 08:38
Re: ShowPlayerDialog - by iJumbo - 12.10.2011, 08:47
Re: ShowPlayerDialog - by Rachael - 12.10.2011, 08:55
Re: ShowPlayerDialog - by Kostas' - 12.10.2011, 09:02

Forum Jump:


Users browsing this thread: 1 Guest(s)