-
Posts
1,060 -
Joined
-
Last visited
-
Days Won
9
Everything posted by Addlibs
-
--Remove lines 62 to 64 and replace with this. if distance >= 100 then string = type .. " BONUS 70$! Distance: " .. distance .. " Time: " .. time givePlayerMoney (source, 70) end And I would not suggest using variables such as 'type' or 'string' as they're pre-defined and you might lose access to functions such as string.format when 'string' is set to a string value instead of the original table. 'type' is used to check the type of a value (eg. nil, boolean, string, integer, userdata [usually elements]) and 'string' is a table containing some very useful string operation functions.
-
Save files with fileSave and/or fileFlush
-
If I am not mistaken, this is for a DayZ server, therefore, you can use a check for the 'admin' (or 'support') element data. function startgm() if not getElementData(getLocalPlayer(), "admin") then outputChatBox("You are not an admin.", 255, 0, 0) return; end --End function here if client is not an admin if not getElementData(getLocalPlayer(), "onduty") then gmtimer = setTimer(gmforad, 2000, 0) outputChatBox ("You're now on-duty",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", true) else killTimer (gmtimer) setElementData(getLocalPlayer(),"blood", 12000) outputChatBox ("You're now off-duty!",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", false) end end addCommandHandler("duty", startgm) function gmforad() if getElementData(getLocalPlayer(),"logedin") then setElementData(getLocalPlayer(),"blood", 500000) setElementData(getLocalPlayer(),"bleeding", 0) setElementData(getLocalPlayer(),"cold", false) setElementData(getLocalPlayer(),"temperature", 37) setElementData(getLocalPlayer(),"pain", false) setElementData(getLocalPlayer(),"brokenbone", false) setElementData(getLocalPlayer(),"thirst", 100) setElementData(getLocalPlayer(),"food", 100) end end
-
This forum is for help with errors / help in general, not requesting for someone else to do something for you. You should try yourself and if you get stuck, tell us what is your exact problem and maybe someone will help you.
-
If you have a unique primary key column assigned, you can perform a standard INSERT statement followed with ON DUPLICATE KEY UPDATE INSERT INTO tablename (col1, col2, col3) VALUES(?, ?, ?) ON DUPLICATE KEY UPDATE col1 = VALUES(col1), col2 = VALUES(col2), col3 = VALUES(col3); //Remember that these are column names, nothing related to the values on this line. Source: http://stackoverflow.com/questions/1263 ... ntax-error
-
function startgm() if not getElementData(getLocalPlayer(), "onduty") then gmtimer = setTimer(gmforad, 2000, 0) outputChatBox ("You're now on-duty",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", true) else killTimer (gmtimer) setElementData(getLocalPlayer(),"blood", 12000) outputChatBox ("You're now off-duty!",255, 0, 0,true) setElementData(getLocalPlayer(), "onduty", false) end end addCommandHandler("duty", startgm) function gmforad() if getElementData(getLocalPlayer(),"logedin") then setElementData(getLocalPlayer(),"blood", 500000) setElementData(getLocalPlayer(),"bleeding", 0) setElementData(getLocalPlayer(),"cold", false) setElementData(getLocalPlayer(),"temperature", 37) setElementData(getLocalPlayer(),"pain", false) setElementData(getLocalPlayer(),"brokenbone", false) setElementData(getLocalPlayer(),"thirst", 100) setElementData(getLocalPlayer(),"food", 100) end end
-
I once managed to remove them through cancelEvent on onClientChatMessage (client-side) by checking for prefix - eg. addEventHandler("onClientChatMessage", root, function(message) if message:sub(1, 6) == "login:" then cancelEvent() end end )
-
Line 6, remove return x, y, z
-
I don't really get what you mean by 'flips over the whole y-axis'
-
Erm - as far as I know rotation (180, 0, 180) is the same as (0, 180, 0). When an object is facing North, X rotation is pitch (nose up/down), Y rotation is the roll, and Z is the yaw. X=180 makes an object go up-side-down facing South, and Z=180 turns it again North Y=180 makes the object roll up-side-down still facing North. Same thing?
-
Any /debugscript 3 messages? Also, try putting some outputDebugString after every Lua statement (eg. if statements) to see how Lua evaluates the code and where the error might be.
-
It doesn't work since both tDrink and AnimationOff are triggered when you press wDrink button. You can remove --stop animation [example button 02] function StopAnimation() if source == wDrink then triggerServerEvent("AnimationOff", getLocalPlayer()) guiSetVisible(eatMenu,false) showCursor(false) end end addEventHandler("onClientGUIClick", root, StopAnimation) --stop animation [example button 02] addEvent ("AnimationOff", true) addEventHandler ("AnimationOff", getRootElement(), function() setPedAnimation ( client ) end) since you've made tDrink stop the animation if it's already playing. I have also noticed that you'd have to turn off 'loop' from the animation, otherwise players might get stuck when they drink and close their panel — becoming unable to move in to the marker once again due to animation.
-
So all you want to do is play a continuous sound to all players originating from the vehicle with its sirens on and an ability to toggle it on or off? That's not hard.
-
Can be done with a render target (by drawing a bit outside it) or overlapped by a screen source.. No idea which one is more efficient
-
MySQL or SQLite? MySQL requires an specific server to be running. SQLite uses .db files in the server's files
-
Updated the previous post, try it now
-
addEvent('tDrink', true ) addEventHandler('tDrink', root, function ( ) local daBlockz = getElementData(source,"blockz") -- Changed root => source local daAnimz = getElementData(source,"animz") -- Changed root => source if daBlockz == "DANCING" and daAnimz == "dnce_m_b" then setPedAnimation(source, false) else setTimer( function(player) setPedAnimation(player, "DANCING", "dnce_m_b" , -1, true, true, true, true) setElementData(player, "blockz", "DANCING") setElementData(player, "animz", "dnce_m_b") end, 100, 1, source) --Edited timer to also set new element data for blockz and animz end end ) Everything else should be alright.
-
I think you should test this with a few people using performancebrowser (a default MTA resource for MTASA HTTP server protocol) or ipb (ingame performance browser) If you conclude with using this feature, remember to make sure that the players you're checking are streamed in - you probably don't need it for players who are far away from the local player.
-
local menu = exports[ "SAFMenu" ].Menu_create( localPlayer, bot:getData("name"),155,0, 0 ) As far as I know, exports is a table, but exports["SAFMenu"] is more like a class... I think you were meant to put a semi-colon ( : ) instead of the period ( . ) between exports["SAFMenu"] and Menu_create
-
Missing script file location in debug script only occurs on Lua errors (not MTA function argument errors) in compiled Lua files (haven't personally tested this though, heard that somewhere else a while ago)
-
Problem is in your ipairs statement. for [key,] value in ipairs If you only specify 1 variable, it will be the value (In your case it is the actual Lua table), not the index number addEventHandler("onResourceStart", resourceRoot, function() for i,v in ipairs(_Missions) do _Mission = Element.create("Mission") _Mission.id = i --Changing the 'id' attribute is just the same as using _Mission.setID(_Mission, …) or _Mission:setID(…) where … is the actual ID string. _Mission:setData("name", v.name) --You can't set custom attributes at this very stage of MTA's OOP, use element data instead _Mission:setData("short", v.short) _Mission:setData("minPly", v.minPly) _Mission:setData("maxPly", v.maxPly) outputServerLog(i.name) end end )
-
You could use dxDrawImageSection with dxCreateScreenSource and dxUpdateScreenSource
-
As far as I'm concerned, none of what is uploaded through lac.mtasa.com is reviewed by the MTA administration. It is just an online compiler made in interest of protecting scripts from being stolen. Compiled scripts with verified reports of backdoors have their (compiled) content added to a list of 'malicious scripts', which restricts these scripts from being loaded. I do believe that there should be an option to disable such protection, under the server manager's own risk.