SA-MP Forums Archive
Dialog Help - 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 Help (/showthread.php?tid=656017)



Dialog Help - TadePoleMG - 05.07.2018

Hi mates

Example Dialog Code:
PHP код:
new string[128];
format(string,128,"1. Change Name\n2. Change Password");
ShowPlayerDialog(playerid1DIALOG_STYLE_LIST"Account Settings"string"Change""Close"); 
So, guys OnDialogResponse if Player money is less than $1000 then any of them list items can't be clickable and if player's money is greater than $1000 then both be clickable and pop up a new dialog for entering new name/pass.

How i do that?

Thank You, Help Please.


Re: Dialog Help - kovac - 05.07.2018

I would recommend you this include for creating dialogs much simpler: https://sampforum.blast.hk/showthread.php?tid=475838
Also, checking for client-side money is a very bad idea, use server-sided. Else It can be easily hacked.

However, this should work:
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
1// DIALOG ID. IT'S BETTER TO USE DEFINES IF YOU DON'T USE EASYDIALOG
        
{
            if(
response)
            {
                if(
GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, -1"ERROR: You don't have enough cash.");
                switch(
lisitem)
                {
                    case 
0// Listitem 1
                    
{
                        
// ..
                    
}
                    case 
1// Listitem 2
                    
{
                        
// ..
                    
}
                }
            }
            
        }
        return 
1// We handled a dialog, so return 1.
    
}
    return 
0// You MUST return 0 here!




Re: Dialog Help - TadePoleMG - 05.07.2018

Thank You but i know this i want that id cash is less than $1000 then first list item can't be clickable means shows in dialog list but not clickable instead of error msg.


Re: Dialog Help - kovac - 05.07.2018

Sorry, but I can't understand what you're saying.
If you want to check money only in specific listitems, simply move that line of code inside it.

Edit: I don't think that is possible. However, you can show dialog again once player responses which would make the same effect.


Re: Dialog Help - Lokii - 05.07.2018

Quote:
Originally Posted by TadePoleMG
Посмотреть сообщение
Hi mates

Example Dialog Code:
PHP код:
new string[128];
format(string,128,"1. Change Name\n2. Change Password");
ShowPlayerDialog(playerid1DIALOG_STYLE_LIST"Account Settings"string"Change""Close"); 
So, guys OnDialogResponse if Player money is less than $1000 then any of them list items can't be clickable and if player's money is greater than $1000 then both be clickable and pop up a new dialog for entering new name/pass.

How i do that?

Thank You, Help Please.
why not just

PHP код:
ShowPlayerDialog(playerid1DIALOG_STYLE_LIST"Account Settings""1. Change Name\n2. Change Password""Change""Close"); 
Quote:
Originally Posted by TadePoleMG
Посмотреть сообщение
Thank You but i know this i want that id cash is less than $1000 then first list item can't be clickable means shows in dialog list but not clickable instead of error msg.
PHP код:
case 0:

    if(
GetPlayerMoney(playerid) < 1000) return ShowPlayerDialog(playerid1DIALOG_STYLE_LIST"Account Settings""1. Change Name\n2. Change Password""Change""Close"); 
    
//if got 1000 or above code here