Jump to content

arc_

Retired Staff
  • Posts

    136
  • Joined

  • Last visited

Everything posted by arc_

  1. (Xeon06: first of all I'll be assuming that the "spawn" function in your code was meant to be named "testFunction", or vice versa) Like you already noticed, this is not the way it works. What you are doing in that code is calling testFunction right there, on that addEventHandler line; and then using its return value as the handler argument to addEventHandler. Obviously testFunction doesn't return anything, so you end up doing the equivalent of this: testFunction("This is a test!") addEventHandler("onClientGUIClick", myButton, nil, false) To make it work like you want it to, you would have to write code like this: addEventHandler("onClientGUIClick", myButton, function() testFunction("This is a test!") end, false) As you see, now you are passing an (anonymous) function to addEventHandler. Once the event is triggered, this function is called, which will in turn call testFunction with any arguments you want. Seeing as addEventHandler doesn't let you specify handler arguments like bindKey does, you have to take detours like this I'd also like to make a correction to Talidan's code, as it is not entirely correct (sorry Talidan): --A table that stores messages according to the button local messages = { [myButton] = "You clicked the 'myButton' button!" } function spawn() outputChatBox(messages[source]) -- grab the message from the "messages" table using the source element (the one that was clicked) as key end addEventHandler("onClientGUIClick", myButton, spawn, false)
  2. arc_

    Scripting Help

    Sorry, but to be honest the goliath in that screenshot is not an actual player . One of the QA members extracted the ped model and made it into a new object, then placed that object ingame and made it larger (with setObjectScale indeed). So it's just a stationary model, it didn't even have a collision mesh. You can get the server on the download page. Once you've installed it you probably want to look at the server manual to set it up. Scripts go in what MTA calls "resources", you can read more about those here. Good luck! (Also, DP3 will have a "host game" button which will instantly start an integrated server. That will save you the installing and configuration. For now you have to do it yourself though.)
  3. I looked at the votemanager source and saw that it uses getTickCount() as a random seed before every math.random call - maybe this function keeps returning the same value after 25 days. Try opening votemanager_polls.lua and removing all lines containing math.randomseed; I expect that should fix it.
  4. arc_

    GTA live map

    Sure, just use this instead of sendPlayers (don't forget to change it in setTimer as well): function savePlayers() local file = fileOpen('players.xml') fileWrite(file, getPlayersAsXML()) fileClose(file) end The file will be created in the resource's folder.
  5. arc_

    GTA live map

    Nice site! Try adapting this code to your needs (the update interval and line 22 to be exact): local UPDATE_INTERVAL = 1000 function getPlayersAsXML() local result = '<?xml version="1.0" encoding="UTF-8"?>\n<positions>\n' for i,player in ipairs(getElementsByType('player')) do local x, y, z = getElementPosition(player) result = result .. '\t<player id="' .. (i-1) .. '">\n' .. '\t\t<name>' .. getClientName(player) .. '</name>\n' .. '\t\t<score>' .. (getElementData(player, 'Score') or 0) .. '</score>\n' .. '\t\t<x>' .. x .. '</x>\n' .. '\t\t<y>' .. y .. '</y>\n' .. '\t\t<z>' .. z .. '</z>\n' .. '\t\t<health>' .. getElementHealth(player) .. '</health>\n' .. '\t</player>\n' end result = result .. '</positions>' return result end function sendPlayers() callRemote('http://yoursite.com/players.php', playersSent, getPlayersAsXML()) end function playersSent() end addEventHandler('onResourceStart', getResourceRootElement(getThisResource()), function() setTimer(sendPlayers, UPDATE_INTERVAL, 0) end ) See the callRemote documentation for more details on sending data to a php page.
  6. Downloads work again. We apologize for the downtime. arc_, QA member
  7. function defAutobahn ( player ) local nombre = getElementData ( player, "username" ) local theAccount = getAccount ( nombre ) setAccountData ( theAccount, "dc.consecionario", "autobahn" ) triggerClientEvent ( player, "esconCons" ) -- triggerFor = player triggerClientEvent ( player, "abrirConsAutobahn" ) -- triggerFor = player end addEvent ( "definirAutobahn", true ) addEventHandler ( "definirAutobahn", getRootElement(), defAutobahn ) Although if you do triggerServerEvent("definirAutobahn", getLocalPlayer(), getLocalPlayer()), "source" should work just as well as "player" here.
  8. Where does it say that? If I look at the addEventHandler documentation it says in the note "may lead to confusion", it says nothing about Lua. If there's some other doc page that does say it may confuse Lua, please tell me which one so I can correct it. The "problem" as you call it does not exist, neither in Lua or in MTA.
  9. That's a common mistake. You are not specifying the "trigger for" argument of triggerClientEvent, which causes it to default to the root element and trigger the event for all players. The solution is of course to specify the argument so the event only gets triggered for one player. See the documentation: triggerClientEvent. Good luck with your mode
  10. addEventHandler("onGamemodeMapStart", getRootElement(), function() for i,vehicle in ipairs(getElementsByType("vehicle")) do setVehicleIdleRespawnDelay(vehicle, 20000) end end )
  11. Hi, In your serverside dealer selection code, you are making a mistake. getAccount() expects the account name of the player, but you are passing it a player element. The function you are looking for is getClientAccount. Thanks to this topic the developers will be able to fix the crash however, so thanks for reporting it.
  12. Incorrect. The wiki pages simply mean that it may be confusing for the *scripter*. However, if you don't find it confusing as a scripter, there is no problem at all with giving the handler function the same name as the event.
  13. Hi, Thanks for your report. This seems to be a problem in MTA indeed. It has been reported to the developers. In the meantime, take a look at setVehicleLocked as an alternative for locking vehicles (you can use the function client side for letting some players enter and others not).
  14. arc_

    PHP SDK

    It's php scripts doing the function calls, not users. If you have 1 php page which several users visit, add some login system and only show the buttons that do function calls to approved users. If you just want to make sure that no php script calls the functions except yours, you could add an extra "password" argument to the functions which needs to be correct for them to execute.
  15. arc_

    PHP SDK

    http://development.mtasa.com/index.php? ... Web_Access
  16. Whether weapons are available or not depends on the server. It's a simple setting that admins can change. If you're talking about AlienX's server, there's a Weapons Area somewhere where weapons are allowed. You may find other freeroam servers where weapons are allowed everywhere, or you could start your own. And I don't really agree about the money. Money is for RPG servers. Freeroam is just roaming around over the map doing random stuff without a goal or purpose . Mieuws aka arc_, freeroam author
  17. See here for installing MTA:Race maps in MTA:SA DM: http://development.mtasa.com/index.php? ... ource:Race No conversion is necessary. No need for any mIRC scripts.
  18. "Last player" can also be interpreted as "on the last position", "behind everyone else".
  19. Hi, Thanks for your bug report. Could you please give some extra information about it? You're on last position in the race - had everyone but you finished or were there other people still driving? And once you leave, you obviously don't see the "time left" text anymore - do you mean that it goes into negative for the people who are still in the server, or did you reconnect and have a negative number on your screen?
  20. What... the... ? This is about the graphical interface: the health bar, speed bar etc. Those have nothing to do with map files. No it hasn't. It's very usable on 800x600. Anyway, the discussion about the race GUI being too large is now void as it now adjusts to the screen resolution.
  21. Well, not all people have super graphics cards. The next race release will adjust its user interface for smaller resolutions (smaller text/health bars/countdown etc). The black screen is also gone. The look of the bars and countdown won't be changed though. If you like primitive looking bars so much, just go back MTA:Race.
  22. You don't need to "convert" maps to work with the new race script, it supports MTA:Race maps out of the box (except for the "wave" spawntype for now). All you need to do is create a folder in the server "resources" folder, put the MTA:Race map in it, and add a meta.xml. You can look at existing race-*.zip files (for example race-jumpmania) in the resources folder for examples of what goes in that meta.xml. The race script indeed has a built in converter: it converts the map to a new syntax, namely the syntax that will be used by the upcoming map editor. If you just want to play exisiting maps you don't need to do this conversion however.
  23. That would just be annoying. Forcing music onto people is a bad idea if you're not sure if they'll like it. And then we're not even talking about copyright issues yet.
×
×
  • Create New...