-
Posts
1,089 -
Joined
-
Last visited
Everything posted by Xwad
-
i tryed that but its not working:/ I aléways fixed the debugscripts but not working:/ only for that spawn script. So i made this topic for the vehicle sound
-
One more question . I want to make that when the player die then the music stops so i added this to the script but its not working function stopSound() setSoundPaused(sound,false) end addEventHandler("onClientPlayerWasted", root, stopSound)
-
or is this good? function switchEngine ( playerSource ) local theVehicle = getPedOccupiedVehicle ( playerSource ) -- Check if the player is in any vehicle and if he is the driver if theVehicle and getVehicleController ( theVehicle ) == playerSource then local state = getVehicleEngineState ( theVehicle ) if setVehicleEngineState ( theVehicle, not state ) then triggerClientEvent ( playerSource, "stop_Sound" ) else cancelEvent () end end
-
there is just server side example:/ can you make a client sided example pls? whats the different? or should i make it with triggerclientevent?
-
shit i posted the wrong script sry client GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Window[1] = guiCreateWindow(177,177,296,234,"You are dead!",false) guiSetVisible ( GUIEditor_Window[1], false ) GUIEditor_Button[3] = guiCreateButton(10,75,290,230,"Return to hangar",false,GUIEditor_Window[1]) function openguidmshop () guiSetInputEnabled(true) guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) end addEventHandler( "onClientPlayerWasted", localPlayer, openguidmshop ) function destroyguidmshop () guiSetInputEnabled(false) guiSetVisible ( GUIEditor_Window[1], false ) showCursor ( false ) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[3], destroyguidmshop ) function shopa () triggerServerEvent ( "shopa", getLocalPlayer()) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[3], shopa ) server function shopa(totalAmmo, killer, killerWeapon, bodypart, stealth) fadeCamera(source, true, 5) setCameraMatrix(source, -1244.6711, -287.84088, 15.8733, -1345.63241, -477.8543588, 12.8733) triggerClientEvent(source, "showGUI", source) end addEvent("shopa",true) addEventHandler("shopa",root,shopa)
-
ok now its working thx but i have found another problem. When i stop pressing w and the vehicle is still mooving then the music stops.. How can i make that the sound will only stopps when the vehicle stops?
-
Hi i made a script that makes possible that when i press w then the audio will start and if i stop pressing w then the audio will stop. Its not working help client.lua local sound function startSound () sound = playSound("sounds/sound.mp3") setSoundVolume(sound, 1) end function stopSound() if isElement(sound) then stopSound(sound) end end function bindTheKeys () bindKey ( "w", "down", startSound ) bindKey ( "w", "up", stopSound ) end
-
I have a problem again I made a new gui for spawn and its not working correctly. When a player die then a gui will open and there the player must click on a gui button to get back to the hangar (setcameramatrix) . The problem is that if a player die then the gui will open for other players too:/ i tryed to make it with TriggerClientEvent but it didnt worked:( here is the edited part of the spawn script server.lua function shopa(totalAmmo, killer, killerWeapon, bodypart, stealth) fadeCamera(source, true, 5) setCameraMatrix(source, -1244.6711, -287.84088, 15.8733, -1345.63241, -477.8543588, 12.8733) triggerClientEvent(source, "showGUI", source) end addEvent("shopa",true) addEventHandler("shopa",root,shopa) client.lua GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Window[1] = guiCreateWindow(177,177,296,234,"You are dead!",false) guiSetVisible ( GUIEditor_Window[1], false ) GUIEditor_Button[3] = guiCreateButton(10,75,290,230,"Return to hangar",false,GUIEditor_Window[1]) function openguidmshop () guiSetInputEnabled(true) guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) end addEventHandler( "onClientPlayerWasted", localPlayer, openguidmshop ) function destroyguidmshop () guiSetInputEnabled(false) guiSetVisible ( GUIEditor_Window[1], false ) showCursor ( false ) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[3], destroyguidmshop ) function shopa () triggerServerEvent ( "shopa", getLocalPlayer()) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[3], shopa )
-
Working!! Thanks for help guys!!
-
One last question. I want to hide radar when the player die but its not working:/ function hideRadar () showPlayerHudComponent ( 'radar', false ); end addEventHandler("onPlayerWasted", getRootElement(), hideRadar) this a part of server.lua
-
Thanks for your help!!
-
ERROR loading script failed: Shop/server.lua:51:'end' expected (to close 'if' at line 31)near 'elseif'
-
Not working omg maybe i did something wrong?
-
sorry its not client its server side:D
-
i tryd both but dont want to sop my god
-
here ios the full client side script : function BuyWeaponOnServer(weapon_name) player_money = getPlayerMoney(source) player_account = getPlayerAccount(source) local price_plane = "5000" if(getAccountData(player_account, "GunLicense") == true) then if(weapon_name == "weapon_plane") then local USAteam = getTeamFromName("USA") if (USAteam) then if(player_money >= tonumber(price_plane)) then takePlayerMoney(source, tonumber(price_plane)) local x,y,z = getElementPosition(source) local vehicle = createVehicle(476,-2117.46, -2340.69, 100 + 3) warpPedIntoVehicle(source,vehicle) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("You have bought a plane.", source, 0, 255, 0) end else local Axisteam = getTeamFromName("Axis") if (Axisteam) then if(player_money >= tonumber(price_plane)) then takePlayerMoney(source, tonumber(price_plane)) local x,y,z = getElementPosition(source) local vehicle = createVehicle(446,-2117.46, -2340.69, 100 + 3) warpPedIntoVehicle(source,vehicle) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("You have bought a plane.", source, 0, 255, 0) end else outputChatBox("You do not have enough money to buy a plane.", source, 255, 0, 0) end end end else outputChatBox("You dont have a license to buy arms.", source, 255, 0, 0) end end addEvent("onClientBuyWeapon", true) addEventHandler("onClientBuyWeapon", getRootElement(), BuyWeaponOnServer) function BuyWeaponLicense() player_money = getPlayerMoney(source) player_account = getPlayerAccount(source) local license_price = "55000" if(getAccountData(player_account, "GunLicense") == false) then if(player_money >= tonumber(license_price)) then setAccountData(player_account, "GunLicense", true) takePlayerMoney(source, tonumber(license_price)) outputChatBox("Now you have a license for arms.", source, 0, 255, 0) else outputChatBox("You do not have enough money to buy a license for arms.", source, 255, 0, 0) end else outputChatBox("You already have a license for arms.", source, 255, 0, 0) end end addEvent("onClientBuyLicense", true) addEventHandler("onClientBuyLicense", getRootElement(), BuyWeaponLicense)
-
Hi i made a weapon shop for my server but isnt working.. Debugscript: ERROR loading script failed: Shop/server.lua:41:'end' expected (to close 'if' at line 15) near 'elseif' here is a part of the script server.lua if(weapon_name == "weapon_plane") then local USAteam = getTeamFromName("USA") if (USAteam) then if(player_money >= tonumber(price_plane)) then takePlayerMoney(source, tonumber(price_plane)) local x,y,z = getElementPosition(source) local vehicle = createVehicle(476,-2117.46, -2340.69, 100 + 3) warpPedIntoVehicle(source,vehicle) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("You have bought a plane.", source, 0, 255, 0) end else local Axisteam = getTeamFromName("Axis") if (Axisteam) then if(player_money >= tonumber(price_plane)) then takePlayerMoney(source, tonumber(price_plane)) local x,y,z = getElementPosition(source) local vehicle = createVehicle(446,-2117.46, -2340.69, 100 + 3) warpPedIntoVehicle(source,vehicle) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("You have bought a plane.", source, 0, 255, 0) end else outputChatBox("You do not have enough money to buy a plane.", source, 255, 0, 0) end
-
i dont know why its double:/
-
OMG!! You are right #RooTs! The problem was with the path lol. Tanks a lot! Anyway there is one more problem The music does not stop when i spawn:/ function stopSound() stopSound("sound") end addEventHandler("onClientPlayerSpawn", getLocalPlayer(), stopSound) --add the event handler
-
Thanks but i already made it