Jump to content

Need help for keybinding


Senze

Recommended Posts

hey guys i've got a little problem so i hope you can help me =)

the problem: i've try to make en keybind manager for my resource to use commands like /su much easier for the players

but I wont use a keybind with the function. i wont to use the keybind for example so: press "m" and in the chatbox there will stand /su an the player have to finish the complet command (/su [player] [reason])

so but i dont now how to do that I realy Hope you can help me =)

and another question is about velocity so ive do this in my script:

local speedx, speedy, speedz = getElementVelocity(Element)
local speed = (speedx^2 + speedy^2 + speedz^2)^(0.5)*100

to get the speed from vehicle but i dont think there are only 106 kmh with nrg500 on full speed so how to fix this it is for Speed camera.

greeze SenZe

Link to comment

The getElementVelocity() does not return speed in kmph, but is shows the maximum speed of a vehicle in SA is 1.5. If we let 1 SA distance unit to be 1 meter (which I'm sure to myself it is), you should multiply your "speed" result at 183.33, this will give you kmph. It's '183' because if you use 50 ms timer to get the distance a vehicle traveled for 50 ms and then calculate the speed, you'll get 275. So 1.5 * 183.33 = 275.

About the first point, if I understood it well, you're trying to bind a key to a function that will open a chat for input and write in there a "/su" text, so the player won't need to write that by himself? If so, I'd like to know the answer as well, since there's no way to output a text into chatbox and keep it "non-sent", saving the input for user; outputChatBox/outputConsole doesn't work in a way we need. Can anybody answer is it possible or not to make a setKeyState() function? Might be very useful to simulate a key pressed (I'm not taking into account security problems it could bring up).

Edited by Guest
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...