Jump to content

IIYAMA

Moderators
  • Posts

    6,062
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. local theTeams = {"Drug Dealers", "Police"} local sortAtPlayersInTeam = function (teamNameA,teamNameB) local teamA, teamB = getTeamFromName(teamNameA), getTeamFromName(teamNameB) if teamA and teamB then local playersInTeamA = getPlayersInTeam (teamA) local playersInTeamB = getPlayersInTeam (teamB) return playersInTeamA > playersInTeamB or (playersInTeamA == playersInTeamB and math.random(2) == 1) end return false end addCommandHandler("dd", function(player) table.sort(theTeams, sortAtPlayersInTeam) local teamName = theTeams[1] local team = getTeamFromName(teamName) if team then -- does the team exist? if teamName == "Police" then setPlayerTeam(player, getTeamFromName("Police")) spawnPlayer(player, 1585.5485839844, -1677.8289794922, 5.8969912528992) setCameraTarget(player, player) fadeCamera(player, true) setElementModel(player, 280) giveWeapon(player, 22, 200) setPlayerNametagColor(player, 0, 0, 255) outputChatBox("#0000ff(Mission) #8e8c00Kill the #fff000Drug Lord #8e8c00before he delievers the drugs!", player, 255, 255, 255, true) elseif teamName == "Drug Dealers" then setPlayerTeam(player, team) spawnPlayer(player, 1585.5485839844, -1677.8289794922, 5.8969912528992) setCameraTarget(player, player) fadeCamera(player, true) setElementModel(player, 280) giveWeapon(player, 22, 200) setPlayerNametagColor(player, 0, 0, 255) outputChatBox("#0000ff(Mission) #8e8c00Kill the #fff000Drug Lord #8e8c00before he delievers the drugs!", player, 255, 255, 255, true) end else outputDebugString("Team not found!") end end)
  2. np. Don't forget to check out this Debug resource.
  3. np. Don't forget to check out this Debug resource.
  4. Try this: local theTeams = {"Drug Dealers", "Police"} local sortAtPlayersInTeam = function (teamNameA,teamNameB) local teamA, teamB = getTeamFromName(teamNameA), getTeamFromName(teamNameB) if teamA and teamB then local playersInTeamA = getPlayersInTeam (teamA) local playersInTeamB = getPlayersInTeam (teamB) return playersInTeamA > playersInTeamB or (playersInTeamA == playersInTeamB and math.random(2) == 1) end return false end addCommandHandler("dd", function(player) table.sort(theTeams, sortAtPlayersInTeam) local team = getTeamFromName(theTeams[1]) if team then -- does the team exist? setPlayerTeam(player, team) spawnPlayer(player, 1585.5485839844, -1677.8289794922, 5.8969912528992) setCameraTarget(player, player) fadeCamera(player, true) setElementModel(player, 280) giveWeapon(player, 22, 200) setPlayerNametagColor(player, 0, 0, 255) outputChatBox("#0000ff(Mission) #8e8c00Kill the #fff000Drug Lord #8e8c00before he delievers the drugs!", player, 255, 255, 255, true) else outputDebugString("Team not found!") end end)
  5. Try this: local theTeams = {"Drug Dealers", "Police"} local sortAtPlayersInTeam = function (teamNameA,teamNameB) local teamA, teamB = getTeamFromName(teamNameA), getTeamFromName(teamNameB) if teamA and teamB then local playersInTeamA = getPlayersInTeam (teamA) local playersInTeamB = getPlayersInTeam (teamB) return playersInTeamA > playersInTeamB or (playersInTeamA == playersInTeamB and math.random(2) == 1) end return false end addCommandHandler("dd", function(player) table.sort(theTeams, sortAtPlayersInTeam) local team = getTeamFromName(theTeams[1]) if team then -- does the team exist? setPlayerTeam(player, team) spawnPlayer(player, 1585.5485839844, -1677.8289794922, 5.8969912528992) setCameraTarget(player, player) fadeCamera(player, true) setElementModel(player, 280) giveWeapon(player, 22, 200) setPlayerNametagColor(player, 0, 0, 255) outputChatBox("#0000ff(Mission) #8e8c00Kill the #fff000Drug Lord #8e8c00before he delievers the drugs!", player, 255, 255, 255, true) else outputDebugString("Team not found!") end end)
  6. People who already gave feedback after testing the resource: _EVO_ -Blaze- MoDeR2014 Don't be afraid to give feedback, I won't eat you
  7. People who already gave feedback after testing the resource: _EVO_ -Blaze- MoDeR2014 Don't be afraid to give feedback, I won't eat you
  8. Then you only have to read the bottom of my post. There is the answer.
  9. Then you only have to read the bottom of my post. There is the answer.
  10. A table wut? There is no information about that. function createVehicleByKeyName (player, cmd, name, color1, color2, tint, owner) --... end local createVehicleKeyNames = {"createvehicle", "makeveh", "makevehicle", "makecar"} for i=1, #createVehicleKeyNames do addCommandHandler(createVehicleKeyNames[i], createVehicleByKeyName) end local xml = xmlLoadFile("vehicles.xml") Why global? Makes no sense. local reload = xmlLoadFile("vehicles.xml") local mapRootElement = loadMapData ( reload, root ); --xmlSaveFile(reload) -- No need for double save. xmlUnloadFile(reload)
  11. A table wut? There is no information about that. function createVehicleByKeyName (player, cmd, name, color1, color2, tint, owner) --... end local createVehicleKeyNames = {"createvehicle", "makeveh", "makevehicle", "makecar"} for i=1, #createVehicleKeyNames do addCommandHandler(createVehicleKeyNames[i], createVehicleByKeyName) end local xml = xmlLoadFile("vehicles.xml") Why global? Makes no sense. local reload = xmlLoadFile("vehicles.xml") local mapRootElement = loadMapData ( reload, root ); --xmlSaveFile(reload) -- No need for double save. xmlUnloadFile(reload)
  12. You can reload a map file. Add these functions to your list: loadMapData -- restart, destory the element created by loadMapData destroyElement -- Re-use loadMapData
  13. You can reload a map file. Add these functions to your list: loadMapData -- restart, destory the element created by loadMapData destroyElement -- Re-use loadMapData
  14. I will start building on the new features this Friday. So I hope you can send your feedback and suggestions before then. Thank you
  15. local valueOfoption1 = get("Option") local firstNumber = gettok ( valueOfoption1, 1, string.byte(',') ) local secondNumber = gettok ( valueOfoption1, 2, string.byte(',') )
  16. My bad, <settings> <setting name="*Option" value="1,2" friendlyname="Numbers" examples="1,2,3" desc="" /> <setting name="*Option2" value="1,2" friendlyname="Numbers" examples="1,2,3" desc="" /> <setting name="*Option3" value="1,2" friendlyname="Numbers" examples="1,2,3" desc="" /> </settings> local valueOfoption1 = get("Option") local valueOfoption2 = get("Option2") local valueOfoption3 = get("Option3")
  17. https://wiki.multitheftauto.com/wiki/Xml
  18. You can increase it a little, see the example of this page: https://wiki.multitheftauto.com/wiki/En ... ODDistance
  19. Heh? Does the event 'onClientGUIMove' gets triggered when the gui isn't moving?
  20. Ok, Well lets take a look the raw data of the system: - Which type op loops are you using? - How many times does the loop gets executed? (and is this the same as the amount of items) - How many times does: loop * loop * loop be executed? (main and sub loops) - What is the execution time of the entire code? (even if the table empty) - Does the memory drop when the loops aren't operating? If that is all correct, I need some time myself to think about it.
  21. - You said maximal count is 530, so it shouldn't reach 800/850? - In how many tables are the same tables stored? (this most of the time leads to a memory leak) - How do you delete and add data? - Are there MTA elements involved or are you talking about lua objects? (GUI?) If so, try the same system without MTA elements.(fake it) - Are you using functions like: https://wiki.multitheftauto.com/wiki/GetNetworkStats ? Those have their own buffers.
  22. Ah oke, he didn't upload it on the community, so I didn't know. It shares some features, but not all of them and it has a totally different concept in showing/(working with) debug information. Thx Walid! You are the best!
  23. addEventHandler("onResourceStart", resourceRoot, function() loadFactions() for i,v in ipairs(getElementsByType("player")) do bindf1(v) end end ) function bindf1(v) bindKey(v, "F1", "down", showFactionMenu) end addEventHandler("onPlayerJoin", resourceRoot, function() bindf1(source) end )
  24. local theTeams = {"Drug Dealers", "Police"} addCommandHandler("dd", function(player) local team = getTeamFromName(theTeams[math.random(#theTeams)]) if team then -- does the team exist? setPlayerTeam(player, team) spawnPlayer(player, 1585.5485839844, -1677.8289794922, 5.8969912528992) setCameraTarget(player, player) fadeCamera(player, true) setElementModel(player, 280) giveWeapon(player, 22, 200) setPlayerNametagColor(player, 0, 0, 255) outputChatBox("#0000ff(Mission) #8e8c00Kill the #fff000Drug Lord #8e8c00before he delievers the drugs!", player, 255, 255, 255, true) else outputDebugString("Team not found!") end end)
  25. How about a feature to stop and start/restart a resource which contains this console message? I personally hate to stop a resource using adminpanel, when it simple can be done with 1 click. > Normally you have to open adminpanel(go to the resource tab), search first for the resource and click on stop, start or restart. Imagine you have only two buttons, one that restarts/starts the resource and one to stop it.
×
×
  • Create New...