Jump to content

BenceDev

Members
  • Posts

    53
  • Joined

  • Last visited

Everything posted by BenceDev

  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
  12. meta.xml <meta> <script src="client.lua" type="client" /> <script src="server.lua" type="server" /> <file src="fenyjelzo.col" /> <file src="fenyjelzo.txd" /> <file src="fenyjelzo.dff" /> <script src="system/client.lua" type="client" /> <script src="system/server.lua" type="server" /> <file src="system/states/fenyjelzo_szabad.txd" /> </meta>
  13. okay, i check it the fenyjelzo_szabad.txd is doesn't exist. How do i load it?
  14. Hi guys! I work on my server railway signal system, but if i go in test marker (for test the txd is change) it doesnt change. Debugscript says: WARNING: ls_feny_bal\system\client.lua:9: Error loading TXD @ 'engineLoadTXD' [states/fenyjelzo_szabad.txd] WARNING: ls_feny_bal\system\client.lua:10: Bad argument @'engineImportTXD' [Expected txd at argument 1, got boolean] Client Side: local modellname = ""; local modellID = 2880; local markerTest = createMarker(1782.267578125, -1956.04296875, 12.5, "cylinder", 1.3, 255, 125, 150) function proceedSignalOnMarkerHit(hitElement) txd_floors = engineLoadTXD ( modellname.."states/fenyjelzo_szabad.txd" ) engineImportTXD ( txd_floors, modellID ) end addEventHandler("onClientMarkerHit", getRootElement(), proceedSignalOnMarkerHit)
  15. Hi i want to shoot weapon in the vehicle, but if i bind it i got mouse1 Debugscript 3 says: WARNING: fs_raindSit\client.lua:17: Bad argument @ 'setWeaponState' [Expected weapon at argument 1, got string 'mouse1] WARNING: fs_raindSit\client.lua:23: Bad argument @ 'setWeaponState' [Expected weapon at argument 1, got string 'mouse1] Client Side: function createMinigunWeapon(myRaindanc) -- Create the weapon 1 meter above the player local pX, pY, pZ = getElementPosition(myRaindanc) local weapon = createWeapon("minigun", pX, pY, pZ) -- Give it some ammo and fire it setWeaponClipAmmo(weapon, 99999) setWeaponState(weapon, "ready") setWeaponProperty(weapon, "fire_rotation", 0, -30, 0) attachElements(weapon, myRaindanc, 0.9, 0.34, 0.2, 0, 30, 0 ) end addEvent("createMinigun", true) addEventHandler("createMinigun", resourceRoot, createMinigunWeapon) function onPilotFireOn(weapon) setWeaponState(weapon, "firing") end bindKey("mouse1", "down", onPilotFireOn) function onPilotFireOff(weapon) setWeaponState(weapon, "ready") end bindKey("mouse1", "up", onPilotFireOff)
  16. Hi i have a problem with my script. So i write the script "nice" but i dont get it clientevent is why didnt work for me. And i want to create weapon and attach to the server side created vehicle(raindance) Error: ERROR: Server triggered clientside event createMinigun, but event is not added clientside Server Side: function createMinigunWeapon() triggerClientEvent("createMinigun", resourceRoot) end addEventHandler("onResourceStart", resourceRoot, createMinigunWeapon) Client side: function createMinigunWeapon() -- Create the weapon 1 meter above the player local x, y, z = getElementPosition(localPlayer) local weapon = createWeapon("minigun", x, y, z + 1) -- Give it some ammo and fire it setWeaponClipAmmo(weapon, 99999) setWeaponState(weapon, "firing") setWeaponProperty(weapon, "fire_rotation", 0, 0, 0) end addEventHandler("createMinigun", localPlayer, createMinigunWeapon) addEvent("createMinigun", true)
  17. Hi, i wrote a script, then i want to start the script on resourceStart but my triggerClientEvent doesnt work. Why? Client Side: function createMinigunWeapon() -- Create the weapon 1 meter above the player local x, y, z = getElementPosition(localPlayer) local weapon = createWeapon("minigun", x, y, z + 1) -- Give it some ammo and fire it setWeaponClipAmmo(weapon, 99999) setWeaponState(weapon, "firing") setWeaponProperty(weapon, "fire_rotation", 0, 0, 0) end addEventHandler("createMinigun", localPlayer, createMinigunWeapon) addEvent("createMinigun", true) Server Side: function createMinigunWeapon() triggerClientEvent(localPlayer, "createMinigun") end addEventHandler("onResourceStart", getRootElement(), createMinigunWeapon) DebugScript Says: WARNING: fs_raindSit\server.lua:36: Bad argument @ 'triggerClientEvent' [Expected string at argument 1, got nil]
  18. Hi, i have a problem with rotate a gun in or out of vehicle debugscript says: WARNING: fs_vehicleGun\server.lua:17: Bad argument @ 'triggerClientEvent' [Expected string at argument 1, got nil] Server Side: --[[addEvent("onPlayerVehicleEnter", true) addEventHandler("onPlayerVehicleEnter", getRootElement(),]]-- function createArmedBobcat(source) local lx,ly,lz = getElementPosition(source) -- get the position of the player local lx = lx + 5 -- add 5 units to the x position veh = createVehicle( 422, lx, ly, lz) -- create a bobcat base = createObject( 2985, 2,2,2) -- create a minigun_base object setElementCollisionsEnabled ( base, false ) -- the minigun_base damages the car -- you could alternatively load an empty col file for the minigun object attachElements ( base, veh, x,y,z,rx,ry,rz) -- attach the base to the bobcat end addCommandHandler("bobcat", createArmedBobcat) function rotateGun() triggerClientEvent(source, "rotateGunHandler", source) end addCommandHandler("rotate", rotateGun) Client Side: function enterGun_Handler(localPlayer) end addEventHandler("onClientColShapeHit", root, enterGun_Handler) local x,y,z,rx,ry,rz= 0,-1.5,-0.1,0,0,-90 function rotateIt(cmd, addZ) if(addZ) then rz=rz+addZ setElementAttachedOffsets (base,x,y,z,rx,ry,rz) --update offsets end end addEvent("rotateGunHandler", true) addEventHandler("rotateGunHandler", root, rotateIt)
  19. Hi, i have a problem, i want to delete player vehicle with command but the player is not sitting in the vehicle. i got it for player is sitting in and he can destroy only he('s) vehicle. My code: function commitSuicide(player) -- Öngyilkosság element data törléshez if(player) then local isInVehC = isPedInVehicle(player) -- ellenőrizze le hogy benne van-e a járműben a játékos local vehicle = getPedOccupiedVehicle(player) local stringValue = tostring(jobVehicleSpawn) if(isInVehC == true) then -- ha benne van if(vehicle == getElementData(player, "jobVehicle")) then -- elementData lekérése destroyElement(vehicle) -- járművet töröljük setElementData(player, "jobVehicle", false) -- element data-t újra íruk így üres érték lesz az element data-ban outputChatBox("Benne van", player) end elseif(string.find(stringValue, "userdata: ", 1)) then string.gsub(stringValue, "userdata: ", "") setElementData(player, "jobVehicle", false) outputChatBox("Table :"..stringValue.." jármű", player) destroyElement(stringValue) end end end addCommandHandler("kill", commitSuicide)
×
×
  • Create New...