Jump to content

Problem with requirement


arciCZ

Recommended Posts

Hello, i have one problem but that doesn´t say anything errors / warnings. If i send mysql command to SQL Form in phpmyadmin then that give me values of i need and same values give into game but condition if tip == 1 then doens´t called can they help me ? (Variable tip = 1)

function test(thePlayer, cmd)
	local tip = 0
	local plat = 0
	local id = getElementData(thePlayer, "dbid")
	local query = mysql:query('SELECT * FROM `PojistitVeh` WHERE `Enabled`=1 AND `Character`="'.. id ..'"')
	while true do
		local row = mysql:fetch_assoc(query)
		if not row then return end
		tip = row["Tip"]
		outputDebugString(plat .. "|" .. tip)
		if tip == 1 then plat = plat + 200 end
		if tip == 2 then plat = plat + 500 end
		if tip == 3 then plat = plat + 800 end
		if tip == 4 then plat = plat + 1000 end
		if tip == 5 then plat = plat + 1500 end
	end
end
addCommandHandler("testvyplata", test, false, true)

Thank for help.

Link to comment
  • Moderators

Nice, good job!

But make sure that in your database the column is defined as a int(1) or float(1,0001). To enable functionality within the mysql commands as well as the correct data types of the results (atleast it is suppose to do that, not sure if it isn't correct set in your case).

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...