SA-MP Forums Archive
Help with dialogs - 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: Help with dialogs (/showthread.php?tid=358255)



Help with dialogs - Kain1297 - 09.07.2012

This is my code
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/usecase", cmdtext, true) == 0)
	{
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Select your item", "", "Select", "Cancel");
        if(gMine[playerid] > 0)
        {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Select your item", "Mine", "Select", "Cancel");
		}
		if(gBomb[playerid] > 0)
        {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Select your item", "\nbomb", "Select", "Cancel");
		}
		return 1;
    }
i want to make an inventory dialog system like: When you have bombs, it add the bombs item, etc, i tried everything but cant make it happen


Re: Help with dialogs - coole210 - 10.07.2012

You would have to keep formatting a string to put into the dialog, then finally add the dialog with the string. But the problem is the listitems for each would be different.


Respuesta: Help with dialogs - Kain1297 - 10.07.2012

i tried
Код:
if (strcmp("/usecase", cmdtext, true) == 0)
	{
        new string[64];
        format(string,sizeof(string),"Mine: x %d",gMine[playerid]);
        new string2[64];
        format(string2,sizeof(string2),"Barrels: x %d",gBomb[playerid]);
        new string3[64];
        format(string3,sizeof(string3),"Nuke: x %d",gNuke[playerid]);
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Select your item", string, "Select", "Cancel");
	}
but cant make it combine


Re: Help with dialogs - Larceny - 10.07.2012

I think this should work.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/usecase", cmdtext, true) == 0)
    {
        new dstring[200];
       
        new lstring[32];
        format(lstring, sizeof(lstring), "Mines %i\n", gMine[playerid]);
        strins(dstring, lstring, strlen(dstring));
       
        format(lstring, sizeof(lstring), "Bombs %i\n", gBomb[playerid]);
        strins(dstring, lstring, strlen(dstring));
   
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Select your item", dstring, "Select", "Cancel");
        return 1;
    }
}



Respuesta: Help with dialogs - Kain1297 - 10.07.2012

Код:
C:\Users\Mario\Desktop\Downloads\Server\filterscripts\weaponstore.pwn(377) : error 017: undefined symbol "isnull"
it doesnt work


Re: Help with dialogs - Larceny - 10.07.2012

Check my edit above.

edit: You could just use:

pawn Код:
new lstring[128];
format(lstring, sizeof(lstring), "Mines %i\nBombs %i", gMines[playerid], gBomb[playerid]);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Select your item", lstring, "Select", "Cancel");



Respuesta: Help with dialogs - Kain1297 - 10.07.2012

Thanks!! it works now!!!


Re: Help with dialogs - Genuine - 10.07.2012

Try this.
Edit the items/selections you want on your one. Good luck.
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
if(
response)// They pressed the first button. 
    
{
    switch(
dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs. 
        
{
        case 
1:// Our dialog!
            
{
               switch(
listitem)// Checking which listitem was selected
            
{
                case 
0:// The first item listed
                
{
                    if(
GetPlayerMoney(playerid) < 1) return SendClientMessage(playerid0xFFFFFF"You don't have enough cash.");
                    
GivePlayerMoney(playerid, -1);
                    
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_SPRUNK);
                }
                case 
1// The second item listed
                
{
                    if(
GetPlayerMoney(playerid) < 2) return SendClientMessage(playerid0xFFFFFF"You don't have enough cash.");
                    
GivePlayerMoney(playerid, -2);
                    
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_BEER);
                }
                case 
2// The third item listed
                
{
                    if(
GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid0xFFFFFF"You don't have enough cash.");
                    
GivePlayerMoney(playerid, -3);
                    
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_WINE);
                }
            }
            }
    }
    }
    return 
1;