arciCZ Posted September 4, 2017 Share Posted September 4, 2017 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 IIYAMA Posted September 4, 2017 Moderators Share Posted September 4, 2017 (edited) tip = tonumber( row["Tip"]) You saved it as a number? Edited September 4, 2017 by IIYAMA Link to comment
arciCZ Posted September 4, 2017 Author Share Posted September 4, 2017 (edited) I try this but in debugscript send me number. //Edit: Thank you verry much. That is function. Edited September 4, 2017 by arciCZ Link to comment
Moderators IIYAMA Posted September 4, 2017 Moderators Share Posted September 4, 2017 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now