LabiVila

Members
  • Content Count

    272
  • Joined

  • Last visited

Community Reputation

0 Neutral

About LabiVila

  • Rank
    Peon
  • Birthday 07/09/1998

Details

  • Location
    Kosovo

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello, its me again. I wanted to know if there was a way to delete an object from a specific dimension since destroyElement destroys in all dimensions. If there is not, how would it be the most effective way to simulate one? Thank you!
  2. Hello, I need some help finding a specific angle. So let me start, I want this: I need to get local player's rotation and display the rotation he has to do in order to be looking on the direction of the object. Like: 'you have to turn `degrees` to face the object'. I can't seem to do the right math, thank you in advance!
  3. I just solved that by setting a timer to warpPedIntoVehicle (100 ms). I don't know why but somehow it's solved. Does it matter that I call the functions with: function () without event handlers? Maybe that messed me up earlier. I'll definitely change it to the style your style tho
  4. Hello, can you help me fix this part? It's the 'warpPedIntoVehicle', every time I use this I get 'Network Trouble' and I don't know why, for a, b in ipairs (getElementsByType ("player")) do local mySpawn = math.random (1, #mapSpawns) for c, d in ipairs (mapSpawns) do if (c == mySpawn) then local veh = createVehicle (d.id, d.x, d.y, d.z) if veh then outputDebugString ("created veh") end warpPedIntoVehicle (b, veh) setCameraTarget (b, b) fadeCamera (b, true) end end end mapSpawns is fine, I can output any value of it. And I as well get the 'created veh' from outputDebugString. Dunno what's wrong...
  5. I just got into the same problem some times ago, I used this and it helped me a lot: http://stackoverflow.com/questions/9291 ... ning-ratio NewValue = (((OldValue - OldMin) * (NewMax - NewMin)) / (OldMax - OldMin)) + NewMin NewValue is gonna be your value, OldValue is gonna be your 300 for Cheetah, 500 for Infernus (depends on the car), NewMax is gonna be as much as your rectangle's length is, NewMin is gonna be 0. Good luck
  6. Also, you don't need an infinite loop to run above. It's pointless doing such, since it'll only use quite some CPU and not do much. You can set the timer once inside the 'onVehicleExplode', would be better
  7. for _,v in ipairs (getElementsByType ("team")) do guiGridListAddRow (rankinggrid, getTeamName (v)) end Replace all your lines above with these ones, should work. So you literally don't need to 'unpack' the table when loops like this above exist. EDIT: I had the page open for like 30 minutes than I replied, didn't see your comment (the guy above) x)
  8. LabiVila

    ScrollBar

    Is it a GUI scrollbar? If yes, then Wiki provides the best example: https://wiki.multitheftauto.com/wiki/GuiCreateScrollBar otherwise post your script so we can have a clue what you talkin' about
  9. local kills = {} addEventHandler ("onResourceStart", getRootElement(), function () for _,player in ipairs (getElementsByType ("player")) do local account = getPlayerAccount (player) local playerKills = getAccountData (account, "player.kills") table.insert (kills, playerKills) end end ) addCommandHandler ("ranking", function () table.sort (kills, function (a, b) return a > b end ) for _,v in ipairs (kills) do outputChatBox (v) --is gonna output kills from highest to lowest end end ) So firstly, you put all the players in a table (actually player's account) when the resource starts (you can change that as you wish, just an example). Once you do that, when you write /ranking the table is gonna sort and then the output with all the row as you want.
  10. triggerClientEvent(source,"mapRunningServer",source) Source is not defined. Try changing it to: triggerClientEvent("mapRunningServer", root)
  11. So, I'll try to sum it up quickly, the advantage of OOP is that you don't have to rewrite the whole thing over and over like "normal" scripts do. Even tho OOP is much harder, once you get used to it you won't ever script in the "normal" way again. In the script you posted, if you turn it into OOP nothing would change but the syntax. It's the same stuff literary, but I have a very good example that progressed me very much. https://forum.mtasa.com/viewtopic.php?f ... le#p753385 a cool example of metatables and OOPs.
  12. LabiVila

    Bounty

    You can use element data to determine the player with a bounty. setElementData and getElementData you can get all players in the server allPlayers = getPlayersCount () and assign a random number with randomplayer = math.random (1, allPlayers) then you can do this to assign the player as bounty for k, player in ipairs (getElementsByType ("player")) do if (k == randomplayer) then setElementData (player, "bounty", true) -- or anything you like end end Let me know for any problem
  13. What does debugscript say? It seems fine to me
  14. LabiVila

    Lock System

    local players = {cars = {}, unlockedFor = {}} addCommandHandler ("vehUser", function (player) players [player] = {} end ) addCommandHandler ("addVehicle", function (player, _, car) for name, v in pairs (players) do if (name == player) then table.insert (v.cars, car) end ) addCommandHandler ("lockFor", function (player, _, otherPlayer) local otherPlayer = getPlayerFromName (otherPlayer) for name, v in pairs (players) do if (name == player) then table.insert (v.unlockedFor, otherPlayer) end end end ) It looks a lot like this. Now you can do the 'unlockCarFor' command, opposite of the one above. and when a player enters the car as passager, you can loop through v.unlockedFor, see if there's a name similiar to the one that wants to enter, if yes let him enter, if no then cancelEvent