Jump to content

botder

MTA Team
  • Posts

    524
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by botder

  1. You never close the XML files after you opened them. xmlUnloadFile(xml) And you open the same file twice in one run.
  2. botder

    Basic Problem

    I corrected your meta.xml. @Fishy: Did you refresh your resources with /refresh (you can also write 'refresh' without the ' in the server console)
  3. function convertXP (account) setTimer( function (playeraccount, player) if ( playeraccount ) then outputChatBox("asd") local xp = getAccountData(playeraccount,"lvlsystem.xp") local currLevel = getAccountData (playeraccount, "lvlsystem.currLevel") triggerClientEvent ( player, "getLevel", player, "Level: " .. currLevel .. " xp: " .. xp .. "") if xp then if (xp) < 1000 then elseif (xp) > 1000 then local currLevel = getAccountData (playeraccount, "lvlsystem.currLevel") setAccountData(playeraccount,"lvlsystem.xp",xp - 1000) setAccountData(playeraccount,"lvlsystem.currLevel",currLevel + 1) -- level up message here -- end else setAccountData(playeraccount,"lvlsystem.xp",0) end end end, 2000, 1, account, source) end addEventHandler("onPlayerLogin",getRootElement(),convertXP)
  4. function getPlayerHealthColor(player) if not isElement(player) or getElementType(player) ~= "player" then return 255, 0, 0 end local health = math.max(0, getElementHealth(player)) local stat = getPedStat(player, 24) local maxhealth = math.max(1, 100 + (stat - 569) / 4.31) local f = math.max(0, math.min(1, health / maxhealth)) return math.min(255, (510 * (1-f))), math.min(255, 510 * f), 0 end
  5. function cmdType() addEventHandler("onClientRender", getRootElement(), DxMenu) showCursor(true) DxMenu = true -- You killed the function here, it doesn't exist anymore end
  6. gUserData = { } function resetPlayer(player) gUserData[player] = { id = false, admin = false, gender = 'm', skin = 0, mask = 0, money = 0, kills = 0, deaths = 0, } end addEventHandler("onPlayerJoin", root, function () resetPlayer(source) end ) addEventHandler("onPlayerQuit", root, function () -- Release the memory gUserData[source] = nil end ) addEventHandler("onResourceStart", resourceRoot, function () local playerlist = getElementsByType("player") for i = 1, #playerlist do resetPlayer(playerlist[i]) end end ) addEventHandler("onPlayerWasted", root, function (totalAmmo, killer) if isElement(killer) then gUserData[killer].kills = gUserData[killer].kills + 1 end gUserData[source].deaths = gUserData[source].deaths + 1 end )
  7. Show us the code in the current state.
  8. botder

    Question

    Use utfLen, because string.len only supports ASCII
  9. local msg = table.concat({...}, " ") if msg:find("/") == 1 and msg:len() > 1 then -- Command local cmd, params = msg:match("/(%S+)%s*(.*)") return executeCommandHandler(cmd, player, params) else -- Message -- ... end
  10. Both are variables, but with different types. (boolean and function) test = function() end
  11. Stop that nonsense. @Drakath: The ped should exist in that server tick, when you script runs the loop. You can always use a isElement check if you want to be 100% sure.
  12. local number = ("Vehicle (ID: 100)"):match("%d+") -- = "100"[string]
  13. Well, sorry for that, I never used that parameter 18.164 objects on one spot is very bad
  14. You are using the DxMenu variable for your function and then you overwrite it with your boolean. Change your variable name. function DxMenu() local DxMenu = false -- function DxMenu doesn't exist anymore
  15. That's not the amount of streamed in objects. Use this: count = 0 objects = getElementsByType("object") for i = 1, #objects do if isElementStreamedIn(objects[i]) then count = count + 1 end end outputChatBox("Number of streamed-in objects: ".. count .." / ".. tostring(#objects))
  16. function getVehicleHealthColor(vehicle) if (not isElement(vehicle)) then return end if (getElementType(vehicle) ~= "vehicle") then return end local health = getElementHealth(vehicle) local f = math.max(0, math.min(1, health / 1000)) return math.min(255, (510 * (1-f))), math.min(255, 510 * f), 0 end
  17. You could have used JSON.
  18. <author="Xwad" type="script"/> Missing a node name ==> <info author="Xwad" type="script"/>
  19. Find the texture name out. https://wiki.multitheftauto.com/wiki/Sh ... ture_names
  20. You have to disable "MovePlayerAway" (race_client). Possible explanation: The function moves the player's camera and player to a far position and then back, which causes the short black screen. Warning: I don't know what might break when you disable it.
  21. race_client.lua (line 169 for me) -- Called from server function notifyLoadingMap( mapName, authorName ) fadeCamera( false, 0.0, 0,0,0 ) -- fadeout, instant, black TravelScreen.show( mapName, authorName ) end in function initRace (line 266 for me) fadeCamera( false, 0.0 ) later in the initRace function (line 284 for me) setTimer(fadeCamera, delay + 750, 1, true, 10.0) setTimer(fadeCamera, delay + 1500, 1, true, 2.0) race_server.lua (line 759 for me) addEventHandler('onGamemodeMapStop', g_Root, function(mapres) --Clear the scoreboard for i,player in ipairs(getElementsByType"player") do setElementData ( player, "race rank", "" ) setElementData ( player, "checkpoint", "" ) end fadeCamera ( g_RootPlayers, false, 0.0, 0,0, 0 ) gotoState('NoMap') unloadAll() end )
  22. Use a variable (boolean), which will tell the script, if the player is supposed to click on an element or not.
  23. Sounds like a long loop in the wrapper might be crashing the client.
  24. Everytime you click on your button you generate an event handler for onClientClick.
×
×
  • Create New...