Jump to content

Jumba'

Members
  • Posts

    254
  • Joined

  • Last visited

Everything posted by Jumba'

  1. Jumba'

    timer :S

    Just post the whole code. And that snippet you just wrote fails epically, after end you're supposed to put a ) to close the command handler, thought I have no idea if that's what you want.
  2. Maybe use element data instead, in case they dont have an account ...
  3. Jumba'

    WARNING

    Ban his entire IP range
  4. Look, eh, on the client-side file make sure its triggered with the player as the source so it'd be triggerServerEvent ( "serverRegister", getLocalPlayer(), newUsername, newPassword, newMail ) It should work.
  5. Your lucky I got some exams tomorrow, this presents a perfect opportunity to procrastinate! Try this ... you add the objectID, ZYX, time to open, move to XYZ in the gates table, I've already added your own two gates in it. So basically to open the first gate you do /open 1, and for the second /open 2, etc. Same with /close. I'd recommend adding a colcircle around the gate tho since it's a bit unrealistic to open a gate in SF while riding in LS , or just check the distance between GetDistanceBetweenPoints3D using the gate position as one point and the players position as the other. Oh, and I haven't tested it, but I suppose I'd work -- First thing is to create a table to hold all the coordinates for the gates. -- In the gates table there tables that contain the info for one gate -- { objectID, CoordX, CoordY, CoordZ, Time to move gate in ms, moveToCoordZ, moveToCoordY, moveToCoordZ ) local gates = { { 969, 209.0489654541, 1875.4265136719, 12.140625, 3000, 200.65399169922, 1875.3364257813, 12.140625 }, { 3109, 226.6572265625, 1858.30859375, 14.64695930481, 3000, 226.6572265625, 1858.30859375, 11.64695930481 } } local gate = { } -- this is where we store the gate elements. addEventHandler ( "onResourceStart", getResourceRootElement(), function ( ) for i, tbl in ipairs ( gates ) do -- when the resource start we loop over the gates table gate[i] = createObject ( tbl[1], tbl[2], tbl[3], tbl[4] ) -- we create objects, the numbers 1-4 are the location of the objectID and the XYZ coords. ( see above ) end end ) addCommandHandler ( "open", function ( source, command, gate ) if tonumber ( gate ) then -- if its not a number we cant use it. local i = tonumber ( gate ) if gate[i] then -- if that gate exists we open it up moveObject ( gate[i], gates[i][5], gates[i][6], gates[i][7], gates[i][8] ) -- we open it to the XYZ coords in x amount of seconds, 5 - 8 in the table. else outputChatBox ( "Gate not found", source ) end else outputChatBox ( "Syntax is /" .. command .. " , with gate being a number.", source ) end end ) addCommandHandler ( "close", function ( source, command, gate ) if tonumber ( gate ) then local i = tonumber ( gate ) if gate[i] then moveObject ( gate[i], gates[i][5], gates[i][2], gates[i][3], gates[i][4] ) -- same as above, but since we're closing it (going back to begin position) we use the 2-4 XYZ. else outputChatBox ( "Gate not found", source ) end else outputChatBox ( "Syntax is /" .. command .. " , with gate being a number.", source ) end end )
  6. Is it a module? Or just a normal resource?
  7. wouldn't it be faster to load the languages into a table when the resource starts? I imagine it'd be faster than opening/closing an xml file.
  8. Try these http://jum.pastebin.com/HZqzVr1R http://jum.pastebin.com/f61d7e4f You may have to fix em though, and it can be made much simpler, but yeah, it's something
  9. https://wiki.multitheftauto.com/wiki/SetPedAimTarget ?? Dunno
  10. You sure the script is client-side? -edit- It's not, since warpPedIntoVehicle worked and that's server-side only. You have to create the peds, warp em into the vehicles then use the event system to transfer them to the clients. There you can use setPedControlState
  11. Jumba'

    IRC Script

    https://wiki.multitheftauto.com/wiki/Modules/IRCEcho
  12. No, but there was a command you could use in game to display server performance. If I remember correctly, it was /shownet <1 or 0> (1 to show, 0 to hide). I think it's /netstat 1 That's what I use to get the connection data.
  13. Ah okay, I understand. Thanks for the explanation, I'll have to go modify my scripts to make them more secure ;D
  14. What do you mean with not letting the client call any server function? What should I when I have to check if the username/password is in the database then? Or am I understanding you wrong?
  15. Did you check for errors using /debugscript 3 or just in the server console? since not everything gets reported to the console.
  16. He wants the command to be //home
  17. Well did the client-side version of the script work?
  18. Doesn't work. Still bad argument @ getElementDimension. Is the script client-side or serverside? If its client side then try this. function teleHome ( ) local player = getLocalPlayer() local veh = getPedOccupiedVehicle(player) local dimension = getElementDimension(player) if dimension == 0 then if not veh then setElementPosition( player, 405.25030517578, 2436.3159179688, 17.747388839722) else setElementPosition( veh, 423.39221191406, 2522.8637695313, 16.484375) end end end addCommandHandler ( "/home", teleHome)
  19. Try this function teleHome ( source, command ) local veh = getPedOccupiedVehicle(source) local dimension = getElementDimension(source) if dimension == 0 then if not veh then setElementPosition( source, 405.25030517578, 2436.3159179688, 17.747388839722) else setElementPosition( veh, 423.39221191406, 2522.8637695313, 16.484375) end end end addCommandHandler ( "/home", teleHome)
  20. function Script_onResourceLoad ( resource ) if ( resource == getThisResource() ) then -- for each player already in the server for i, player in ipairs getElementsByType ( "player" ) do -- you forgot the "ipairs" part. -- binds the "i"-key to our function "modeIO" bindKey ( player, "i", "down", "modeIO" ) end end end addEventHandler ( "onResourceStart", getRootElement(), Script_onResourceLoad )
  21. I thikn you have to hide the normal nametags and create new ones with the directx draw functions.
  22. I've also noticed that "[true]" and "[false]" return booleans, while "true" and "false" are simple strings.
  23. You say that I don't use the Wiki? Then why I know that this event exist? magic? because I use the LUA editor. I don't see how to use the players fuctions on the wiki pages on this fuction. That's because you don't look for them. https://wiki.multitheftauto.com/wiki/Int ... _the_click
  24. Jumba'

    Player Names

    I second that, here's my ID script if you want to use it: http://jum.pastebin.com/d380519fc Woovie also posted his, but I'm not sure if you're allowed to use it, but since it's pretty much public I guess you could
  25. Jumba'

    Player Names

    This is my player matching script, I suppose you could optimize it a bit You also need to modify it to work they way you want it too, since mine is actually part of an ID system, either way, here ya go function getNameMatches ( player_name ) i = 1 local matchingPlayers = { } if ( player_name ) then for k, player in ipairs ( getElementsByType ( "player" ) ) do local player_n = getPlayerName ( player ) local match = string.find ( string.lower( player_n ), string.lower ( player_name ), 1, true ) -- I just added the true part since driver2 mentioned it, so I dont know if I put it correctly O_o if ( match ) then table.insert ( matchingPlayers, i, player ) i = i + 1 end end if ( #matchingPlayers == 1 ) then return true, matchingPlayers[1] elseif ( #matchingPlayers > 1 ) then return true, matchingPlayers else return false, "None" end else return false, "Please enter a player name" end end function getPlayerFromPartialName ( source, player_name, script ) if ( player_name ) then local sucess, value = getNameMatches ( player_name ) if ( sucess ) then local matches = #value if ( matches == 1 ) then if ( script ) then return value[1] else local player_nick = getPlayerName ( value[1] ) local player_id = getElementData ( value[1], "ID" ) outputChatBox ( "(" .. player_id .. ") " .. player_nick, source, 255, 255, 0 ) end else outputChatBox ( "Players matching your search are: ", source, 255, 255, 0 ) for k, player in ipairs ( value ) do local player_nick = getPlayerName ( value[k] ) local player_id = getElementData ( value[k], "ID" ) outputChatBox ( "(" .. player_id .. ") " .. player_nick, source, 255, 255, 0 ) end return true end else outputChatBox ( value, source, 255, 0, 0 ) end end end
×
×
  • Create New...