Jump to content

onResourceStart (the hell man.... )


tosfera

Recommended Posts

Oke so here is the thing. I want to get rid of the .map file cause I got a fuel system that has his own way of working etc. So I exported all the information I got from the .map file (about the vehicle's I spawned) but it's telling me to fck off and hit my head against a wall or something...

So I placed this code in my onResourceStart (SERVER SIDE, I'm not stupid);

        local vehicles = {  
                {"2588.5",      "1830.59998",   "11.1", "0", "0", "270" }, 
                {"2606.3999",   "1837",         "11.1", "0", "0", "90"  }, 
                {"2606.30005",  "1843.30005",   "11.1", "0", "0", "90"  }, 
                {"2606.30005",  "1849.69995",   "11.1", "0", "0", "90"  }, 
                {"2606.3999",   "1856.09998",   "11.1", "0", "0", "90"  }, 
                {"2606.30005",  "1862.69995",   "11.1", "0", "0", "90"  }, 
                {"2606.3999",   "1830.69995",   "11.1", "0", "0", "90"  }, 
                {"2588.3999",   "1856.09998",   "11.1", "0", "0", "270" }, 
                {"2588.30005",  "1849.80005",   "11.1", "0", "0", "270" }, 
                {"2588.3999",   "1843.40002",   "11.1", "0", "0", "270" }, 
                {"2588.30005",  "1862.80005",   "11.1", "0", "0", "270" }, 
                {"2588.3999",   "1837",         "11.1", "0", "0", "270" }, 
                {"2606.3999",   "1815.09998",   "11.1", "0", "0", "90"  }, 
                {"2606.3999",   "1808.59998",   "11.1", "0", "0", "90"  }, 
                {"2588.19995",  "1808.69995",   "11.1", "0", "0", "270" }, 
                {"2606.30005",  "1802.19995",   "11.1", "0", "0", "90"  }, 
                {"2606.3999",   "1795.90002",   "11.1", "0", "0", "90"  }, 
                {"2606.5",      "1789.59998",   "11.1", "0", "0", "90"  }, 
                {"2588.19995",  "1802.40002",   "11.1", "0", "0", "270" }, 
                {"2588.19995",  "1815.09998",   "11.1", "0", "0", "270" }, 
                {"2588.3999",   "1795.90002",   "11.1", "0", "0", "270" }, 
                {"2606.5",      "1783.40002",   "11.1", "0", "0", "90"  }, 
                {"2588.3999",   "1789.90002",   "11.1", "0", "0", "270" }, 
                {"2588.3999",   "1783",         "11.1", "0", "0", "270" } }; 
                 
        for index, item in ipairs (vehicles) do 
            v = createVehicle(431, item[1], item[2], item[3]); 
            setElementData(v, "fuel", 100); 
            setElementData(v, "type", "work"); 
        end 

but its not working. Not even 1 single bus is getting spawned...

Link to comment
        local vehicles = {  
                {2588.5,      1830.59998,   11.1, 0, 0, 270 }, 
                {2606.3999,   1837,         11.1, 0, 0, 90  }, 
                {2606.30005,  1843.30005,   11.1, 0, 0, 90  }, 
                {2606.30005,  1849.69995,   11.1, 0, 0, 90  }, 
                {2606.3999,   1856.09998,   11.1, 0, 0, 90  }, 
                {2606.30005,  1862.69995,   11.1, 0, 0, 90  }, 
                {2606.3999,   1830.69995,   11.1, 0, 0, 90  }, 
                {2588.3999,   1856.09998,   11.1, 0, 0, 270 }, 
                {2588.30005,  1849.80005,   11.1, 0, 0, 270 }, 
                {2588.3999,   1843.40002,   11.1, 0, 0, 270 }, 
                {2588.30005,  1862.80005,   11.1, 0, 0, 270 }, 
                {2588.3999,   1837,         11.1, 0, 0, 270 }, 
                {2606.3999,   1815.09998,   11.1, 0, 0, 90  }, 
                {2606.3999,   1808.59998,   11.1, 0, 0, 90  }, 
                {2588.19995,  1808.69995,   11.1, 0, 0, 270 }, 
                {2606.30005,  1802.19995,   11.1, 0, 0, 90  }, 
                {2606.3999,   1795.90002,   11.1, 0, 0, 90  }, 
                {2606.5,      1789.59998,   11.1, 0, 0, 90  }, 
                {2588.19995,  1802.40002,   11.1, 0, 0, 270 }, 
                {2588.19995,  1815.09998,   11.1, 0, 0, 270 }, 
                {2588.3999,   1795.90002,   11.1, 0, 0, 270 }, 
                {2606.5,      1783.40002,   11.1, 0, 0, 90  }, 
                {2588.3999,   1789.90002,   11.1, 0, 0, 270 }, 
                {2588.3999,   1783,         11.1, 0, 0, 270 }  
}; 
                 
        for index, item in ipairs (vehicles) do 
            v = createVehicle(431, item[1], item[2], item[3]); 
            setElementData(v, "fuel", 100); 
            setElementData(v, "type", "work"); 
        end 

Try this

Link to comment

yeah, a bunch of busses has to be spawned. Only problem is, its not working as a command or as a onResourceStart. It smacked me in the face with a dizzy dummy and its still confusing me. I stopped every resource and only started 1. Still doesn't work.

ha, ha-ha, hahahahaha trolled my MTA's dimension system. --'

I left the editor but didn't reconnect. So its spammed with cars in dimension 0 now. Stupid safe system... thanks anyways! xD

Link to comment

I do get results though, test this for yourself:

  
    local vehicles = { 
            {2588.5,      1830.59998,   11.1, 0, 0, 270 }, 
            {2606.3999,   1837,         11.1, 0, 0, 90  }, 
            {2606.30005,  1843.30005,   11.1, 0, 0, 90  }, 
            {2606.30005,  1849.69995,   11.1, 0, 0, 90  }, 
            {2606.3999,   1856.09998,   11.1, 0, 0, 90  }, 
            {2606.30005,  1862.69995,   11.1, 0, 0, 90  }, 
            {2606.3999,   1830.69995,   11.1, 0, 0, 90  }, 
            {2588.3999,   1856.09998,   11.1, 0, 0, 270 }, 
            {2588.30005,  1849.80005,   11.1, 0, 0, 270 }, 
            {2588.3999,   1843.40002,   11.1, 0, 0, 270 }, 
            {2588.30005,  1862.80005,   11.1, 0, 0, 270 }, 
            {2588.3999,   1837,         11.1, 0, 0, 270 }, 
            {2606.3999,   1815.09998,   11.1, 0, 0, 90  }, 
            {2606.3999,   1808.59998,   11.1, 0, 0, 90  }, 
            {2588.19995,  1808.69995,   11.1, 0, 0, 270 }, 
            {2606.30005,  1802.19995,   11.1, 0, 0, 90  }, 
            {2606.3999,   1795.90002,   11.1, 0, 0, 90  }, 
            {2606.5,      1789.59998,   11.1, 0, 0, 90  }, 
            {2588.19995,  1802.40002,   11.1, 0, 0, 270 }, 
            {2588.19995,  1815.09998,   11.1, 0, 0, 270 }, 
            {2588.3999,   1795.90002,   11.1, 0, 0, 270 }, 
            {2606.5,      1783.40002,   11.1, 0, 0, 90  }, 
            {2588.3999,   1789.90002,   11.1, 0, 0, 270 }, 
            {2588.3999,   1783,         11.1, 0, 0, 270 } }; 
            
    for index, item in ipairs (vehicles) do 
        outputChatBox(tostring(item[1])) 
        v = createVehicle(431, item[1], item[2], item[3]); 
        local vehicle = getElementsByType("vehicle") 
        for i, v in ipairs (vehicle) do 
            outputDebugString(tostring(i).." "..tostring(v)) 
        end 
        setElementData(v, "fuel", 100); 
        setElementData(v, "type", "work"); 
    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...