Dialog problem
#1

I have a problem with my dialogs, non of them work. Its pops up, buy when i try to press a thing on the dialog, nothing happens? Please help.
Reply
#2

Quote:
Originally Posted by Sajeevan
Посмотреть сообщение
I have a problem with my dialogs, non of them work. Its pops up, buy when i try to press a thing on the dialog, nothing happens? Please help.
Your OnDialogResponse callback is not being called, check your dialog ids, they should be unique and non -repeating.
Reply
#3

Like how? How do i see the id?
Reply
#4

Did you define your dialog ?
Example
pawn Код:
#define Dialog_Weapons 112
Reply
#5

I don't think so. The dialogs are filterscripts.
Reply
#6

Read this tutorial : https://sampforum.blast.hk/showthread.php?tid=109610. Make sure you define your dialogs, so dialog ids won't mix up and always have return 0 at the end, so that dialog can be accessed in other scripts too.
Reply
#7

They id's are not the same. Its diffrent.
Reply
#8

Quote:
Originally Posted by Sajeevan
Посмотреть сообщение
They id's are not the same. Its diffrent.
Post your OnDialogResponse callback here.
Reply
#9

Of the gamemode, or the filterscripts?
Reply
#10

This the the gamemode
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == DIALOG_LOGIN)
	{
	    new s[500];
 		if(!response)
		{
   			format(s,sizeof(s),"{FFFFFF}Welcome {00C7FF}%s, \n\n{FFFFFF}This Nickname is registered and is protected.\n{D6D631}If its your account login by inputting the password below.\n\n{00C7FF}If not please change your username.\n{F6A4D5}To exit click {FFFFFF}'Exit' {F6A4D5}to close the GTA client\n\n{FFFFFF}Password:",PlayerName(playerid));
	 		ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"CnR Login",s,"Login","");
		}
  		LoginPlayer(playerid, inputtext);
	}
	if(dialogid == DIALOG_REGISTER)
	{
	    new s[500];
 		if(!response)
		{
			format(s,sizeof(s),"{FFFFFF}Welcome {00C7FF}%s, \n\n{FFFFFF}This Nickname is not registered within our database.\n{D6D631}If you want to register with this account name.\n\n{00C7FF}Please register by inputting text.\n{F6A4D5}You can do this by entering a {FFFFFF}'Password' {F6A4D5}into the field box to register\n\n{FFFFFF}Desired Password:",PlayerName(playerid));
			ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"CnR Register",s,"Register","");
		}
		if(strlen(inputtext) < 3 || strlen(inputtext) >= 16)
		{
		    SendClientMessage(playerid, COLOR_RED, "Your password must contain 3 - 15 Letters and must use valid Letters and Numbers.!");
		    
			format(s,sizeof(s),"{FFFFFF}Welcome {00C7FF}%s, \n\n{FFFFFF}This Nickname is not registered within our database.\n{D6D631}If you want to register with this account name.\n\n{00C7FF}Please register by inputting text.\n{F6A4D5}You can do this by entering a {FFFFFF}'Password' {F6A4D5}into the field box to register\n\n{FFFFFF}Desired Password:",PlayerName(playerid));
			ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"CnR Register",s,"Register","");
		}
  		RegisterPlayer(playerid, inputtext);
	}

	return 1;
}
And the Housesystem

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new string[400], file[HOUSEFILE_LENGTH], file2[HOUSEFILE_LENGTH], h = GetPVarInt(playerid, "LastHouseCP"); // Don't complain about huge size, just change it if you need.
    format(file, sizeof(file), FILEPATH, h);
	if(dialogid == HOUSEMENU && response)
	{
	    switch(listitem)
		{
		    case 0:
		    {
				format(string, sizeof(string), HMENU_SELL_HOUSE, pNick(playerid), GetHouseName(h), ReturnProcent(GetHouseValue(h), HOUSE_SELLING_PROCENT));
				ShowPlayerDialog(playerid, HOUSEMENU+3, DIALOG_STYLE_MSGBOX, "GarHouse v1.3 By [03]Garsino - House Sale", string, "Sell", "Cancel");
		    }
		    case 1:
			{
				#if defined GH_USE_WEAPONSTORAGE
					ShowPlayerDialog(playerid, HOUSEMENU+18, DIALOG_STYLE_LIST, "GarHouse v1.3 By [03]Garsino - House Storage", "Money Storage\nWeapon Storage", "Select", "Cancel");
				#endif
				#if !defined GH_USE_WEAPONSTORAGE
					ShowPlayerDialog(playerid, HOUSEMENU+10, DIALOG_STYLE_LIST, "GarHouse v1.3 By [03]Garsino - House Storage", "Deposit Money\nWithdraw Money\nCheck Balance", "Select", "Cancel");
				#endif
			}
			case 2: ShowPlayerDialog(playerid, HOUSEMENU+14, DIALOG_STYLE_INPUT, "GarHouse v1.3 By [03]Garsino - House Name", "Type In The New House Name Below:\n\nPress 'Cancel' To Cancel", "Done", "Cancel");
		    case 3: ShowPlayerDialog(playerid, HOUSEMENU+13, DIALOG_STYLE_INPUT, "GarHouse v1.3 By [03]Garsino - House Password", "Type In The New House Password Below:\nLeave The Box Empty If You Want To Keep Your Current House Password.\nPress 'Remove' To Remove The House Password.", "Done", "Remove");
			case 4: ShowPlayerDialog(playerid, HOUSEMENU+16, DIALOG_STYLE_LIST, "GarHouse v1.3 By [03]Garsino - Select House Interior Option", "Preview House Interior\nBuy House Interior", "Select", "Cancel");
		}
		return 1;
	}
//------------------------------------------------------------------------------
//                               House Sale
//------------------------------------------------------------------------------
	if(dialogid == HOUSEMENU+3 && response)
	{
		if(GetOwnedHouses(playerid) == 0) return SendClientMessage(playerid, COLOUR_SYSTEM, E_NO_HOUSES_OWNED);
		else
		{
		    new tmp = dini_Int(file, "HouseStorage");
			GivePlayerMoney(playerid, ReturnProcent(GetHouseValue(h), HOUSE_SELLING_PROCENT));
			if(tmp >= 1)
			{
   				ShowInfoBox(playerid, INFORMATION_HEADER, I_SELL_HOUSE1, ReturnProcent(GetHouseValue(h), HOUSE_SELLING_PROCENT), (GetHouseValue(h) - ReturnProcent(GetHouseValue(h), HOUSE_SELLING_PROCENT)), tmp);
				GivePlayerMoney(playerid, tmp);
			}
			if(tmp == 0)
			{
			    ShowInfoBox(playerid, INFORMATION_HEADER, I_SELL_HOUSE2, GetHouseName(h), ReturnProcent(GetHouseValue(h), HOUSE_SELLING_PROCENT), (GetHouseValue(h) - ReturnProcent(GetHouseValue(h), HOUSE_SELLING_PROCENT)));
			}
			dini_IntSet(file, "HouseValue", ReturnProcent(GetHouseValue(h), HOUSE_SELLING_PROCENT));
			dini_Set(file, "HouseOwner", INVALID_HOWNER_NAME);
			dini_Set(file, "HousePassword", "INVALID_HOUSE_PASSWORD");
			dini_Set(file, "HouseName", DEFAULT_HOUSE_NAME);
			dini_IntSet(file, "HouseStorage", 0);
			Loop(h2, MAX_HOUSES)
			{
				if(IsHouseInRangeOfHouse(h, h2, RANGE_BETWEEN_HOUSES) && h2 != h)
				{
			   		format(file2, sizeof(file2), FILEPATH, h2);
					dini_IntSet(file2, "HouseValue", (dini_Int(file2, "HouseValue") - ReturnProcent(GetHouseValue(h2), HOUSE_SELLING_PROCENT2)));
                    UpdateHouseText(h2);
				}
			}
			#if defined GH_USE_MAPICONS
				DestroyDynamicMapIcon(HouseMIcon[h]);
				HouseMIcon[h] = CreateDynamicMapIcon(dini_Float(file, "CPOutX"), dini_Float(file, "CPOutY"), dini_Float(file, "CPOutZ"), 31, -1, dini_Int(file, "SpawnWorld"), dini_Int(file, "SpawnInterior"), -1, MICON_VD);
			#endif
			UpdateHouseText(h);
            #if defined GH_DEBUGGING
  				printf(DEBUG_ODR13, pNick(playerid), playerid, GetHouseValue(h), tmp, h);
	    	#endif
		}
		return 1;
	}
//------------------------------------------------------------------------------
//                               House Buying
//------------------------------------------------------------------------------
	if(dialogid == HOUSEMENU+4)
	{
		if(response)
		{
		    new hname[MAX_PLAYER_NAME+9];
			if(GetOwnedHouses(playerid) >= MAX_HOUSES_OWNED) { ShowInfoBox(playerid, INFORMATION_HEADER, "You Already Own %d House%s. Sell One Of Your Others Before Buying A New.", MAX_HOUSES_OWNED, AddS(MAX_HOUSES_OWNED)); return 0; }
			if(strcmp(GetHouseOwner(GetPVarInt(playerid, "LastHouseCP")), pNick(playerid), CASE_SENSETIVE) && strcmp(GetHouseOwner(h), INVALID_HOWNER_NAME, CASE_SENSETIVE)) return SendClientMessage(playerid, COLOUR_SYSTEM, E_H_ALREADY_OWNED);
			if(GetHouseValue(h) > GetPlayerMoney(playerid)) { ShowInfoBox(playerid, INFORMATION_HEADER, "You Can Not Afford To Buy This House.\nHouse Value: $%d.\nYou Have: $%d.\nYou Need: $%d.", GetHouseValue(h), GetPlayerMoney(playerid), (GetHouseValue(h) - GetPlayerMoney(playerid))); return 0; }
			else
			{
			    format(hname, sizeof(hname), "%s's House", pNick(playerid));
				GivePlayerMoney(playerid, -GetHouseValue(h));
				dini_Set(file, "HouseOwner", pNick(playerid));
				dini_Set(file, "HousePassword", "INVALID_HOUSE_PASSWORD");
				dini_Set(file, "HouseName", hname);
				dini_IntSet(file, "HouseStorage", 0);
				ShowInfoBox(playerid, INFORMATION_HEADER, I_BUY_HOUSE, GetHouseValue(h));
				Loop(h2, MAX_HOUSES)
				{
					if(IsHouseInRangeOfHouse(h, h2, RANGE_BETWEEN_HOUSES) && h2 != h)
					{
					    format(file2, sizeof(file2), FILEPATH, h2);
						dini_IntSet(file2, "HouseValue", (dini_Int(file2, "HouseValue") + ReturnProcent(GetHouseValue(h2), HOUSE_SELLING_PROCENT2)));
                        UpdateHouseText(h2);
					}
				}
				#if defined GH_USE_MAPICONS
					DestroyDynamicMapIcon(HouseMIcon[h]);
					HouseMIcon[h] = CreateDynamicMapIcon(dini_Float(file, "CPOutX"), dini_Float(file, "CPOutY"), dini_Float(file, "CPOutZ"), 32, -1, dini_Int(file, "SpawnWorld"), dini_Int(file, "SpawnInterior"), -1, MICON_VD);
				#endif
				UpdateHouseText(h);
                #if defined GH_DEBUGGING
  					printf(DEBUG_ODR1, pNick(playerid), playerid, h, GetHouseValue(h));
	    		#endif
			}
		}
		return 1;
	}
//------------------------------------------------------------------------------
//                               House Password
//------------------------------------------------------------------------------
	if(dialogid == HOUSEMENU+13)
	{
		if(response)
		{
			if(strlen(inputtext) > MAX_HOUSE_PASSWORD || (strlen(inputtext) < MIN_HOUSE_PASSWORD && strlen(inputtext) >= 1)) return SendClientMessage(playerid, COLOUR_SYSTEM, E_INVALID_HPASS_LENGTH);
			if(!strcmp(inputtext, "INVALID_HOUSE_PASSWORD", CASE_SENSETIVE)) return SendClientMessage(playerid, COLOUR_SYSTEM, E_INVALID_HPASS);
			if(strfind(inputtext, "%", CASE_SENSETIVE) != -1 || strfind(inputtext, "~", CASE_SENSETIVE) != -1) return SendClientMessage(playerid, COLOUR_SYSTEM, E_INVALID_HPASS_CHARS);
			else
			{
			    if(strlen(inputtext) >= 1)
			    {
					dini_IntSet(file, "HousePassword", udb_hash(inputtext));
					ShowInfoBox(playerid, INFORMATION_HEADER, I_HPASSWORD_CHANGED, inputtext);
                    #if defined GH_DEBUGGING
  						printf(DEBUG_ODR14, pNick(playerid), playerid, h);
	    			#endif
				}
				else SendClientMessage(playerid, COLOUR_INFO, I_HPASS_NO_CHANGE);
			}
		}
		if(!response)
		{
		    dini_Set(file, "HousePassword", "INVALID_HOUSE_PASSWORD");
			SendClientMessage(playerid, COLOUR_INFO, I_HPASS_REMOVED);
		}
		return 1;
	}
//------------------------------------------------------------------------------
//                               House Name
//------------------------------------------------------------------------------
	if(dialogid == HOUSEMENU+14)
	{
		if(response)
		{
		    if(strfind(inputtext, "%", CASE_SENSETIVE) != -1 || strfind(inputtext, "~", CASE_SENSETIVE) != -1) return SendClientMessage(playerid, COLOUR_SYSTEM, E_INVALID_HNAME_CHARS);
			if(strlen(inputtext) < MIN_HOUSE_NAME || strlen(inputtext) > MAX_HOUSE_NAME) return SendClientMessage(playerid, COLOUR_SYSTEM, E_INVALID_HNAME_LENGTH);
			else
			{
				dini_Set(file, "HouseName", inputtext);
				SendMSG(playerid, COLOUR_INFO, 128, I_HNAME_CHANGED, inputtext);
                UpdateHouseText(h);
                #if defined GH_DEBUGGING
					printf(DEBUG_ODR2, pNick(playerid), playerid, h, inputtext);
  				#endif
			}
		}
		return 1;
	}
//------------------------------------------------------------------------------
//                       House Interior Upgrade
//------------------------------------------------------------------------------
	if(dialogid == HOUSEMENU+15 && response)
	{
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)