-
Posts
73 -
Joined
-
Last visited
Recent Profile Visitors
1,143 profile views
DriFtyZ's Achievements
Transformer (11/54)
2
Reputation
-
thanks for the answer i realized the variables in pairs get replaced every time so i just named them dff and txd also my second fault was for using ipairs when i wanted both indexes of the table so changing ipairs to pairs worked and now the script is working good.
-
Hello community, i've made a simple loader script to replace the stock gas station in Los Santos, the assets seem to load and i see that mta tries to load the model but it doesn't in the end. Stock Gas Station Remains. Also no errors or anything in debugscript 3. here's my code i can't find the mistake here. Thanks local Models = { laepetrol1a = 5409, washgaspump = 1676, } local Textures = { barrio1_lae = 5409, wshxrefpump = 1676, } local COLS = { lae_4 = 1676, } local SHELL_PATH = "assets/Shell/" addEventHandler("onClientResourceStart", resourceRoot, function() -- Load Textures First for name, id in pairs(Textures) do local txd = engineLoadTXD ( SHELL_PATH .. name .. ".txd" ) engineImportTXD ( txd, id ) outputDebugString("GasStation: Loaded TXD (" .. SHELL_PATH .. name .. ".txd) | ID: " .. id) end for name, id in pairs(Models) do local dff = engineLoadDFF ( SHELL_PATH .. name .. ".dff" ) engineReplaceModel ( dff, id ) outputDebugString("GasStation: Loaded DFF (" .. SHELL_PATH .. name .. ".dff) | ID: " .. id) end for name, id in pairs(COLS) do local col = engineLoadCOL ( SHELL_PATH .. name .. ".col" ) --engineReplaceCOL ( col, id ) outputDebugString("GasStation: Loaded COL (" .. SHELL_PATH .. name .. ".col) | ID: " .. id) end end)
-
Hello, i am trying to create a vehicle loader script that loads all the vehicle models from a Lua table instead of adding them manually one by one but i am getting "error unexpected symbol near .." Now i know my syntax is wrong in line 18 and 20 where i try to create a variable based from the name index on the Lua table but i don't know how to accomplish it. Any help would be appreciated. Thanks local vehiclesFileNames = { AE86 = 589, ToyotaSupra = 559, ToyotaAltezza = 402, Datsun240Z = 475, Nissan180SX = 602, SilviaS13 = 401, SilviaS14 = 576, SilviaS15 = 474, Skyline2000 = 535, SkylineR32 = 555, SkylineR34 = 562, SkylineGTR = 558, } function loadVehicleFiles() for name, id in ipairs(vehiclesFileNames) do local name..txd = engineLoadTXD ( "Cars/"..name.."/"..name..".txd") engineImportTXD ( name..txd, id ) local name..dff = engineLoadDFF ( "Cars/"..name.."/"..name..".dff") engineReplaceModel ( name..dff, id ) outputDebugString("name = "..name.." | id = "..id..".") end end addEventHandler("onClientResourceStart", resourceRoot, loadVehicleFiles())
-
Fair enough you answered almost all my questions, but there is one more. if you player:setHealth(50) that "player" needs to be defined right? So if the player is defined somehow either from source or from a variable like local driftyz = getLocalPlayer() can i use driftyz:setHealth(50)? Thanks in advance
-
okay makes sense it is faster to write, but for people like me who don't know the OOP functions will have to learn them, because i remember it took me months to learn most of the procedural mta functions. Guess it is more advanced even tho it sounds more simple
-
Hello MTA SA Community i started this thread so someone who knows how the OOP works can explain it to me aswell because i have some questions and couldn't understand some of the wiki. I've seen some people using OOP in their resources instead of calling exported functions if i saw correctly. Can i use OOP to replace some exported functions? for example if i have to call a notification resource to show notifications can i use OOP to call that function who will post notifications on the player screen? And second what is the main point to use OOP at all?
-
DriFtyZ changed their profile photo
-
The brackets wasn't a problem i tried it without them before, anyways ill try the "call" way and let you know
-
<exports function="showErrorCode" type="server" /> It might looks messed because im from my phone
-
Exact what the title says, i can't figure it out what is wrong with a simple exports code im testing, thanks! error: Failed to call '[DWN]Core:showErrorCode'[string "?"] code to call the function: exports["[DWN]Core"]:showErrorCode(player, "02") code of the exported function: function showErrorCode (player, int) if player then if int == "02" then -- Some random code to excecute here outputChatBox("It Works!") end end end
-
I'm sorry my mistake i should have put [QUESTION] tag and i didn't explained well what i wanted tough i fixed it, this guy also didn't behave gentle instead of he threw a common link onto my face telling me to quit calling stuff like this bugs like i'm doing it every day
-
Yes, Its an another one annoying question from me, i have a vehicle menu where the player selects which vehicle he wants to spawn/hide unlock etc... the menu finds the player's owned vehicles through a dbQuery and separates them into rows inside the gridlist when i select a vehicle it spawns it based on the plate text, but when i close and open the menu again it just's deselects the selected row... In few words i want to make the gui selects the row itself if the vehicle is spawned when the player opens the menu how can this be possible, thanks! EDIT: Pic is a bit aged don't mind if the other buttons i said are not included in
-
thank you, i was so dumb that just tried to use only a useful function without copying the code below