Dynamic Dialog List
#2

Your best option would be to make an enumerator, IMO. Here's an idea:

PHP код:
enum 911_CALL_DATA
{
     
boolcallExists,
     
callLocation[90],
     
callEmergency[128],
     
callDescription[90],
     
callerName[32],
}
new 
911Data[100][911_CALL_DATA]; 
I assume you already have a command to call. During the initial /call 911, loop through 911Data and grab a free ID and store it in a player variable. Such as:

PHP код:
//Top of your script:
new player911Index[MAX_PLAYERS]; 
//Inside /call 911:
for(new 0sizeof(911Data); i++)
{
     if(!
911Data[i][callExists])
     {
         
player911Index[playerid] = i;
         break;
     }

During each step of call (using OnPlayerText for this instance), you can add each part:
PHP код:
OnPlayerText(playeridtext[])
{
    switch(
player911CallStep[playerid])
    {
       case 
location:
       {
             
format(911Data[player911Index[playerid]][callLocation], 90"%s"text);
       }
    }

And so on...

At the end when the call is ended would be the best part to make callExists true.

This is assuming you have a MDC with 911 list in it:

PHP код:
#define DIALOG_911_LIST 555
OnDialogResponse(playerid, ...)
{
     case 
YOUR_911_DIALOG:
     {
         if(
response)
         {
              switch(
listitem)
              {
                 case 
YOUR_911LIST_LIST:
                 {
                     new 
principal_str[650], sub_str[128];
                     
strcat(principal_str"Caller\tLocation\t\n"); 
                     for(new 
0sizeof(911Data); i++)
                     {
                         if(
911Data[i][callExists])
                         {
                             
format(sub_strsizeof(sub_str), "%s\t%s\t\n"911Data[i][callerName], 911Data[i][callLocation]);
                             
strcat(principal_strsub_str);
                          }
                      }
                     
ShowPlayerDialog(playeridDIALOG_911_LISTDIALOG_STYLE_TABLIST_HEADERS"911 Calls:"principal_str"Select""<<");
                 }
             }
        }
    }

Give it a shot and see how it works. Wrote this on the forums so there could be a typo or an error. Post if you need more help though.
Reply


Messages In This Thread
Dynamic Dialog List - by DevHarden - 20.08.2017, 06:36
Re: Dynamic Dialog List - by Kane - 20.08.2017, 07:32
Re: Dynamic Dialog List - by DevHarden - 20.08.2017, 07:49
Re: Dynamic Dialog List - by DevHarden - 21.08.2017, 04:26
Re: Dynamic Dialog List - by Kane - 21.08.2017, 04:42
Re: Dynamic Dialog List - by DevHarden - 21.08.2017, 05:25

Forum Jump:


Users browsing this thread: 1 Guest(s)