Haze Posted October 21, 2011 Share Posted October 21, 2011 Hi Everyone How Are You Im back Agine with New Question or New Script and i Hope that u Help me i Really Trust You this script make Hydra go faster i made it with my Frined the problem that this script is not working can u Help us Guys and thank u function sonicboom () speedx, speedy, speedz = getElementVelocity ( getPlayerFromName ( "someguy" ) ) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = actualspeed * 180 outputChatBox ( "Someguy's current velocity: " .. mps .. " metres per second." ) if kmh = < 130 then playSound("boom.mp3") setVehicleHandling(520, "maxVelocity", 200) end end bindKey ( "lshift", "down", sonicboom ) Link to comment
Castillo Posted October 21, 2011 Share Posted October 21, 2011 function sonicboom () speedx, speedy, speedz = getElementVelocity ( getPlayerFromName ( "someguy" ) ) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = actualspeed * 180 outputChatBox ( "Someguy's current velocity: " .. mps .. " metres per second." ) if kmh >= 130 then playSound("boom.mp3") setVehicleHandling(520, "maxVelocity", 200) end end bindKey ( "lshift", "down", sonicboom ) P.S: When you use outputChatBox in client side, none else but the client will see it. Link to comment
Haze Posted October 21, 2011 Author Share Posted October 21, 2011 Its not working dude Link to comment
RottenFlesh Posted October 21, 2011 Share Posted October 21, 2011 function sonicboom () speedx, speedy, speedz = getElementVelocity ( getPlayerFromName ( "someguy" ) ) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = actualspeed * 180 outputChatBox ( "Someguy's current velocity: " .. kmh .. " metres per second." ) if kmh >= 130 then playSound("boom.mp3") setVehicleHandling(520, "maxVelocity", 200) end end bindKey ( "lshift", "down", sonicboom ) try this Link to comment
Castillo Posted October 21, 2011 Share Posted October 21, 2011 setVehicleHandling requires a vehicle element, not a vehicle model if I'm right. function sonicboom () speedx, speedy, speedz = getElementVelocity ( getPlayerFromName ( "someguy" ) ) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = actualspeed * 180 outputChatBox ( "Someguy's current velocity: " .. mps .. " metres per second." ) if kmh >= 130 then playSound("boom.mp3") setVehicleHandling(getPedOccupiedVehicle(getPlayerFromName ( "someguy" )), "maxVelocity", 200) end end bindKey ( "lshift", "down", sonicboom ) Link to comment
Haze Posted October 21, 2011 Author Share Posted October 21, 2011 No m8 its not working i dont know what is the problem plz Help me Link to comment
Castillo Posted October 21, 2011 Share Posted October 21, 2011 Could you give more information about WHAT is not working? you just say "Its not working I dont know what is the problem plz Help me" and nothing else, does it output errors in the debugscript (/debugscript 3)? Link to comment
Haze Posted October 21, 2011 Author Share Posted October 21, 2011 WARNING: sb\sonicboom.lua:11: Bad argument @ 'bindKey' i got this from the debugscript 3 plz Help guys and Thank u Link to comment
Castillo Posted October 21, 2011 Share Posted October 21, 2011 This script is client side, right? Link to comment
Haze Posted October 21, 2011 Author Share Posted October 21, 2011 i put it Server i think it should be Clinet no ?? Link to comment
Castillo Posted October 21, 2011 Share Posted October 21, 2011 playSound is only client side.. and bindKey doesn't work that way in server side. Link to comment
Haze Posted October 21, 2011 Author Share Posted October 21, 2011 i tryd to make it Clinet side but also its not working Link to comment
Haze Posted October 21, 2011 Author Share Posted October 21, 2011 ok dude i made it Clinet Side can u Help me in the code Castilo Link to comment
Castillo Posted October 21, 2011 Share Posted October 21, 2011 Do you know how this script works? it's suposed to get the velocity & so on from a player called "Someguy", do you want that? Link to comment
Haze Posted October 21, 2011 Author Share Posted October 21, 2011 I know i calld my self Someguy but i cant see the Hydra fly faster or the SoundPlay Link to comment
Castillo Posted October 21, 2011 Share Posted October 21, 2011 -- client side: addEvent("playSonicSound",true) addEventHandler("playSonicSound",root, function () if isElement(sound) then destroyElement(sound) end sound = playSound("boom.mp3") end) -- server side: addEventHandler("onResourceStart",resourceRoot, function () for index, player in pairs(getElementsByType("player")) do bindKey ( player, "lshift", "down", sonicboom ) end end) addEventHandler("onPlayerJoin",root, function () bindKey ( source, "lshift", "down", sonicboom ) end) function sonicboom (player) if not isPedInVehicle(player) then return end speedx, speedy, speedz = getElementVelocity ( getPedOccupiedVehicle(player) ) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = actualspeed * 180 outputChatBox ( getPlayerName(player) .." current velocity: " .. kmh .. " metres per second." ) if kmh >= 130 then triggerClientEvent(player,"playSonicSound",player) setVehicleHandling(getPedOccupiedVehicle(player), "maxVelocity", 200) end end Link to comment
Haze Posted October 21, 2011 Author Share Posted October 21, 2011 I CAN here the sound but i cant see that the Hydra go Faster Link to comment
Castillo Posted October 21, 2011 Share Posted October 21, 2011 Well, the script himself works, but I have no idea how handling stuff works. Maybe you should use velocity instead of handling. -- client side: addEvent("playSonicSound",true) addEventHandler("playSonicSound",root, function () if isElement(sound) then destroyElement(sound) end sound = playSound("boom.mp3") end) -- server side: addEventHandler("onResourceStart",resourceRoot, function () for index, player in pairs(getElementsByType("player")) do bindKey ( player, "lshift", "down", sonicboom ) end end) addEventHandler("onPlayerJoin",root, function () bindKey ( source, "lshift", "down", sonicboom ) end) function sonicboom (player) if not isPedInVehicle(player) then return end local speedx, speedy, speedz = getElementVelocity ( getPedOccupiedVehicle(player) ) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kmh = actualspeed * 180 outputChatBox ( getPlayerName(player) .." current velocity: " .. kmh .. " metres per second." ) if kmh >= 130 then triggerClientEvent(player,"playSonicSound",player) setElementVelocity ( getPedOccupiedVehicle(player), speedx*1.05, speedy*1.05, speedz*1.05) end end Link to comment
Haze Posted October 21, 2011 Author Share Posted October 21, 2011 Its not working m8 any Way Thanks for Help Castilo hope someone come and Solve it Link to comment
Deltanic Posted October 21, 2011 Share Posted October 21, 2011 Funny to see how it takes almost 20 replys to know setVehicleHandling does NOT support boats, planes and helicopters yet. You can change the values, and some like suspension and steering lock will work, but planes, boats and helicopters have also special handling which are not able to get changed yet. To make a hydra faster, use setElementSpeed in onClientPreRender, or wait till MTA 1.2 where there might be suport for special handling. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now