Jump to content

SDK

Members
  • Posts

    635
  • Joined

  • Last visited

Everything posted by SDK

  1. That's because of the way race works. You can't just create a vehicle and stuff a player in it because race uses it own system to create vehicles (it repairs them on respawn actually).
  2. SDK

    Get nextmap name ?

    Nope, default race doesn't know which maps comes next. Like BinSlayer posted (he should know, he's managing one), when a map ends race checks the setting 'random maps' and either starts a vote or finds a new random map. Maybe the servers you are talking about changed there version. So novo, if you want to get the nextmap name during a currently running map, you should create a script that already selects a next map when a new map starts. Store it in some variable and you can do with it whatever you want.
  3. The "no node in meta.xml" error usually means something is wrong inside the .map xml file and race can't load it. (Here it should probably stop and give an error, but I guess they forgot that.) Then, race tries to load it as an old map from the old mta:race version, fails and gives the no race node in meta.xml error. Check your .map file with a good file editor for syntax errors, as it looks like you have some editor addons installed too.
  4. How about this? http://code.google.com/p/mtasa-resource ... ay%5D/gps/ Look in resources/[gameplay]/gps
  5. You can view a live (serverside) element tree with the elementbrowser resource. Just start 'elementbrowser', go to the server's webpage and click on "Element browser". If you really want Lua code, something like this (untested): RootNode = xmlCreateFile("dump.xml"," root") RootElement = getRootElement() function dumpNode ( element, node ) for name, value in pairs( getAllElementData(element) ) do xmlNodeSetAttribute(node, name, tostring(value)) end for _,child in ipairs(getElementChildren(element)) do dumpNode ( child, xmlCreateChild(node, getElementType(element)) ) end end dumpNode ( RootElement, RootNode )
  6. SDK

    Team manager

    There ain't one. Only scripts can change the player's team, so you should modify those scripts. Or use a timer to check every player's team and change the colour accordingly. Or set a timer with little delay after the login to check the team (dirty).
  7. Diego ninjad me, but I'm still posting it. Most of them are already possible, you just need some imagination instead of premade functions. http://bugs.mtasa.com/view.php?id=4571 viewtopic.php?p=375236#p375236 A builtin function would be nice, but for now you can try this: viewtopic.php?p=355104#p355104 MTA already has them? You can already put resources into zip files Already exists, type /help in console /connect host port nick pass https://wiki.multitheftauto.com/wiki/SetWaterLevel viewtopic.php?p=376182#p376182 https://wiki.multitheftauto.com/wiki/SetElementAlpha Scriptable, cancel the damage event and use setElementHealth to modify the damage. https://wiki.multitheftauto.com/wiki/Set ... tagShowing
  8. Try https://wiki.multitheftauto.com/wiki/ToJSON / fromJSON. You can use it to convert the table into a string and store it. Afterwards, load the string and use fromJSON to convert it back to a table. function savecar1() local car2s = getElementData(source, "car1D") local upgrades1 = toJSON(getVehicleUpgrades(car2s)) local color1, color2, color3, color4 = getVehicleColor ( car2s ) ------------------------------------------------------------------------- setAccountData (getPlayerAccount (source), "clroleplay-upgr1", upgrades1) setAccountData (getPlayerAccount (source), "clroleplay-col1", color1) setAccountData (getPlayerAccount (source), "clroleplay-col2", color2) setAccountData (getPlayerAccount (source), "clroleplay-col3", color3) setAccountData (getPlayerAccount (source), "clroleplay-col4", color4) ------------------------------------------------------------------------- outputChatBox("Vehicle #1 Saved!", source, 255, 255, 0) end addEventHandler ("savecar1", getRootElement(), savecar1) function spawncar1() local car2destroy = getElementData(source, "car1D") destroyElement (car2destroy) local x,y,z = getElementPosition(source) x = x + 5 local carID1 = getAccountData (getPlayerAccount (source), "clroleplay-car1ID") if(tostring(carID1) == "false" or tostring(carID1) == "" or tostring(carID1) == nil)then outputChatBox("This slot is empty!", source, 255, 255, 0) else local car1 = createVehicle(tonumber(carID1),x,y,z) setElementData (source, "car1D", car1) local color1 = getAccountData (getPlayerAccount (source), "clroleplay-col1") local color2 = getAccountData (getPlayerAccount (source), "clroleplay-col2") local color3 = getAccountData (getPlayerAccount (source), "clroleplay-col3") local color4 = getAccountData (getPlayerAccount (source), "clroleplay-col4") --local upgrades1 = nil -- these two lines aren't needed --local upgrades1 = {} local upgrades1 = fromJSON(getAccountData (getPlayerAccount (source), "clroleplay-upgr1")) local car2save = getElementData(source, "car1D") setVehicleColor( car1, color1, color2, color3, color4 ) for i,v in ipairs (upgrades1) do addVehicleUpgrade (car1, v) end end end addEventHandler ("spawncar1", getRootElement(), spawncar1)
  9. Like BinSlayer said, you just needed an other event. When a player spawns, his vehicle gets created and then is warped into it, this triggers onPlayerVehicleEnter. This should do it: addEventHandler("onPlayerVehicleEnter",root, function (theVehicle, seat, jacked ) local account = getPlayerAccount(source) if not account or isGuestAccount(account) then return end local color1 = getAccountData ( account, "color1" ) local color2 = getAccountData ( account, "color2" ) local color3 = getAccountData ( account, "color3" ) local color4 = getAccountData ( account, "color4" ) local color5 = getAccountData ( account, "color5" ) local color6 = getAccountData ( account, "color6" ) setVehicleColor ( theVehicle, color1, color2, color3, color4, color5, color6) end)
  10. executeCommandHandler doesn't work with builtin commands, only with commands added with addCommandHandler. @mrvicio, it's not possible now afaik
  11. SDK

    dxGetPixelColor

    http://bugs.mtasa.com/view.php?id=5596
  12. SDK

    bind key

    Post your version again
  13. SDK

    /me

    You can't remove builtin commands. But you can disable the chat output: addEventHandler('onPlayerChat', root, function(message, type) if type == 1 then -- /me action cancelEvent() end end)
  14. You could try to not use onClientResourceStart. Just add fileDelete("this_file.lua") to the end of a script file. If I remember correctly a script file is executed right after it's downloaded, before the client resource starts.
  15. You need to put new resources into this folder: C:\Program Files\MTA San Andreas 1.1\server\mods\deathmatch\resources Delete the old 'scoreboard' folder/zip, copy 'dxscoreboard', rename 'dxscoreboard' to 'scoreboard'
  16. Usually people use tables for stuff that can be done with switch. More info & examples: http://lua-users.org/wiki/SwitchStatement
  17. SDK

    list team on client

    https://wiki.multitheftauto.com/wiki/OnPlayerLogin You need to add the parameters to the function declaration. addEventHandler("onPlayerLogin", root, function(thePreviousAccount, theCurrentAccount) if ( not getAccountData(theCurrentAccount,"team") ) then local team for i, v in ipairs(factions[i][1]) do team[i]=tostring(v) end triggerClientEvent ( source, "regt", root, team ) return else spawnf ( source, getAccountData(theCurrentAccount,"team") ) outputDebugString ( tostring(getAccountData(theCurrentAccount,"team")) ) end end )
  18. SDK

    moveObject

    Heh, you're using "moveObject" as name for one of your custom functions, but that way it will overwrite the default mta function. local marker1 = createMarker ( 1253.0999755859, -1399, 12, 'cylinder', 11, 222, 222, 1, 225 ) local gate1 = createObject ( 980, 1252.8000488281, -1399.0999755859, 14.800000190735, 0, 0, 90 ) function movingObject ( hitElement, matchingDimension ) if getElementType ( hitElement ) == "player" then moveObject ( gate1, 3000, 1252.8000488281, -1413, 14.800000190735 ) end end function moveObjectBack () if getElementType ( hitElement ) == "player" then moveObject ( gate1, 3000, 1252.8000488281, -1399.0999755859, 14.800000190735 ) end end addEventHandler ( "onMarkerHit", marker1 , movingObject ) addEventHandler ( "onMarkerLeave", marker1, moveObjectBack )
  19. http://bugs.mtasa.com/view.php?id=6511
  20. It's probably another script messing around, since this one seems to be fine. My guess is that that other script is also trying to spawn the player, with a timer after onPlayerWasted. Check whatever resources you have running
  21. And function ToggleShop() if not isElementWithinColshape(localPlayer, yourSafeZoneColshape) or guiGetVisible(shopWindow) == true then guiSetVisible(shopWindow,false) showCursor(false) else guiSetVisible(shopWindow,true) showCursor(true) end end bindKey("F1","down",ToggleShop)
  22. Put important timers in separate functions: function setFuelOn(thePlayer) local getFuel = getElementData(source, "sfserver.fuel") if getFuel <= 0 then setVehicleEngineState(source, false) outputChatBox("This vehicle does not have any fuel!", thePlayer, 255, 0, 0, false) else setTimer ( checkFuel, 1000, 1, thePlayer ) end end addEventHandler("onVehicleEnter", rElement, setFuelOn) function checkFuel ( thePlayer ) local theVehicle = getPedOccupiedVehicle(thePlayer) if not theVehicle then return end -- abort local getFuel = getElementData(theVehicle, "sfserver.fuel") if getFuel <= 0 then setVehicleEngineState(theVehicle, false) outputChatBox("This vehicle does not have any fuel!", thePlayer, 255, 0, 0, false) return --abort else setElementData(theVehicle, "sfserver.fuel", getFuel - 1) end setTimer ( checkFuel, 1000, 1, thePlayer ) end
  23. Check /debugscript 3 Use tostring(who_lvl) to convert numbers to strings
  24. militaryVehicles = { [523]=true,[598]=true,[596]=true,[597]=true,[490]=true } militaryTeams = {["Military"]=true,["Naval"]=true} function militaryenterVehicle ( player, seat, jacked ) if ( militaryVehicles[getElementModel ( source )] ) and ( getPlayerTeam( player ) ) and ( not militaryTeams[getTeamName(getPlayerTeam( player ))] ) and ( seat == 0 ) then outputChatBox ( "You aren't a Military Officer , you mayn't drive this.", player ) --and tell the player why cancelEvent() end end addEventHandler ( "onVehicleStartEnter", getRootElement(), militaryenterVehicle )
  25. Serverside: setTimer(outputChatBox, 50 * 1000, 0, "Visit #00FF00blabla", root, 255, 0, 0, true)
×
×
  • Create New...