Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. That's the same script as his, you're trying to increase your post count I guess.
  2. function getNearestMarkerToPosition(x, y) local minDistance=100000 for index, marker in ipairs(getElementsByType("marker")) do local mx, my = getElementPosition(marker) local distance = getDistanceBetweenPoints2D(x, y, mx, my) if (distance) then minDistance=distance return marker end end end No lo probe.
  3. team1 = createTeam("Team 1", 255, 0, 0) setTeamFriendlyFire(team1, false)
  4. addEventHandler("onPlayerJoin",root, function () bindKey(source,"z","down",fix) end) addEventHandler("onResourceStart",resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do bindKey(player,"z","down",fix) end end) function fix (playerSource) local theVehicle = getPedOccupiedVehicle (playerSource) if (theVehicle and getVehicleController ( theVehicle ) == playerSource) then fixVehicle (theVehicle) local rx, ry, rz = getVehicleRotation ( theVehicle ) if ( rx > 110 ) and ( rx < 250 ) then local x, y, z = getElementPosition ( theVehicle ) setVehicleRotation ( theVehicle, rx + 180, ry, rz ) setElementPosition ( theVehicle, x, y, z + 2 ) end end end addCommandHandler ("fix", fix)
  5. function zalogujGracza(nazwa, haslo) local query = dbQuery( funbox_db, "SELECT * FROM gracze WHERE nazwa=?", tostring(nazwa) ) local result, numrows, errmsg = dbPoll ( query, -1 ) if (numrows > 0) then outputChatBox(tostring(result[1].haslo)) end end
  6. function zalogujGracza(nazwa,haslo) local dane=dbPoll(dbQuery( funbox_db, "SELECT haslo FROM gracze WHERE nazwa='"..nazwa.."'" ), -1) outputChatBox(tostring(dane[1].serial)) end addEvent("zalogujGracza",true) addEventHandler("zalogujGracza",root,zalogujGracza)
  7. addCommandHandler("replace", function () setTimer(function () engineImportTXD(engineLoadTXD("skin.txd", ID), ID) engineReplaceModel(engineLoadDFF("skin.dff", 0), ID) end, 1000, 1) end) addCommandHandler("restore", function () engineRestoreModel(ID) end)
  8. Wrong Xeno, when you're replacing something else than a vehicle the ID in engineLoadDFF must be 0. function onResourceStart() setTimer(function () engineImportTXD(engineLoadTXD("veg.txd", 22), 22) engineReplaceModel(engineLoadDFF("veg.dff", 0), 22) end, 1000, 1) end addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)
  9. addEventHandler("onPlayerJoin",root, function () bindKey(source,"z","down",fix) end) addEventHandler("onResourceStart",resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do bindKey(player,"z","down",fix) end end) function fix (playerSource) local theVehicle = getPedOccupiedVehicle (playerSource) if (theVehicle and getVehicleController ( theVehicle ) == playerSource) then fixVehicle (theVehicle) end end addCommandHandler ("fix" , fix)
  10. Did you replace the DFF (the model) too? because I think you didn't.
  11. Vehicle mod: https://community.multitheftauto.com/index.php?p= ... ls&id=3391
  12. andrex, el fuego no esta sincronizado.
  13. function onEnter(thePlayer) -- Cuando entra a un vehiculo. if (getElementModel(source) == 407) then -- Si el modelo del vehiculo es del camion de Bomberos.. outputChatBox("Hola ".. getPlayerName(thePlayer) .."!",thePlayer,0,255,0) -- Le enviamos un mensaje al jugador. end end addEventHandler("onVehicleEnter",root,onEnter) -- Agregamos el evento para cuando un jugador entra a un vehiculo.
  14. function onEnter(thePlayer) -- Cuando entra a un vehiculo. outputChatBox("Hola ".. getPlayerName(thePlayer) .."!",thePlayer,0,255,0) -- Le enviamos un mensaje al jugador. end addEventHandler("onVehicleEnter",root,onEnter) -- Agregamos el evento para cuando un jugador entra a un vehiculo.
  15. Try this: local skip = {} function detachVehicle(thePlayer) if isPedInVehicle(thePlayer) and getPedOccupiedVehicleSeat(thePlayer) == 0 then local veh = getPedOccupiedVehicle(thePlayer) if getVehicleTowedByVehicle(veh) then detachTrailerFromVehicle(veh) outputChatBox("The trailer was detached.", thePlayer, 0, 255, 0) skip[veh] = true setTimer(function (veh) skip[veh] = nil end, 3000, 1, veh) else outputChatBox("There is no trailer...", thePlayer, 255, 0, 0) end end end addCommandHandler("detach", detachVehicle, false, false) addEventHandler("onTrailerAttach", root, function (theTruck) if skip[theTruck] then cancelEvent() end end)
  16. Castillo

    Why don't work?

    No, because the result of math.random is already a number, not a table.
  17. Castillo

    Why don't work?

    Your line: 14: setElementData ( source, 'Money', money+#grana ) My line 14: setElementData ( source, 'Money', money+grana )
  18. Castillo

    Why don't work?

    function getAliveCount () local aliveAmount = 0 for i,v in ipairs (getAlivePlayers()) do aliveAmount = aliveAmount +1 end return aliveAmount end function rewardIfWin(source) local alive = getAliveCount() local money = getElementData ( source, 'Money' ) if ( isPedDead(source) ~= false ) and ( alive == 1 ) then local grana = math.random ( 100, 2000 ) setElementData ( source, 'Money', money+grana ) outputChatBox ( "#ABCDEF* #ffffffYou gain #00ff00" .. tostring(grana) .. "$ for winning the deathmatch !", source, 255, 255, 255, true ) end end function ifPlayerQuitSaveTheMoney(source) saveTheMoney = executeSQLInsert ( 'Money', getElementData ( source, 'Money' ) ) if ( type (saveTheMoney) == 'table' and #saveTheMoney == 1 ) then outputDebugString (getPlayerName(source) .. " money saved in SQL database.") end end addEventHandler ( "onPlayerQuit", getRootElement(), ifPlayerQuitSaveTheMoney )
  19. Also check if the script has errors, if so, the compiler won't compile it (at least not the one I'm using).
  20. Castillo

    txd

    https://community.multitheftauto.com/index.php?p= ... ls&id=2730
×
×
  • Create New...