OnDialogResponse is not working
#1

I have dialog:
Код:
ShowPlayerDialog(playerid,0,DIALOG_STYLE_LIST,"Vбnočnн stromy",stringx,"Vybrat","Konec");
Dialog is working normally. When I click on something OnDialogResponse didnґt response.
In OnDialogResponse I have
Код:
  if(dialogid == 0){
    if(response == 1){
SendClientMessage(playerid, 0x0000FFAA, ":)");
	}
  }
This:
Код:
SendClientMessage(playerid, 0x0000FFAA, ":)");
I have here for testing.
Why doesnґt working OnDialogResponse?
Sorry for my bad english
i have 0.3b
Reply
#2

replace
pawn Код:
if(response == 1)
To
pawn Код:
if(response)
Reply
#3

I changed it and nothing
Reply
#4

pawn Код:
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Vбnočnн stromy",stringx,"Vybrat","Konec");

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

if (dialogid == 1 && response) {
switch (listitem) {

case 0: //This is your "Vбnočnн stromy"
{
SendClientMessage(playerid, COLOR_COLOR,":)");
}


}
}


return 1;
}
Reply
#5

Itґs not working :/

Here is source
Код:
#include <a_samp>
#include <dini>
new Float:x;
new Float:y;
new Float:z;
new slozka[128];
new soubor[128];
new stringx[512];

public OnFilterScriptInit()
{
	print(" Vбnočnн stromky by kazlik");

	format(slozka,sizeof(slozka), "kazlik_data");
	format(soubor,sizeof(soubor), "%s/trees_info.txt", slozka);
	if(!dini_Exists(soubor)){
		dini_Create(soubor);
		new number = 1;
		while(number < 21){
			format(stringx,sizeof(stringx), "strom_%d", number);
			dini_IntSet(soubor, stringx, 0);
			format(stringx,sizeof(stringx), "%s/strom_%d", slozka, number);
			dini_Create(stringx);
			new stringy[128];
			format(stringy,sizeof(stringy), "Slot %d volnэ", number);
			dini_Set(stringx, "nazev", stringy);
			number++;
		}
	}
	new number = 1;
	while(number < 21){
		format(stringx,sizeof(stringx), "strom_%d", number);
		if(!strval(dini_Get(soubor,stringx))){
		format(stringx,sizeof(stringx), "strom %d neexistuje", number);
		print(stringx);
		}else{
		format(stringx,sizeof(stringx), "strom %d existuje", number);
		print(stringx);
		format(soubor,sizeof(soubor), "%s/strom_%d", slozka, number);
        x = strval(dini_Get(soubor,"x"));
        y = strval(dini_Get(soubor,"y"));
        z = strval(dini_Get(soubor,"z"));
		CreateObject(654,x,y,z,0.00000000,0.00000000,0.00000000); //object(pinetree08) (2)
		CreateObject(1223,0.09654120+x,-0.11665283+y,7.14082479+z,0.00000000,0.00000000,0.00000000); //object(lampost_coast) (1)
		CreateObject(3472,0.07597855+x,-0.07715102+y,-0.13281250+z,0.00000000,0.00000000,43.99993896); //object(circuslampost03) (1)
		CreateObject(3472,0.15638264+x,-0.20839335+y,2.60964870+z,0.00000000,0.00000000,235.99481201); //object(circuslampost03) (2)
		CreateObject(3472,0.14218454+x,-0.30459926+y,16.61718750+z,0.20599365,179.84375000,55.99237061); //object(circuslampost03) (3)
		CreateObject(3472,0.13116437+x,-0.17212974+y,6.35965061+z,0.00000000,0.00000000,155.99182129); //object(circuslampost03) (4)
		CreateObject(1232,0.18693677+x,-0.19642687+y,17.64588928+z,0.00000000,0.00000000,0.00000000); //object(streetlamp1) (2)
		CreateObject(3430,0.11709560+x,-0.19875553+y,-1.34412467+z,0.00000000,0.00000000,0.00000000); //object(vegasbooth01) (1)

		}
		number++;
	}
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{

	return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/stromky", cmdtext, true, 10) == 0)
	{
		new number = 1;
		stringx = "";
		while(number < 21){
			format(soubor,sizeof(soubor), "%s/strom_%d", slozka, number);
    		format(stringx,sizeof(stringx), "%s\n%s", stringx, dini_Get(soubor,"nazev"));
    		number++;
		}
       	ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Vбnočnн stromy",stringx,"Vybrat","Konec");
		return 1;
	}
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

  if(dialogid == 1){
    if(response == 1){
SendClientMessage(playerid, 0x0000FFAA, ":)");
    /*
	  format(soubor,sizeof(soubor), "%s/trees_info.txt", slozka);
  	  format(stringx,sizeof(stringx), "strom_%d", listitem);
	  SendClientMessage(playerid, 0x33AA33AA, stringx);
	  if(strval(dini_Get(soubor,stringx)) == 1){
		ShowPlayerDialog(playerid,8216,DIALOG_STYLE_LIST,"Vбnočnн stromky","Uprav Nбzev\nSmazat stom","Vybrat","Konec");
	  }else{
	  	ShowPlayerDialog(playerid,8217,DIALOG_STYLE_INPUT,"Vбnočnн stromky","Napiљ jmйno stromu:","OK","Storno");
	  }*/
	}
 }
  return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
Reply
#6

pawn Код:
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Vбnoc(nн stromy", stringx, "Vybrat", "Konec");

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 0)
    {
        if(response)
        {
            SendClientMessage(playerid, COLOR_COLOR, ":)");
        }
    }
    return 1;
}
Reply
#7

pawn Код:
format(stringx, sizeof(stringx), "strom_%d", listitem);
if(strval(dini_Get(soubor,stringx)) == 1){
No way that you're ever getting a usable value from that.
Basically, what you're doing is:

pawn Код:
strval("strom_0");
Which will just return .. Uh, I don't know what it will return, but it won't be a usable integer value anyway.

Edit: Disregard. I wasn't thinking right ..
Reply
#8

When you tried my one, did you change the "0" to "1" also in ShowPlayerDialog?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)