Annas Posted May 16, 2015 Share Posted May 16, 2015 can any one help me pls ? i need when i fire with HYDRA it Take Player Money "5000" i try to make this but not work .. function takeHydra( thePlayer, seat ) if thePlayer == localPlayer then toggleControl ( "vehicle_fire", true ) toggleControl ( "vehicle_secondary_fire", true ) local model = getElementModel ( source ) if model == 520 then takePlayerMoney(thePlayer, 5000) end end end end addEventHandler("onClientVehicleEnter", getRootElement(), takeHydra) Link to comment
AMARANT Posted May 16, 2015 Share Posted May 16, 2015 Because client version of takePlayerMoney doesn't need thePlayer argument. And moreover, this function must not be used client-side. Never. Do it only server-side. Link to comment
Annas Posted May 17, 2015 Author Share Posted May 17, 2015 Because client version of takePlayerMoney doesn't need thePlayer argument. And moreover, this function must not be used client-side. Never. Do it only server-side. and the code ? , is it correct ?? Link to comment
Enargy, Posted May 17, 2015 Share Posted May 17, 2015 Because client version of takePlayerMoney doesn't need thePlayer argument. And moreover, this function must not be used client-side. Never. Do it only server-side. and the code ? , is it correct ?? it's wrong, try this: function takeMoney(car) if ( getVehicleModel(car) == 520 ) then takePlayerMoney( source, 5000 ); end end addEventHandler("onPlayerVehicleEnter", getRootElement(), takeMoney) Link to comment
Annas Posted May 17, 2015 Author Share Posted May 17, 2015 it's wrong, try this: function takeMoney(car) if ( getVehicleModel(car) == 520 ) then takePlayerMoney( source, 5000 ); end end addEventHandler("onPlayerVehicleEnter", getRootElement(), takeMoney) no no you dont understand ,, not when i enter a vehicle it take the money .. i need it when i FIRE with hydra missle it take the money .. HELP Link to comment
xXMADEXx Posted May 17, 2015 Share Posted May 17, 2015 it's wrong, try this: function takeMoney(car) if ( getVehicleModel(car) == 520 ) then takePlayerMoney( source, 5000 ); end end addEventHandler("onPlayerVehicleEnter", getRootElement(), takeMoney) no no you dont understand ,, not when i enter a vehicle it take the money .. i need it when i FIRE with hydra missle it take the money .. HELP Use this function/event: https://wiki.multitheftauto.com/wiki/On ... WeaponFire Link to comment
Enargy, Posted May 17, 2015 Share Posted May 17, 2015 it's wrong, try this: function takeMoney(car) if ( getVehicleModel(car) == 520 ) then takePlayerMoney( source, 5000 ); end end addEventHandler("onPlayerVehicleEnter", getRootElement(), takeMoney) no no you dont understand ,, not when i enter a vehicle it take the money .. i need it when i FIRE with hydra missle it take the money .. HELP Use this function/event: https://wiki.multitheftauto.com/wiki/On ... WeaponFire You could try this function vehicleWeaponFire(thePresser, key, keyState, _) local vehModel = getElementModel(getPedOccupiedVehicle(thePresser)) if (vehModel == 520) then takePlayerMoney( thePresser, 5000 ) --triggerEvent("onVehicleWeaponFire", thePresser, vehicleFireType, vehModel) end end function bindOnJoin() bindKey(source, "vehicle_fire", "down", vehicleWeaponFire, "primary") bindKey(source, "vehicle_secondary_fire", "down", vehicleWeaponFire, "secondary") end addEventHandler("onPlayerJoin", root, bindOnJoin) function bindOnStart() for index, thePlayer in pairs(getElementsByType("player")) do bindKey(thePlayer, "vehicle_fire", "down", vehicleWeaponFire, "primary") bindKey(thePlayer, "vehicle_secondary_fire", "down", vehicleWeaponFire, "secondary") end end addEventHandler("onResourceStart", getResourceRootElement(), bindOnStart) 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