Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. First question: local bots = { } local totalZombies = 0 function startnextwave ( wave ) if ( wave == 2 ) then for i = 1, tonumber ( wave * 2 ) do local bot = exports [ "zombies" ]: createZombie ( 0, 0, 0, 0, 140, 0, 0 ) bots [ bot ] = true totalZombies = ( totalZombies + 1 ) outputChatBox ( "chatbox outputs are the zombies." ) end end end addEvent ( "onZombieWasted", true ) addEventHandler ( "onZombieWasted", root, function ( ) if ( bots [ source ] ) then totalZombies = ( totalZombies - 1 ) wave = 1 chekwave ( wave, totalZombies ) outputChatBox ( "zombiekill" ) bots [ source ] = nil end end ) function chekwave ( wave, zombies ) if ( zombies == 0) then wave = ( wave + 1 ) setTimer ( startnextwave, 5000, 1, wave ) end end Try it, though I'm not sure if 'source' from 'onZombieWasted' is the zombie you killed. Second question: That XML is wrong, should be: "23" posy="355" posz="32432" name="lol" /> "3423" posy="3355" posz="3232" name="Test" /> "2433" posy="3545" posz="32" name="Me gusta" /> Then you can loop them all like this: local pathsFile = xmlLoadFile ( "paths.xml" ) if ( pathsFile ) then for index, path in ipairs ( xmlNodeGetChildren ( pathsFile ) ) do local data = xmlNodeGetAttributes ( path ) outputChatBox ( data.name ) end end
  2. Castillo

    script help

    mainWin = guiCreateWindow(0.80, 0.15, 0.20, 0.60,"WINDOW!!!!!!!!!", true) guiSetVisible ( mianWin, false ) function masiniukui() local car = getPedOccupiedVehicle(getLocalPlayer()) if car then local driver = getVehicleOccupant(car) if driver then if isPedInVehicle(driver) then local carClick = getPedOccupiedVehicle(driver) if carClick then guiSetVisible(mainWin, true) end end end end end addEventHandler("onClientClick", getRootElement(), masiniukui) function cursor( ) if not isCursorShowing() then showCursor(true) else showCursor(false) guiSetVisible(mainWin, false) end end function bind (thePlayer, seat) if source == localPlayer then bindKey( "m", "down", cursor) end end addEventHandler("onClientPlayerVehicleEnter", getRootElement(), bind) You was creating the window every time.
  3. Castillo

    script help

    Because that will be triggered by remote players as well.
  4. Castillo

    script help

    You should check if the player that entered the vehicle is the localPlayer. if ( source == localPlayer ) then -- Bind key end
  5. Castillo

    script help

    if showCursor == false then That is wrong, you should use: if ( not isCursorShowing ( ) ) then Or just: showCursor ( not isCursorShowing ( ) ) Would show the cursor if is not already showing, else hide it.
  6. Castillo

    script help

    addEventHandler ( "onClientVehicleEnter", root, function ( thePlayer, seat ) if ( thePlayer == localPlayer ) then bindKey ( "M", "down", bind ) end end ) That would work.
  7. Castillo

    script help

    Why didn't work? post what you tried.
  8. Castillo

    script help

    So, what you want to do is bind a key to trigger that event? function bind ( ) bindKey ( source, "m", "down", trigger ) end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), bind ) function trigger ( thePlayer ) if ( isPedInVehicle ( thePlayer ) ) then triggerClientEvent ( thePlayer, "bindKey", getRootElement(), "trigger" ) else outputChatBox ( "u need to be in a car", thePlayer ) end end
  9. Castillo

    script help

    This doesn't really make much sense, why are you binding the key to the same function that binds it? it makes no sense.
  10. No creo que haya ninguno como esos en la comunidad, podes buscar igual. https://community.multitheftauto.com/
  11. You must make a script to do that, map editor only creates them.
  12. setPedAnimation giveWeapon setPedControlState Click on each function name which will redirect you to the MTA wiki where you can learn the syntax.
  13. Example: coordinates = { { 0, 0, 0 }, { 0, 0, 5 }, { 0, 0, 10 }, } x, y, z = unpack ( coordinates [ math.random ( #coordinates ) ] )
  14. You must make a table with coordinates, then get a random one using: math.random
  15. The register system is not built-in, it's part of the admin panel by lil_toady. But the login system it is, though, you can disable that command by restricting it to all in the "acl.xml".
  16. Destroy the sound via: destroyElement
  17. Maps aren't stored on your hard drive.
  18. Is it that hard to go to the link I posted and check the function arguments?
  19. "setMoney" function doesn't exist, there is: setPlayerMoney and givePlayerMoney, you should use givePlayerMoney.
  20. setElementFrozen is a function, not an event. It works like this: myPed = createPed ( 299, 0, 0, 5 ) setElementFrozen ( myPed, true )
  21. Such event does not exist, you must freeze the peds with: setElementFrozen
  22. He wants a command to set everyone's vehicle model to the one he choose. addCommandHandler ( "allvehicles", function ( thePlayer, _, model ) local model = tonumber ( model ) if ( model ) then for _, player in ipairs ( getElementsByType ( "player" ) ) do local vehicle = getPedOccupiedVehicle ( player ) if ( vehicle ) then setElementModel ( vehicle, model ) end end end end ) Should work.
×
×
  • Create New...