• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua doPlayerAddDialog() is crashing the server .exe

angelobodj

Lazy OT Researcher
Joined
Dec 24, 2009
Messages
107
Reaction score
3
Location
Spain
Well, I'm just trying to test the example code of doPlayerAddDialog but when I execute it, my server gets crashed (process closes instantly).

This is the code I am using:
Lua:
modaldialog = {
	title = "title",
	message = "message",
	buttons = {
		{ id = 1, value = "okay" },
		{ id = 2, value = "cancel" },
	},
	buttonEnter = 1,
	buttonEscape = 2,
	choices = {
		{ id = 1, value = "add 500 exp" },
		{ id = 2, value = "remove 500 exp" }
	},
	popup = true
}


function callback(cid, button, choice)
	--anything u want
	if (button == 1) then
		local exp = 0
		if (choice == 1) then
			exp = 500
		end
		if (choice == 2) then
			exp = -500
		end
		doPlayerAddExperience(cid, exp);
	end
end

function onSay(cid, words, param, channel)
	--struct, id, creature id, callback
	--NOTE:
	--	id should be unique id of all dialogs in whole scripts
	addDialog(modaldialog, 2345, cid, callback);
end

Where is the problem why it is crashing?
 
idk exactly but on the line under popup = true what is that bracket there for? what does it end?

could also try using a differant number for the button ids

The bracket that you say is closing the first line: modaldialog = {

I have tested a bunch of things but it is always crashing :(
 
Does this work?

Lua:
modaldialog = {
	title = "title",
	message = "message",
	buttons = {
		{ id = 1, value = "okay" },
		{ id = 2, value = "cancel" },
	},
	buttonEnter = 1,
	buttonReset = 2,
	choices = {
		{ id = 1, value = "add 500 exp" },
		{ id = 2, value = "remove 500 exp" }
	},
	popup = true
}
 
 
function callback(cid, button, choice)
	--anything u want
	if (button == 1) then
		local exp = 0
		if (choice == 1) then
			exp = 500
		end
		if (choice == 2) then
			exp = -500
		end
		doPlayerAddExperience(cid, exp);
	end
end
 
function onSay(cid, words, param, channel)
	--struct, id, creature id, callback
	--NOTE:
	--	id should be unique id of all dialogs in whole scripts
	addDialog(modaldialog, 2345, cid, callback);
end
 
Does this work?

Lua:
modaldialog = {
	title = "title",
	message = "message",
	buttons = {
		{ id = 1, value = "okay" },
		{ id = 2, value = "cancel" },
	},
	buttonEnter = 1,
	buttonReset = 2,
	choices = {
		{ id = 1, value = "add 500 exp" },
		{ id = 2, value = "remove 500 exp" }
	},
	popup = true
}
 
 
function callback(cid, button, choice)
	--anything u want
	if (button == 1) then
		local exp = 0
		if (choice == 1) then
			exp = 500
		end
		if (choice == 2) then
			exp = -500
		end
		doPlayerAddExperience(cid, exp);
	end
end
 
function onSay(cid, words, param, channel)
	--struct, id, creature id, callback
	--NOTE:
	--	id should be unique id of all dialogs in whole scripts
	addDialog(modaldialog, 2345, cid, callback);
end

Nope. My console says:
"Unhandled exception, generating minidump..."

Then it closes :/
 
and what does the minidump say?

Well, not much:

- Process architecture: x64
- Exception code: 0xC0000005
- Exception information: The thread (subprocess) tried to read from or write to a virtual address for which it did not have the appropriate access permissions.
- Stack information: Not present
- Error information: - (Empty)


It sounds really weird :S
 
Its acces violation. You can always compile your server in debug mode, and use gdb for debugging ^^
@edit
You can find in google how to do it, im too lazy to write a tutorial atm XD
 
Back
Top