[Need Help] "IsControlPressed"

Hello, Guys!

Can anybody give me an advice how to use the “IsControlPressed” function? I want to start the engine via Numpad 0 but I don’t know how.

You don’t need to post the full solution but an example would be awesome.

Thanks in advance!

1 Like

@Trust37 http://www.dev-c.com/nativedb/func/info/f3a21bcd95725a4a

Take a look how this native works :slight_smile:

Untested Code but should describe how you have to use it

Citizen.CreateThread(function()
	while true do
                Citizen.Wait(0)
                if isControlPressed(0, 206) then --Btn "E" Pressed
                        --Do Something here :)
                end
        end
end)
1 Like

Thanks for your help. But I don’t get it. I’ve tried a lot of things. The code only in server.lua, in client.lua in both with vars without them… nothing works.

The biggest problem is what type of code goes into the client and what goes into the server. It’s not easy to understand. I guess I need to wait before anyone made it a bit clear.

@Trust37 said in [Need Help] "IsControlPressed":

Thanks for your help. But I don’t get it. I’ve tried a lot of things. The code only in server.lua, in client.lua in both with vars without them… nothing works.

The biggest problem is what type of code goes into the client and what goes into the server. It’s not easy to understand. I guess I need to wait before anyone made it a bit clear.

It’s only for the client, the server doesn’t have this.

Thank you!