Jump to content


User Guide Contributor
  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by AfuSensi

  1. Are you trying to find the vehicle name by vehicle ID or are you trying to get the table index by vehicle name? Your table's syntax is invalid, as you have an empty key [], but i'm not sure what you intended.
  2. Congrats to the MTA community and thanks to the contributors and staff.
  3. To draw the text, you need to put it in an onClientRender event, because you need to draw it at every frame. Then you need to add an "onClientRender" event handler to draw your text. You can then use a timer to remove the event handler, so that the text disappears after the timer executes. Example: -- Create a function that draws your text. function drawWarning() dxDrawText("Do not try to camp!", 0, 0, x, y, tocolor(255, 0, 0), 2, "pricedown", "center", "center") end addEventHandler("onClientVehicleCollision", getRootElement(), function(hitElement) if source ~= getPedOccupiedVehicle(localPlayer) then return end if getElementType(hitElement) == "object" and getElementModel(hitElement) == 6959 then -- Show text (handle "onClientRender" event) addEventHandler("onClientRender", root, drawWarning) -- Create a timer that makes sure the "onClientRender" handler gets removed when it expires. setTimer(removeEventHandler, 5000, 1, "onClientRender", root, drawWarning) blowVehicle(source) end end)
  4. AfuSensi


    Never send your passwords to anyone. If anyone asks you for a password, you can count on it being a scam.
  5. You need a server that can run Node.js The repository also includes a readme that explains how you run it on your server. It's pretty straight-forward so try to follow it. If you have any questions, feel free to ask.
  6. Did you put # aa0000 or #aa0000? It should not include a space.
  7. If you follow the call chain, you will see a lot more vehicle dependencies. That's just the first place it checks for a vehicle.
  8. If you just want a cooldown you dont really need a timer for this. You can use getTickCount to keep track of time. (which does not create unnecessary timers) For example: local cooldownTime = 3 * 60 * 1000 -- Cooldown time in ms local lastHit -- Last time we hit the marker while out of cooldown function markerHitHandler() local currentTick = getTickCount() -- Check if the time between the current and last tick is smaller than our cooldown if lastHit and currentTick - lastHit <= cooldownTime then -- We are still on a cooldown so we stop the function execution outputChatBox("Still on cooldown") return else -- If we are not in cooldown, assign the current tick so that we can compare it in the future. lastHit = currentTick end openGUI() end addEventHandler("onClientMarkerHit", marker, markerHitHandler)
  9. I might be wrong but doesnt adding the color code render the color in the scoreboard? If so, just replace Admin with #aa0000Admin Just a tip though, this does not need to be on a timer. You can use event such as onPlayerLogin , onPlayerLogout and onPlayerJoin to set a player's Rank. This will prevent your server from running the same checks every 500 ms while also keeping it updated.
  10. Here's where it's defined: https://github.com/multitheftauto/mtasa-resources/blob/master/[gamemodes]/[race]/race/race_client.lua#L26 You can change the font by replacing `bankgothic` with another font name.
  11. I'm not sure how well this would work because the race resource is specifically built assuming players are in vehicles. This is where race handles checkpoint hits: https://github.com/multitheftauto/mtasa-resources/blob/master/[gamemodes]/[race]/race/race_client.lua#L700-L746 As you can see, it assumes a vehicle, and will return at if elem ~= g_Vehicle or isVehicleBlown(g_Vehicle) or getElementHealth(g_Me) == 0 or Spectate.active then return end
  12. Can you rephrase your question, i think the translator messed up.
  13. Truth - MTA Wiki Discord Bot Since i was in need for a wiki discord bot on a discord server, I decided to make one. I have also created a dashboard to manage the bot's setting on your guild. This bot is open source so feel free to submit PR's or issues. There is a new wiki coming soon(?), so i am planning to convert this bot to use the new version once it releases if there's no official wiki bot available at that time. I hope this bot can be of use to you. Features Wiki article fetching like on MTA's official discord Wiki article searching Function/Event examples Customizable bot output set via dashboard (hide syntax, hide description etc) Links https://truth.afusensi.xyz/ https://github.com/AfuSensi/truth-mta-wiki-bot
  14. AfuSensi

    Help script

    Try this: function rewardTimer(player) local player = source or player setTimer ( rewardOnRun, 10000, 1,player ) givePlayerMoney ( player, 3000 ) end addEventHandler ( "onPlayerSpawn", getRootElement(), rewardTimer ) function rewardOnRun(player) givePlayerMoney ( player, 3000 ) setTimer ( rewardTimer, 10000, 1,player ) end You did not give any argument to the rewardOnRun() function. This would make it work, although i am not sure what you are trying to do with the code.
  15. https://wiki.multitheftauto.com/wiki/Se ... oubleSided
  16. (not tested) I used timers this time, but same can be applied with getTickCount() --------------------------- -- Repair vehicle --------------------------- local repairDelayTime = 30000 -- delay time in ms local repairTimer = false function repairVehicle() if isTimer(repairTimer) then local timeleft = math.ceil( getTimerDetails(repairTimer)/1000 ) -- Get seconds left from timer if timeleft then local secondString = " second" if timeleft > 1 then secondString = " seconds" end outputChatBox("Repair failed! Repair is possible again in "..tostring(timeleft)..secondString) return false end end local vehicle = getPedOccupiedVehicle(g_Me) if vehicle then server.fixVehicle(vehicle) repairDelayTime = setTimer(function() repairTimer = false end,repairDelayTime,1) end end addCommandHandler('repair', repairVehicle) addCommandHandler('rp', repairVehicle)
  17. Are you sure textFrom is returning the proper text? I tested this in runcode: crun outputChatBox( split("Dollars - USD"," - ")[1] ) outputChatBox( split("Dollars - USD"," - ")[2] ) And it works properly, so i really think it's textForm (guiComboBoxGetItemText) causing the issue.
  18. You can do it with getTickCount() Example: local repairDelay = 30000 -- 30 seconds delay (in ms) local delayTick = false function repairFunction() -- Check when the last repair was if getTickCount() - delayTick < repairDelay then return end -- If it's less then repairDelay ms ago then abort -- repair code --set tick when repair happened delayTick = getTickCount() end Not tested, but you get the point.
  19. local myMessage = exports.msg:message setTimer(myMessage,23000,1,"Let's try this way",source,255,255,0) That should work.
  20. I solved this by loading the image in html with mtalocal:// <img src="mtalocal://dancething.gif">
  21. I am unable to put any images in my local html via the browser. If i load the image directly ( via loadBrowserURL(browser,"image.gif") ) it works correctly, but if i load a html page containing an image, it does not show. HTML: <html> <body > a <img src="dancething.gif"> a </body> </html> If i load this, it does show the text, but not the images. This is in my meta: <meta> <info description="test" type="misc" version="1.0" /> <file src="dancething.gif"/> <script src="test_c.lua" type="client" /> <file src="html.html" /> </meta> This is what shows ingame: So my question is, is anyone able to show images in their local html ?
  22. Then the event will only trigger if it get's triggered by the resource(resourceRoot) or his children, instead of everything (root). https://wiki.multitheftauto.com/wiki/AddEventHandler https://wiki.multitheftauto.com/wiki/Element_tree
  23. Impressive! Very nice.
  24. I know them both already..... As i said, i need to check for starting resources in general, not a speciefied resource... Do you understand? Lemme make an example if a resource is starting then Not a specefied resource... because , i need to do an action, when every resource starts.... Thats why he showed you the event, they trigger when a resource is about to start / starting. I've put the code for both a server script and a client script, the only difference is the name of the event ("onResourceStart" and "onClientResourceStart") This is how it's done: -- SERVER variation function checkStartedRes(res) -- Code here outputChatBox("Started resource: " .. getResourceName(res)) end addEventHandler("onResourceStart",root,checkStartedRes) -- CLIENT variation function checkStartedRes(res) -- Code here outputChatBox("Started resource: " .. getResourceName(res)) end addEventHandler("onClientResourceStart",root,checkStartedRes) Use onResourcePreStart if you want it to trigger before a resource is starting.
  • Create New...