Military Guy Posted February 5 Share Posted February 5 Instead of entering a command, I will assign a key I added bindKey but it not working help me please function bomb ( player ) local car = getPedOccupiedVehicle ( player ) local x, y, z = getElementPosition(player) if (getElementModel(car) == 520) then bindKey("3", "down", bomb) outputChatBox ( "Сброс бомб", player ) setTimer ( AirstrikeThrow, 51, 1, player ) end end addCommandHandler ( "jetbomb", bomb ) function AirstrikeThrow ( player, x, y, z ) triggerClientEvent ( getRootElement(), "AirstrikeThrowDo", getRootElement(), airStrikeTrash, player ) end Link to comment
xMKHx Posted Thursday at 17:15 Share Posted Thursday at 17:15 (edited) I've used DeepSeek to fix your code, there is this result: -- Define the bomb function function bomb(player) local car = getPedOccupiedVehicle(player) if getElementModel(car) == 520 then outputChatBox("Сброс бомб", player) local x, y, z = getElementPosition(player) setTimer(AirstrikeThrow, 51, 1, player, x, y, z) end end -- Bind the "3" key to the bomb function for each player when they spawn or enter the vehicle function bindBombKey(player) bindKey(player, "3", "down", bomb) end -- Add event handlers to bind the key when the player spawns or enters a vehicle addEventHandler("onPlayerJoin", root, bindBombKey) addEventHandler("onVehicleEnter", root, function(player) bindBombKey(player) end) -- Define the AirstrikeThrow function function AirstrikeThrow(player, x, y, z) triggerClientEvent(getRootElement(), "AirstrikeThrowDo", getRootElement(), player) end Edited Thursday at 17:56 by xMKHx Wrong Code 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