PDA

View Full Version : Dialog wont work, help !


tuuler
24/09/2013, 03:19 PM
PROBLEM FIXED

EiresJason
24/09/2013, 03:24 PM
Try this.

if(dialogid == DIALOG_MELEE)
{
if(!response) ShowPlayerDialog(playerid, DIALOG_WEPMAIN, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Melee\nThrown\nPistols\nShotguns\nSub-Machine Guns\nAssault Rifles\nRifles\nSpecial", "Select", "Close");
if(response) // If they clicked 'Select' or double-clicked a weapon
{
// Give them the weapon
if(listitem == 0) // They selected the first item - Desert Eagle
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (GetPlayerMoney(playerid) < 300) return SendClientMessage(playerid, red, "{C10B07}Error: {FFFFFF}You need atleast 300$");
GivePlayerWeapon(playerid, 1, 1);
SafeGivePlayerMoney(playerid,-300);
ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Brass Knuckles $300\nKnife $1000\nBaseball Bat $500\nCane $600\nPurple Dildo $100\nChainsaw $5000", "Select", "Back");
}
}
if(listitem == 1) // They selected the first item - Desert Eagle
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, red, "{C10B07}Error: {FFFFFF}You need atleast 1000$");
GivePlayerWeapon(playerid, 4, 1);
SafeGivePlayerMoney(playerid,-1000);
ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Brass Knuckles $300\nKnife $1000\nBaseball Bat $500\nCane $600\nPurple Dildo $100\nChainsaw $5000", "Select", "Back");
}
}
if(listitem == 2) // They selected the first item - Desert Eagle
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, red, "{C10B07}Error: {FFFFFF}You need atleast 500$");
GivePlayerWeapon(playerid, 5, 1);
SafeGivePlayerMoney(playerid,-500);
ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Brass Knuckles $300\nKnife $1000\nBaseball Bat $500\nCane $600\nPurple Dildo $100\nChainsaw $5000", "Select", "Back");
}
}
if(listitem == 3) // They selected the first item - Desert Eagle
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (GetPlayerMoney(playerid) < 600) return SendClientMessage(playerid, red, "{C10B07}Error: {FFFFFF}You need atleast 600$");
GivePlayerWeapon(playerid, 15, 1);
SafeGivePlayerMoney(playerid,-600);
ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Brass Knuckles $300\nKnife $1000\nBaseball Bat $500\nCane $600\nPurple Dildo $100\nChainsaw $5000", "Select", "Back");
}
}
if(listitem == 4) // They selected the first item - Desert Eagle
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, red, "{C10B07}Error: {FFFFFF}You need atleast 100$");
GivePlayerWeapon(playerid, 10, 1);
SafeGivePlayerMoney(playerid,-100);
ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Brass Knuckles $300\nKnife $1000\nBaseball Bat $500\nCane $600\nPurple Dildo $100\nChainsaw $5000", "Select", "Back");
}
}
if(listitem == 5) // They selected the first item - Desert Eagle
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, red, "{C10B07}Error: {FFFFFF}You need atleast 5000$");
GivePlayerWeapon(playerid, 9, 1);
SafeGivePlayerMoney(playerid,-5000);
ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Brass Knuckles $300\nKnife $1000\nBaseball Bat $500\nCane $600\nPurple Dildo $100\nChainsaw $5000", "Select", "Back");
}
}
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}



Also; make sure OnDialogResponse returns 0 and not 1.

tuuler
24/09/2013, 03:29 PM
Try this.

if(dialogid == DIALOG_MELEE)
{
if(!response) ShowPlayerDialog(playerid, DIALOG_WEPMAIN, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Melee\nThrown\nPistols\nShotguns\nSub-Machine Guns\nAssault Rifles\nRifles\nSpecial", "Select", "Close");
if(response) // If they clicked 'Select' or double-clicked a weapon
{
// Give them the weapon
if(listitem == 0) // They selected the first item - Desert Eagle
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (GetPlayerMoney(playerid) < 300) return SendClientMessage(playerid, red, "{C10B07}Error: {FFFFFF}You need atleast 300$");
GivePlayerWeapon(playerid, 1, 1);
SafeGivePlayerMoney(playerid,-300);
ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Brass Knuckles $300\nKnife $1000\nBaseball Bat $500\nCane $600\nPurple Dildo $100\nChainsaw $5000", "Select", "Back");
}
}
if(listitem == 1) // They selected the first item - Desert Eagle
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, red, "{C10B07}Error: {FFFFFF}You need atleast 1000$");
GivePlayerWeapon(playerid, 4, 1);
SafeGivePlayerMoney(playerid,-1000);
ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Brass Knuckles $300\nKnife $1000\nBaseball Bat $500\nCane $600\nPurple Dildo $100\nChainsaw $5000", "Select", "Back");
}
}
if(listitem == 2) // They selected the first item - Desert Eagle
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, red, "{C10B07}Error: {FFFFFF}You need atleast 500$");
GivePlayerWeapon(playerid, 5, 1);
SafeGivePlayerMoney(playerid,-500);
ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Brass Knuckles $300\nKnife $1000\nBaseball Bat $500\nCane $600\nPurple Dildo $100\nChainsaw $5000", "Select", "Back");
}
}
if(listitem == 3) // They selected the first item - Desert Eagle
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (GetPlayerMoney(playerid) < 600) return SendClientMessage(playerid, red, "{C10B07}Error: {FFFFFF}You need atleast 600$");
GivePlayerWeapon(playerid, 15, 1);
SafeGivePlayerMoney(playerid,-600);
ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Brass Knuckles $300\nKnife $1000\nBaseball Bat $500\nCane $600\nPurple Dildo $100\nChainsaw $5000", "Select", "Back");
}
}
if(listitem == 4) // They selected the first item - Desert Eagle
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, red, "{C10B07}Error: {FFFFFF}You need atleast 100$");
GivePlayerWeapon(playerid, 10, 1);
SafeGivePlayerMoney(playerid,-100);
ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Brass Knuckles $300\nKnife $1000\nBaseball Bat $500\nCane $600\nPurple Dildo $100\nChainsaw $5000", "Select", "Back");
}
}
if(listitem == 5) // They selected the first item - Desert Eagle
{
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if (GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, red, "{C10B07}Error: {FFFFFF}You need atleast 5000$");
GivePlayerWeapon(playerid, 9, 1);
SafeGivePlayerMoney(playerid,-5000);
ShowPlayerDialog(playerid, DIALOG_MELEE, DIALOG_STYLE_LIST, "{9ACD32}W E A P O N S", "Brass Knuckles $300\nKnife $1000\nBaseball Bat $500\nCane $600\nPurple Dildo $100\nChainsaw $5000", "Select", "Back");
}
}
}
}
return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
}



Also; make sure OnDialogResponse returns 0 and not 1.
Dude, youre my hero ! :) Thank you soo much :D

EiresJason
24/09/2013, 03:44 PM
Np :)