Save something in data folder when a key is pressed.

So I want to save keypress of a particular key because I’m suspecting users to have a cheat on my server ( Citizen ), btw they are skiddies, they dont even know how to change the keybind of their cheat . I simply want to save every keypress made on Insert with their steamid, ip, and date in a folder. So for example: when Jack press on Insert I want the log to be like that: DATE - IP. With the log file in a folder named: /savedshit for example. ( data/savedshit/STEAMID ) . I want it to stack over the time, like one .txt file for one user. So at the moment I only have this…

^^ Nothing is ran when I press F7 :disappoint:

It’s a mix with & a code blue tutorial ( Can anyone help me achieve or help me ? It would be very appreciated.

If you read the wiki page, it says that

GM:KeyPress uses the IN ENUMS, not the KEY ENUMS. Use

GM:PlayerButtonDown. Note that it uses the BUTTON CODE ENUM and that the KEY ENUMS along with the MOUSE and JOYSTICK ENUMS make up the BUTTON CODE ENUMS.

Side note: I’m not sure if it’s like keypress where it’s called a billion times when pressed, but if it does happen, simply create a variable that is set to false in the PlayerButtonDown hook and set it to true in the PlayerButtonUp hook if it’s the same player and the button is the button that was pushed down.


GM:PlayerButtonDown Like MelonShooter mentioned above, one of the many reasons this isn’t working is due to you’re trying to get the steamid of a invalid player, V is nil, use ply.

There is no need to tostring steamid it as it’s already a string.

Just get an anticheat.

Remember that you have to network the keypress to the server and do the file stuff there, otherwise you’re going to save the log on the cheaters computer which doesn’t make much sense.

Or, you can skip the networking and just have everything serversided.

not even cac detects citizen

Wow, I always thought only IN_ keys were available serverside. Didn’t know about PlayerButtonDown. My bad.