Jump to content

BenceDev

Members
  • Posts

    53
  • Joined

  • Last visited

Details

  • Location
    Hungary
  • Occupation
    I don't have occupation

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

BenceDev's Achievements

Snitch

Snitch (10/54)

2

Reputation

  1. I create a script for a ambulance is have side door, and i want open it. Client side: addCommandHandler ( "gvc", function ( ) local theVehicle = getPedOccupiedVehicle ( localPlayer ) if ( theVehicle ) then for k in pairs ( getVehicleComponents ( theVehicle ) ) do outputChatBox ( k ) end end end ) function sideDoorFunction(veh, ID) theVeh = getPedOccupiedVehicle(thePlayer) if(theVeh) then if (getPedOccupiedVehicleSeat(thePlayer) == 0) then veh = getPedOccupiedVehicle(thePlayer) if ID == 416 then for k in pairs (getVehicleComponents(theVeh)) do if k == "sd" then local slide1 = setTimer(function() local x, y, z = getVehicleComponentPosition(theVeh, k) setVehicleComponentPosition(theVeh, k, x+0.01, y, z) end, 2, 5) local slide2 = setTimer(function() local x, y, z = getVehicleComponentPosition(theVeh, k) setVehicleComponentPosition(theVeh, k, x, y-0.0212, z) end, 0.5, 70) end end end end end end addEvent("sideOpenDoorEvent", true) addEventHandler("sideOpenDoorEvent", getRootElement(), sideDoorFunction) function serverSide(veh, ID) veh = getPedOccupiedVehicle(localPlayer) ID = getElementModel(localPlayer) triggerServerEvent("sideOpenDoorEventServer", resourceRoot, veh, ID) end function sideCloseDoorFunction() local playerTheVehicle = getPedOccupiedVehicle(localPlayer) if (playerTheVehicle) then for k in pairs (getVehicleComponents(playerTheVehicle)) do if k == "sd" then local playerTheVehicle = getPedOccupiedVehicle(localPlayer) local slide2 = setTimer(function() local x, y, z = getVehicleComponentPosition(playerTheVehicle, k) setVehicleComponentPosition(playerTheVehicle, k, x, y+0.0212, z) end, 0.5, 70) local slide1 = setTimer(function() setTimer(function() local x, y, z = getVehicleComponentPosition(playerTheVehicle, k) setVehicleComponentPosition(playerTheVehicle, k, x-0.0010, y, z) end, 0.5, 53) end, 850, 1) end end end end addEvent("sideCloseDoorEvent", true) addEventHandler("sideCloseDoorEvent", getRootElement(), sideCloseDoorFunction) Server side function sideDoorOnServer(player, command, state) if(player) then if state == "open" then triggerClientEvent(root, "sideOpenDoorEvent", resourceRoot, veh, ID) elseif state == "close" then triggerClientEvent(root, "sideCloseDoorEvent", root, veh) end end end addEvent("sideOpenDoorEventServer", true) addEventHandler("sideOpenDoorEventServer", resourceRoot, sideDoorOnServer) addCommandHandler("sidedoor", sideDoorOnServer) :
  2. Hi, my playSound is played twice and repeatly, but i want to play once and i dont know why this happening. This is my client side script: local ten = "altitudes/10.wav" local twenty = "altitudes/20.wav" local thirty = "altitudes/30.wav" local fourty = "altitudes/40.wav" local fifty = "altitudes/50.wav" local onehund = "altitudes/100.wav" local twohund = "altitudes/200.wav" local threhund = "altitudes/300.wav" local fourhund = "altitudes/400.wav" local fivehund = "altitudes/500.wav" local onethounsand = "altitudes/1000.wav" local onethounsandandfiveh = "altitudes/1500.wav" local twothoundsandandfiveh = "altitudes/2500.wav" local targetAltitude = 10 function altitudeSound() local sound = playSound("altitudes/1000.mp3", false) local x, y, z = getElementPosition(getLocalPlayer()) local groundY = getGroundPosition(x, y, z) local altitude = z - groundY if (isSoundFinished == true) then outputChatBox('Song Finished', 255, 255, 0) end end addEventHandler("onClientRender", root, altitudeSound) Thanks for all help! and this is the original client side script: local ten = "altitudes/10.wav" local twenty = "altitudes/20.wav" local thirty = "altitudes/30.wav" local fourty = "altitudes/40.wav" local fifty = "altitudes/50.wav" local onehund = "altitudes/100.wav" local twohund = "altitudes/200.wav" local threhund = "altitudes/300.wav" local fourhund = "altitudes/400.wav" local fivehund = "altitudes/500.wav" local onethounsand = "altitudes/1000.wav" local onethounsandandfiveh = "altitudes/1500.wav" local twothoundsandandfiveh = "altitudes/2500.wav" local targetAltitude = 10 function altitudeSound() local sound = playSound("altitudes/1000.wav") local x, y, z = getElementPosition(getLocalPlayer()) local groundY = getGroundPosition(x, y, z) local altitude = y - groundY if altitude >= targetAltitude then playSound(sound) end end addEventHandler("onClientRender", root, altitudeSound)
  3. Thanks bro, i try it later! Have a great day! @Kidzonio
  4. Hi everyone! I make a script that know player altitude when the altitude is like example 1000 feet then play a sound for player. So i know how to play sound to player, but i cant know how to get airplane altitude. Thanks for the helps!
  5. Thank you for the reply. Your change is working good. Thanks for the help! @Shady1
  6. Hi everyone! I'm making a medic system that can revive another player. So i want to stop the player animation. I saw on wiki and forum the solution setPedAnimation(source) then i used it but the animation is not stopped and i got a error. Debugscript 3: WARNING: [Core]\cz_injury\revive.lua:57: Bad argument @ 'setPedAnimation' [Expected element at argument 1, got nil] This is my revive.lua (server sided): function reviveFunction() if (getElementData(testped, "playerDown") == true) then local thePlayerElem = getElementType(source) if(thePlayerElem == "player") then setPedAnimation(source, "bomber", "bom_plant_loop", -1, true, false, true, false, 150) setTimer(function() setPedAnimation(testped) setElementHealth(testped, 50) setPedAnimation(player) -- this is what stop the player animation end, 10000, 1) end end end addEvent("startRevive",true) addEventHandler("startRevive", getRootElement(), reviveFunction) Thanks for all reply!
  7. UPDATE: It works! @AaroN⍩ and @alex17" thanks for the help!
  8. this is not working debugscript says: warning: bad argument @ 'setElementModel' [Expected number at argument 2, got table]
  9. Hi everyone! I have a problem, so my problem is i want to get a number from table (example: i save player skin id to database when he register it [it works for me], and after he logged in set player skin to his saved id), but i dont know how to do it. This is from my server sided script when he log in: addEvent("loginRequest", true) function loginRequest(player, username, password) local check = exports.fs_sql:_QuerySingle("select * from users where username = ? ", username) if check then local checkPass = check.password if (checkPass == password) then logIn(player, getAccount(username), tostring(password)) triggerClientEvent(player, "showHide", getRootElement()) local skinID = exports.fs_sql:_QuerySingle("select * from users where pSkin = ?", SkinTable) local toNumberExsSkin = tonumber(skinID) setElementModel(source, skinID) outputChatBox ( "#34bf49Successful login!", source, 255, 255, 255, true ) fadeCamera(source, true) setCameraTarget(source,source) else outputChatBox ( "#ff4c4cWrong password!", source, 255, 255, 255, true ) end end end addEventHandler("loginRequest", getRootElement(), loginRequest) and this is my debugscript 3 says: WARNING: [Core]\fs_loginSystemGui\server.lua:39: Bad argument @ 'setElementModel' [Expected number at argument 2, got nil] and this is my database: and in red square i want this number for skin id Thanks for all help!
  10. Hi everyone, i create slippery road script like you drive on a ice or a snow and you slip and hard to stop. But i can't start. on wiki i see this function EngineSetSurfaceProperties and i dont know how to use this. Thanks for all help!
  11. UPDATE i Fixed it TXD is exsist, but if i hit marker the current txd is not unload and after unload load fenyjelzo_szabad.txd, no debugscript 3 error UPDATE EVERYTHING IS FIXED AND WORK FINE! STAFF CAN CLOSE THE TOPIC
×
×
  • Create New...