Hero192
Members-
Posts
512 -
Joined
-
Last visited
Everything posted by Hero192
-
I used this function, Can anyone correct me ? --46 = Para ID giveWeapon ( source, 46, 1)
-
It's my script, you have no permission to use it
-
Hey guys, what's the different if i created a GUI defined like that local myGUI = guiCreateWindow(0.33, 0.30, 0.35, 0.40, "window", true) and GUI like that local GUI = {} GUI["window"] = {} GUI["window"] = guiCreateWindow(0.33, 0.30, 0.35, 0.40, "window", true)
-
Thanks for your efforts, everything handled already by TAPL via pm and in forums !
-
So, as i understand the result of poll is a table and it must be higher than number zero '0' to return true if not it will return false?
-
Hey again, i want to be sure about the meaning of this checking, as you know we got result from dbPoll so result must be not a table and it must equal 0? can anyone correct me if im wrong if not ( type( result ) == "table" and #result == 0 ) or result then return true else return false end ~Thanks in advance!!
-
Thanks for TAPL and t3wz worked i followed you both
-
I stuck on anther problem, i want to return a table from database mysql and show it in GUI (gridlist) i tried that but won't works maybe i did something wrong , i hope you can correct me! server side: function getVehicles(accountname) local query = dbQuery(connection, "SELECT * FROM vehicles_table WHERE username = '".. tostring(accountname) .."'LIMIT 1" ) local result = dbPoll(query, -1) if ( type( result ) == "table" and #result == 0 ) or not result then return false else return true end end function vehLists() local account = getPlayerAccount(source) local accountName = getAccountName(account) local vehList = getVehicles(accountName) triggerClientEvent(source,"returnvehList",source,vehList) end client side: addEvent("returnvehList",true) addEventHandler("returnvehList",root, function (vehList) guiGridListClear(grid) if guiGetVisible(window) then for index, v in ipairs(vehList) do local row = guiGridListAddRow(grid) guiGridListSetItemText(grid, row, 1, v[1], false, false) guiGridListSetItemText(grid, row, 2, v[2], false, false) guiGridListSetItemText(grid, row, 3, v[3], false, false) guiGridListSetItemText(grid, row, 4, v[4], false, false) end end end)
-
It's working, i sent the r,g,b from client to server side and i tested it by using outputChatBox function the problem is when i use toJSON to store the r,g,b colors in one columns at the database of mysql it store just r but g and b no so when i try to return the color it return false so here where is the problem exist
-
Anyone can help me to solve this?
-
Hey guys is there's any example for showng text when the player downloading the files of resources?
-
Yes i know but my problem is toJSON don't save all the numbers it save only r but g, b no i checked the mysql table in the color column and i saw that
-
Replace 'color' (and possibly `vehicleid` in the SQL query itself) with the name of the corresponding column. Show me example please, i won't be wrong
-
But when i try to get r,g,b from the function it tell me the same error error bad argument #1 to 'unpack' (table expected, got nil) local r,g,b = getVehiclesColor(vehicleid)
-
I didn't update anything, can you fix that with example
-
Yes good way but it give error bad argument #1 to 'unpack' (table expected, got nil) in this part function getVehiclesColor(vehicleid) local qh = dbQuery(connection, "SELECT `color` FROM `vehicle` WHERE `vehicleid`=? LIMIT 1", vehicleid) local result = dbPoll(qh, -1) if (result and #result > 0) then return tonumber(unpack(fromJSON(result[1].color))) end return false end I do like that to get the vehicle color but not working local r,g,b = getVehiclesColor(vehicleid) -- i define the vehicle id setVehicleColor(veh,r,g,b)
-
Hey guys, im getting a vehicle color ( r, g, b) to storing it to a database but it save just R others no, i mean g and b Here is my code, can anyone give me a hand? function addToDatabase(vehicleName, vehicleid, vehicleType, r, g, b) if not doesVehExists(vehicleName) then local color = r..","..g..","..b dbExec(connection, "INSERT INTO vehicle VALUES ( ?,?,?,? )", tostring(vehicleName),tostring(vehicleid),tostring(vehicleType), tostring(color)) return true else return false end end And i want to get the veh color later so please tell me the solution of this
-
Can anyone explain why we should use this type? and why we should do return function checking(ACC) local query = dbQuery(connection, "SELECT * FROM data WHERE name = '" ..tostring(ACC) .. "'") local result = dbPoll(query,-1) if ( type( result ) == "table" and #result > 0 ) or not result then return true --Why this? else return false -- WHy this? to return what end end
-
I know how to use db functions also how to script sqlite code but i stuck on how to convert this code from setAccountData to sqlite functions , please just give me a light by telling me when should i UPDATA the table or when i INSERT it and SELECT in this sitiuation by the way thanks for the quick reply !
-
Hey guys i stuck on change the setAccountData to SQLite as i have some skills in Sqlite so please just give me a light to follow -Thanks in advance addEventHandler ( "onResourceStart" , resourceRoot , function ( ) for index , player in ipairs ( getElementsByType ( "player" ) ) do local pAccount = getPlayerAccount ( player ) if not isGuestAccount ( pAccount ) then local minutes = getAccountData ( pAccount , "Online.minutes" ) if minutes then local hours = getAccountData ( pAccount , "Online.hours" ) if # tostring ( minutes ) == 1 then minutes = "0" .. minutes end if # tostring ( hours ) == 1 then hours = "0" .. hours end setElementData ( player , "Play Time" , hours .. ":" .. minutes .. "" ) local timer = setTimer ( actualizarJugadorOn , 60000 , 1 , player ) setElementData ( player , "Online.timer" , timer ) else setAccountData ( pAccount , "Online.minutes" , 0 ) setAccountData ( pAccount , "Online.hours" , 0 ) setElementData ( player , "Play Time" , "00:00 " ) local timer = setTimer ( actualizarJugadorOn , 60000 , 1 , player ) setElementData ( player , "Online.timer" , timer ) end else setElementData ( player , "Play Time" , "N/A" ) end end end ) addEventHandler ( "onResourceStop" , resourceRoot , function ( ) for index , player in ipairs ( getElementsByType ( "player" ) ) do local pAccount = getPlayerAccount ( player ) if not isGuestAccount ( pAccount ) then local timer = getElementData ( player , "Online.timer" ) if isTimer ( timer ) then killTimer ( timer ) end end end end ) addEventHandler ( "onPlayerLogin" , root , function ( _ , pAccount ) local minutes = getAccountData ( pAccount , "Online.minutes" ) if minutes then local hours = getAccountData ( pAccount , "Online.hours" ) if # tostring ( minutes ) == 1 then minutes = "0" .. minutes end if # tostring ( hours ) == 1 then hours = "0" .. hours end setElementData ( source , "Play Time" , hours .. ":" .. minutes .. "" ) local timer = setTimer ( actualizarJugadorOn , 60000 , 1 , source ) setElementData ( source , "Online.timer" , timer ) else setAccountData ( pAccount , "Online.minutes" , 0 ) setAccountData ( pAccount , "Online.hours" , 0 ) setElementData ( source , "Play Time" , "00:00" ) local timer = setTimer ( actualizarJugadorOn , 60000 , 1 , source ) setElementData ( source , "Online.timer" , timer ) end end ) addEventHandler ( "onPlayerLogout" , root , function ( pAccount ) local timer = getElementData ( source , "Online.timer" ) if isTimer ( timer ) then killTimer ( timer ) end end ) addEventHandler ( "onPlayerJoin" , root , function ( ) setElementData ( source , "Play Time" , "N/A" ) end ) addEventHandler ( "onPlayerQuit" , root , function ( ) local pAccount = getPlayerAccount ( source ) if not isGuestAccount ( pAccount ) then local timer = getElementData ( source , "Online.timer" ) if isTimer ( timer ) then killTimer ( timer ) end end end ) function actualizarJugadorOn ( player ) local pAccount = getPlayerAccount ( player ) local minutes = getAccountData ( pAccount , "Online.minutes" ) local hours = getAccountData ( pAccount , "Online.hours" ) minutes = tostring ( tonumber ( minutes ) + 1 ) if minutes == "60" then hours = tostring ( tonumber ( hours ) + 1 ) minutes = "00" end setAccountData ( pAccount , "Online.minutes" , tonumber ( minutes ) ) setAccountData ( pAccount , "Online.hours" , tonumber ( hours ) ) if # tostring ( minutes ) == 1 then minutes = "0" .. minutes end if # tostring ( hours ) == 1 then hours = "0" .. hours end setElementData ( player , "Play Time" , hours .. ":" .. minutes .. "" ) local timer = setTimer ( actualizarJugadorOn , 60000 , 1 , player ) setElementData ( player , "Online.timer" , timer ) end
-
anyone can give a hand?
