Jump to content


User Guide Contributor
  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by AfuSensi

  1. 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 ~= getPedOc
  2. AfuSensi


    Never send your passwords to anyone. If anyone asks you for a password, you can count on it being a scam.
  3. 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.
  4. Did you put # aa0000 or #aa0000? It should not include a space.
  5. 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.
  6. 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 outputCh
  7. 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.
  8. 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.
  9. 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
  10. Can you rephrase your question, i think the translator messed up.
  11. 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
  12. 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.
  13. https://wiki.multitheftauto.com/wiki/Se ... oubleSided
  14. (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! Repa
  15. 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.
  16. 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.
  17. local myMessage = exports.msg:message setTimer(myMessage,23000,1,"Let's try this way",source,255,255,0) That should work.
  18. I solved this by loading the image in html with mtalocal:// <img src="mtalocal://dancething.gif">
  19. 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="clien
  20. 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
  21. Impressive! Very nice.
  22. 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 fun
  23. Why arent you checking if the sound already exists before creating a new sound? If you do not check if the sound element already exists, then it will just ignore the old sound so sound[vehicle] will only give the newly created sound. Maybe try this: local url = "http://www.181.fm/winamp.pls?station=181-power&style=mp3&description=Power%20181%20(Top%2040)&file=181-power.pls" sound = {} function playTheSound(x, y, z, vehicle) if not isElement(vehicle) then outputChatBox("Vehicle does not exist") return false end -- Checks if vehicle exist, and returns if vehicle does
  24. Do you see anything in the console (f8) when starting the resource? We need more info to be able to help. You can follow this to make yourself admin in your server: http://wiki.multitheftauto.com/wiki/Ser ... nistrators
  • Create New...