Jump to content

[HELP] Problem for loading multiple blips


HandBuzz

Recommended Posts

So, first of all greetings.

These days, i was trying to make a script that would allow you to create custom blips and save them to a database. The creation and saving (in the DB) part went well, but i am having problems when trying to load them back into the game.

Here's part of the code that handles that:

function loadOneBlip( )
	local result = mysql:query_fetch_assoc("SELECT x AS x1, y AS y1, z AS z1, icon AS icons, size AS sizes FROM `blip`") --loading the data from the DB
	if result then
		while true do
      
			local row = mysql:fetch_assoc(result) --make it so i can select the data from  a string
			if not row then break end	--if there is no result end the operation
      
			local blip = createBlip( row.x1 , row.y1 , row.z1 , row.icons , row.sizes, 255, 0, 0, 0, 0, visibleDistance) --creating the	actual blip
			outputChatBox("loading one blip (#"..blips..")", thePlayer, 255,255,255) --count them ingame to see if it loads completely
			blips = blips + 1
		end
			mysql:free_result(result)
	else
		outputDebugString("blip failed",1) --something went wrong
	end
end

addCommandHandler("loadblip",loadOneBlip,false,false)
addEventHandler("onResourceStart",root, loadOneBlip)

And for more thoughts,  yes, the connection to the DB is running good.

The script is made serverside.

And i also think i did something very wrong here, that being in when i execute the command, neither the blip gets created nor the error message display.

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...