Jump to content

SDK

Members
  • Posts

    635
  • Joined

  • Last visited

Everything posted by SDK

  1. Your SQL query selects jailTime, not "time", I think this will do: local result = exports.sql:query_assoc( "SELECT jailTime FROM characters WHERE characterID = "..characterID ) for key, value in ipairs( result ) do local time= value.jailTime
  2. Before telling it doesn't work, at least try debugging it and/or telling us error messages: https://wiki.multitheftauto.com/wiki/Debugging
  3. outputChatBox("Hunter TopTimes: "..getPlayerName(source).. ' got TopTime Position! | Rank: ' .. newPos .. " | Time:"..msToTimeStr(newTime))
  4. If it's only players, then you'll have to set the game speed client side, cause setGameSpeed doesnt have a player argument
  5. And if you don't want them to be able to open the box, you can use toggleControl(thePlayer, 'chat', false). (This doesn't disable chat, players can still use 'say' in the console, so use Solidsnake14's script too ^ )
  6. If I'd were you, I would store the amount of alive players at the map start, since players join/leave during maps. local current_players = 1 addEvent('onRaceStateChanging', true) addEvent('onRaceStateChanging', root, function(newState, oldState) if oldState == 'GridCountdown' and newState == 'Running' then current_players = # getAlivePlayers() end end)
  7. It's not a random number, it's the amount of time in milliseconds: 199507 milliseconds = 3*60*1000 + 19 * 1000 + 507 = 3 minutes + 19 seconds + 507 milliseconds this function comes from race_toptimes: function msToTimeStr(ms) if not ms then return '' end local centiseconds = tostring(math.floor(math.fmod(ms, 1000)/10)) if #centiseconds == 1 then centiseconds = '0' .. centiseconds end local s = math.floor(ms / 1000) local seconds = tostring(math.fmod(s, 60)) if #seconds == 1 then seconds = '0' .. seconds end local minutes = tostring(math.floor(s / 60)) return minutes .. ':' .. seconds .. ':' .. centiseconds end
  8. getGameSpeed ( zombie, 0.7 ) -- You can't set game speed for peds/zombies, you'll have to use something else for that. (blendPedAnimation has a speed parameter?) setGravity ( zombie, 0.009) -- needs to be setPedGravity, like I already told you before...
  9. SDK

    Bounded keys

    Probably not possible, you can try to disable the control and enable it when your pressing shift, but I doubt it'll work.
  10. SDK

    BindKey problem

    First take a look at the guitest.zip resource if you don't know what you're doing (the command code is in guitest.lua): http://dkrclan.com/?p=qttolua&large#downloads And where the commandhandler is, you can add a bindkey function.
  11. SDK

    Team Spawns?

    Did you try using spawnPlayer? That should work even on alive players iirc. function quitteam(source) spawnPlayer (source, hoboSpawnX, hoboSpawnY, hoboSpawnZ, hoboSpawnRotation, 230) giveWeapon(source, hoboWeapon, hoboAmmo) giveWeapon(source, hoboOtherWeapon, hoboOtherAmmo) end addCommandHandler ("quitteam",quitteam)
  12. SDK

    Achievement

    That code has a "end" on line 8 that shouldn't be there, didn't that show up when debugging?
  13. Because these two lines do the same: local x1, y1, z1 = getElementPosition(playerValue) local x2, y2, z2 = getElementPosition(playerValue) One of them should get the position of the player you're comparing to, so change the second playerValue to the correct player element
  14. SDK

    Achievement

    You need to debug (and no, that's not opening /debugscript and looking for errors). https://wiki.multitheftauto.com/wiki/Deb ... s_executed add some custom debugmessages, like outputDebugString("player has finished map") so you can see where your code stops working
  15. I'd like to see this added, our server has over 1000 maps/resources atm. When we /refresh to add new maps, it sometimes gives some small network trouble, sometimes more. Don't know if it's possible to implement it that way, I hope so.
  16. https://wiki.multitheftauto.com/wiki/SetVehicleRotation They are already deprecated ...
  17. How does it not work? Say what you did, how you tested it, how you put it in your scripts, what errors appeared in debugscript, etc.
  18. One possibility would be to check the speed every second: function checkSpeed() speedx, speedy, speedz = getElementVelocity (getPedOccupiedVehicle(getLocalPlayer()) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) if (actualspeed) >= 100 then outputChatBox ("Nice speed man.") killTimer ( timer1 ) end end timer1 = setTimer(checkSpeed, 1000, 0)
  19. Actually, it works on all elements, not only GUI elements. And if I understand it correctly, setElementData only set's data on the element you specify, not on the children. What happens in your script is that getElementData inherits the value of the element's parent, the window here. Inheriting happens by default, but you can disable it with the inherit parameter. Wiki: inherit: - toggles whether or not the function should go up the hierarchy to find the requested key in case the specified element doesn't have it. local window = guiCreateWindow( 100, 200, 100, 100, "testwindow", false ) local button = guiCreateButton( 10, 30, 30, 30, "testbutton", false, window ) local label = guiCreateLabel( 0, 0, 20, 20, "testlabel", false, button ) outputChatBox( "W1: " .. tostring( getElementData( window, "testdata", false ) ) ) outputChatBox( "B1: " .. tostring( getElementData( button, "testdata", false ) ) ) outputChatBox( "L1: " .. tostring( getElementData( label, "testdata", false ) ) ) setElementData( window, "testdata", "THEDATA" ) outputChatBox( "W2: " .. tostring( getElementData( window, "testdata", false ) ) ) outputChatBox( "B2: " .. tostring( getElementData( button, "testdata", false ) ) ) outputChatBox( "L2: " .. tostring( getElementData( label, "testdata", false ) ) )
  20. viewtopic.php?f=91&t=24660&start=46 Read and you'll know
  21. the meta.xml has a setting for that: <setting name="StreamMethod" value="[1]" /> <!-- 1 to constantly stream zombies, 0 to only allow zombies to spawn via createZombie function, 2 to only allow spawning at set spawnpoints --> You need option 2, but you ofc need to add zombie spawns in your maps then.
  22. Welcome to Lua 1st, use [ lua][ /lua] tags. 2nd, Lua scripts are case sensitive, so you need to check the wiki when you're scripting with MTA functions. function GetPosition ( player ) local x, y, z = getElementPosition( player ) local rx, ry, rz = getElementRotation( player ) outputChatBox( "Your Position: "..x..", "..y..", "..z..", Rotation: "..rx..", "..ry..", "..rz) end addCommandHandler ( "pos", GetPosition )
  23. Then use createColSphere(0,0,0,10)
×
×
  • Create New...