Jump to content

Lpsd

Administrators
  • Posts

    317
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Lpsd

  1. function wanted() local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do -- use a generic for loop to step through each player local wantedLevel = getPlayerWantedLevel ( thePlayer ) -- get the wanted level of the player if ( wantedLevel > 0 ) then x, y, z = getElementPosition(thePlayer) i = getElementInterior(thePlayer) d = getElementDimension(thePlayer) wantedpickup = createObject( 1247, x, y, z, i, d ) attachElements( wantedpickup , thePlayer, 0, 0, 1.5 ) -- we can use the z offset here to put it above the player end end end addEventHandler("onResourceStart",getRootElement(),function() setTimer(wanted, 5000, 0) -- when the resource starts, run every 5 seconds end) -- assume that there exists a collision shape named 'policeStation' function addWantedLevel ( player, command, level ) setPlayerWantedLevel ( player, level ) -- set the player's wanted level to 6 stars outputChatBox ( getPlayerName ( player ) .. " entered the police station!" ) end addCommandHandler("cops", addWantedLevel) -- command to give yourself a wanted level, /cops <1-6> Here you go. See if you can make sense of this, it's pretty simple.
  2. Just spent some time testing everything, got it to work but as you said, "tesztTable2" is overwriting "tesztTable", not appendind to it. I'd just suggest using a library like http://viremo.eludi.net/LuaXML/ - it comes with append functions, so you can just read in data, add to it, and save it again, much easier than what you're using at the moment.
  3. Check my updated reply also. This resource should require general.ModifyOtherObjects, because it is editing files outside of its own, in another resource. I'm not sure why you aren't receiving errors about it, I loaded this up and had lots of errors, especially about the ACL
  4. Don't know if you've already crossed this bridge, but have you given ACL rights for "ModifyOtherObjects" on this resource? Also check line 3, 4, 5 in your original reply (shown below) outputDebugString(rootNode, 1) -- rootNode doesn't exist yet rootNode = xmlLoadFile(path) outputDebugString(rootNode, 1)
  5. Mmm, so it works randomly, on and off? and you don't get any kind of error/response when it fails?
  6. Ah okay, I get you now. I was slightly confused on what the actual problem was. Have you tried including test1.xml in your meta.xml? <config src="xml/test1.xml" type="client" />
  7. Ah good. Just checking it wasn't that So let me just understand things properly... the rootNode is returning false?
  8. Where is the test1.xml file located? Is it in the same resource, inside the xml folder? If so, remove the colons before the filepath
  9. Line 111 in "votemanager_server.lua": activePoll.finishesAt = getTickCount() + activePoll.timeout * 1000 Change to activePoll.finishesAt = getTickCount() + 30000 That would make all the polls that are handled by votemanager, to last 30 seconds, and override meta.xml values Replace "30000" for your desired number, in milliseconds.
  10. Weird. How did you edit the values? If you edited it straight out the zip (votemanager.zip -> meta.xml) and saved, you should be able to just `restart votemanager`
  11. In the meta.xml for votemanager you have this settings block <settings> <setting name="*color" value="#DF6464" /> <setting name="*log_votes" value="[true]" /> <setting name="*default_timeout" value="[15]"/> <setting name="*default_allowchange" value="[false]"/> <setting name="*default_percentage" value="[65]"/> <setting name="*default_maxnominations" value="[3]"/> <setting name="*votemap_enabled" value="[true]"/> <setting name="*votemap_timeout" value="[15]"/> <setting name="*votemap_locktime" value="[120]"/> <setting name="*votemap_percentage" value="[70]"/> <setting name="*votemap_allowchange" value="[true]"/> <setting name="*votemode_enabled" value="[true]"/> <setting name="*votemode_timeout" value="[15]"/> <setting name="*votemode_locktime" value="[120]"/> <setting name="*votemode_percentage" value="[70]"/> <setting name="*votemode_allowchange" value="[true]"/> <setting name="*votekick_enabled" value="[true]"/> <setting name="*votekick_timeout" value="[15]"/> <setting name="*votekick_locktime" value="[120]"/> <setting name="*votekick_percentage" value="[70]"/> <setting name="*votekick_allowchange" value="[true]"/> <setting name="*voteban_enabled" value="[false]"/> <setting name="*voteban_timeout" value="[15]"/> <setting name="*voteban_locktime" value="[120]"/> <setting name="*voteban_percentage" value="[75]"/> <setting name="*voteban_allowchange" value="[true]"/> <setting name="*votekill_enabled" value="[false]"/> <setting name="*votekill_timeout" value="[15]"/> <setting name="*votekill_locktime" value="[120]"/> <setting name="*votekill_percentage" value="[70]"/> <setting name="*votekill_allowchange" value="[true]"/> </settings> Look for all all the "name" attributes with "_timeout" in them, you want to change the value next to it. You'll notice they're all [15] For example, this line: <setting name="*default_timeout" value="[15]"/> Can be changed to: <setting name="*default_timeout" value="[30]"/> to wait 30 seconds.
  12. Lpsd

    Gui Skins

    If you're looking to create custom designs / GUI in-game, you might want to consider some Dx functions instead. https://wiki.multitheftauto.com/wiki/DxDrawRectangle https://wiki.multitheftauto.com/wiki/DxDrawText https://wiki.multitheftauto.com/wiki/DxDrawImage
  13. https://wiki.multitheftauto.com/wiki/Tutorial:_How_To_Create_DX_Window https://wiki.multitheftauto.com/wiki/DxDrawRectangle https://wiki.multitheftauto.com/wiki/DxDrawImage https://wiki.multitheftauto.com/wiki/DxDrawText and the list goes on...
  14. No, I'm not kidding you, "bro", Start off with the basics, and work your way from there. Check out the community resources, you might find something similar to what you're trying to achieve. Otherwise, you might want to consider hiring someone to do it for you.
  15. Lpsd

    Carshop

    Check your logs https://wiki.multitheftauto.com/wiki/DbQuery Tip: The server command debugdb 2 will output verbose information on each query to a logging file (usually logs/db.log) https://wiki.multitheftauto.com/wiki/Server_Commands#debugdb
  16. Here, try this https://wiki.multitheftauto.com/wiki/Main_Page
  17. Lpsd

    Array comparison

    Works great as expected, thanks a bunch
  18. Sorry, I didn't explain myself properly. I was using this: local x, y, z = getElementPosition ( element ) However, x y & z are all 0.
  19. Small problem when trying to output/retrieve object's co-ordinates -- Table to store current elements Elements = {} -- Type of element you want to search for Type = "spawnpoint" -- Factor in already created objects -- for i,v in pairs(getElementsByType(Type)) do Elements[v] = true end -- Every secound check for new elements -- setTimer ( function() for i,v in pairs(getElementsByType(Type)) do if not Elements[v] then Elements[v] = true triggerCreated(v) end end end, 1000, 0 ) function triggerCreated(element) outputChatBox(tostring(element).." Created") local x, y, z = getElementPosition ( element ) outputChatBox("x: " .. x .. ", y: " .. y .. ", z: ".. z) end "tostring(element)" gives me "userdata: 000002CD", or similar (the numbers/letters change each time a new element is made) Therefore, I can't use that with getElementPosition. Any suggestions?
  20. Let's say I have two arrays a = { "apple", "pear", "orange", "pineapple", "tomato" } b = { "kiwi", "strawberry", "melon" } How can I compare the two arrays, and detect the entries in array b which aren't in array a?
  21. Just what I was looking for, thanks.
  22. function capsMute(message) c = 0 for i = 1, #message do if (string.match(message, "%u%u")) then c = c + 1 end end if c >= 2 then outputChatBox("Muted") -- mute player end end addEventHandler("onPlayerChat", root, capsMute) Fixed, my bad.
  23. I was wondering if there's a way to detect when an element has been created, via events. then I found this from 2009, looks like they decided not to implement it, https://bugs.mtasa.com/view.php?id=4591#c25041 If not by handler, is it possible to replicate this kind of feature? Would be really useful imo.
  24. function capsMute(message) c = 0 for i = 1, #message do if (string.match(message, "%u")) then c = c + 1 end end if c >= 2 then outputChatBox("Muted") -- mute player end end addEventHandler("onPlayerChat", root, capsMute) I guess something like this should work. Change the "2" to increase the amount of capitals needed to mute. For example, if I changed it from 2 to 10, I'd have to type "AAAAAAAAAA" to get muted, rather than "AA" Also, No you can't. Not just with "string.len"
  25. Tried it, but no luck. As @LoPollo said, I think the only way to do this would be to float an object near to the spawnpoint when it is created, and somehow associate that object with the spawnpoint, then I could just click the object instead. This is for map editing use, so the object could be destroyed on player spawn, or with a button. If you think there could be an easier way feel free to let me know
×
×
  • Create New...