SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 06/07/2018, 03:45 PM   #1
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Posts: 1,445
Reputation: 444
Default Local Keys Plugin

Local Keys Plugin by NaS

Yet another Plugin for accessing all local keys that are pressed on the machine the server is running on (keyboard and mouse).

This does NOT work for any other player that is connected to the server. It is meant for debugging, MapEditors and test scripts.

This plugin adds a callback. You need to toggle the keys you want to check via ToggleKey() (this prevents callback spam on every key press and reduces the amount of keys that are listened for).

The keys are always detected, whether or not you are playing or even connected to the server.
Use IsSAMPFocused() if you want to check if the SAMP Client is currently focused.

Natives

IsLocalKeyPressed(key)
Checks if a key ID is currently pressed.

IsSAMPFocused()
Checks if the SAMP client is the foreground application (by window name).

GetVKName(key, const name[], maxlen = sizeof name)
Gets the complete name of a key.

ToggleKey(key, toggle = 1)
Toggles the given key for OnLocalKeyStateChange. IsLocalKeyPressed is not affected by this.
All keys are off by default!

IsKeyToggled(key)
Checks if a key is toggled.

Key Defnitions

All Windows Keys are defined inside the include.

Download

https://github.com/Naseband/SAMP-LocalPlugin

Installation

Drop LocalKeys.dll into your plugins directory and add LocalKeys.dll to your server.cfg (under plugins).
Copy LocalKeys.inc into your pawn/include/ directory and include it in your script.

Done!


This is a snippet of a server-/client plugin which I will release when ready (the main purpose being MapEditors etc).
NaS is offline   Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Map] A Local Town, For Local People VantagePoint Maps 12 21/07/2016 07:05 PM
MySQL Plugin r39-2 Error: Can't connect to local MySQL server through socket Emre__ Scripting Help 10 30/07/2014 08:26 AM
Local Messages (Using y_iterate and Incognito's Streamer Plugin) Maxips2 Scripting Help 2 29/03/2013 11:10 PM
Local Messages (Using y_iterate and Incognito's Streamer Plugin) Maxips2 Scripting Help 0 29/03/2013 12:18 PM
Plugin Keys Search? Fuck keys playerid. Manowar Scripting Help 16 21/10/2012 06:04 AM


All times are GMT. The time now is 12:26 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.