OnKeyDown: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
Decent 946 (talk | contribs) (Created page with "__NOTOC__ This function allows the server to inform the player, that he pressed the key and and the key works like a command. == Syntax == <pre>function onKeyDown( player, k...") |
No edit summary |
||
Line 37: | Line 37: | ||
you can Find the key codes [[https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx|''here'']] | you can Find the key codes [[https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx|''here'']] | ||
== Related | == Related Functions == | ||
{{Scripting/Squirrel/Events/Player_Events}} | {{Scripting/Squirrel/Events/Player_Events}} | ||
[[Category:Scripting/Squirrel/Events/Player_Events]] |
Revision as of 22:16, 30 January 2017
This function allows the server to inform the player, that he pressed the key and and the key works like a command.
Syntax
function onKeyDown( player, key )
Parameters
- Player player - The player who presses the key.
- key - The key player presses.
Example
In this function i have chosen key "ENTER". When a player will press the key/button 'enter' it will inform the server that the player pressed the key. And the server will perform the work like a Command.
function onScriptLoad()
{
enter <- BindKey( true, 0x0D, 0, 0 ); // The Key Code of enter is 0x0D . we will use bindkey function to set the key. And it is required.
}
function onKeyDown( player, key )
{
if ( key == enter )
{
PrivMessage( player, "you Successfully pressed the Key Enter." );
}
}
Notes
Function PrivMessage and function BindKey were used in this example.
you can Find the key codes [here]
Related Functions
- onPlayerJoin( player )
- onPlayerPart( player, reason )
- onPlayerRequestClass( player, classID )
- onPlayerRequestSpawn( player )
- onPlayerSpawn( player )
- onPlayerDeath( player, reason )
- onPlayerKill( killer, player, reason, bodypart )
- onPlayerTeamKill( killer, player, reason, bodypart )
- onPlayerChat( player, message )
- onPlayerCommand( player, command, arguments )
- onPlayerPM( player, playerTo, message )
- onPlayerBeginTyping( player )
- onPlayerEndTyping( player )
- onLoginAttempt( playerName, password, ipAddress )
- onNameChangeable( player ) // Currently can't work.
- onPlayerMove( player, lastX, lastY, lastZ, newX, newY, newZ )
- onPlayerHealthChange( player, lastHP, newHP )
- onPlayerArmourChange( player, lastArmour, newArmour )
- onPlayerWeaponChange( player, oldWep, newWep )
- onKeyDown( player, bindID )
- onKeyUp( player, bindID )
- onPlayerAwayChange( player, newStatus )
- onPlayerSpectate( player, target )
- onPlayerCrashDump( player, crashReport )
- onPlayerNameChange( player, oldName, newName )
- onPlayerActionChange( player, oldAction, newAction )
- onPlayerStateChange( player, oldState, newState )
- onPlayerOnFireChange( player, isOnFireNow )
- onPlayerCrouchChange( player, isCrouchingNow )
- onPlayerGameKeysChange( player, oldKeys, newKeys )