PDA

View Full Version : Dialog Help


TadePoleMG
05/07/2018, 12:18 PM
Hi mates :)

Example Dialog Code:

new string[128];
format(string,128,"1. Change Name\n2. Change Password");
ShowPlayerDialog(playerid, 1, DIALOG_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.

kovac
05/07/2018, 12:34 PM
I would recommend you this include for creating dialogs much simpler: http://forum.sa-mp.com/showthread.php?t=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:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
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!
}

TadePoleMG
05/07/2018, 12:41 PM
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.

kovac
05/07/2018, 12:49 PM
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.

Lokii
05/07/2018, 01:40 PM
Hi mates :)

Example Dialog Code:

new string[128];
format(string,128,"1. Change Name\n2. Change Password");
ShowPlayerDialog(playerid, 1, DIALOG_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


ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Account Settings", "1. Change Name\n2. Change Password", "Change", "Close");



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.


case 0:
{
if(GetPlayerMoney(playerid) < 1000) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Account Settings", "1. Change Name\n2. Change Password", "Change", "Close");
//if got 1000 or above code here
}