Jump to content

[resolved]lights - [resolved]mysql querys


Recommended Posts

is there an object ID i can use to create lights? like no traffic lights, but an actual light source, and for it to be an element, for example, i would have a slot on the wall with a light, if i unlock the door, its on, otherwise the light is off .. or "deleted"

any help thanks.

this could also be used to light up area 69 at night(i don't care if the lights move)

thanks again :)

Edit - figured it out, just make a marker using the carona or whatever(glowing ball of "light")

now, help for something else instead:

how do i loop through mysql results in lua?

function createCars () 
    local handler = mysql_connect("localhost", "root", "[passcoded.haha]********[/passcoded.haha]", "furbanjMTA") 
    local result = mysql_query(handler, "SElECT * FROM `cars`") 
    local numres = mysql_num_rows(result) 
    while ( row=mysql_fetch_assoc(result) ) do --how its done in PHP 
         crs = createVehicle ( row["model"], row["x"], row["y"], row["z"], 0.0, 0.0, row["rot"] ) 
         setElementData ( crs, "vehdata.carown", row["owner"] ) 
    end 
end 

somethinglike that, exept this is never ending. Thanks..

i like mysql and i am just attempting to make car ownership system(this is indeed in MTA 1.0 nightly)

Edit2: fixed it, for all those wondering:

  
        local result = mysql_query(handler, "SElECT * FROM `cars`") 
    if ( result ) then 
        while true do 
            local theCar= mysql_fetch_assoc(result) 
            if (not theCar) then break end 
            crs = createVehicle ( theCar["model"], theCar["x"], theCar["y"], theCar["z"], 0.0, 0.0, theCar["rot"] ) 
            setElementData ( crs, "vehdata.carown", theCar["owner"] ) 
            --outputChatBox("car ID " .. theCar["model"] .. " has been spawned.") 
        end 
    else 
        outputDebugString("Error executing the query: (" .. mysql_errno(handler) .. ") " .. mysql_error(handler)) 
    end 

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