OnPlayerActionChange: 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) No edit summary |
No edit summary |
||
Line 42: | Line 42: | ||
Function [[Scripting/Squirrel/Functions/PrivMessage|''PrivMessage'']] and function [[Scripting/Squirrel/Functions/Player.SetWeapon|''SetWeapon'']] were used in this example. | Function [[Scripting/Squirrel/Functions/PrivMessage|''PrivMessage'']] and function [[Scripting/Squirrel/Functions/Player.SetWeapon|''SetWeapon'']] were used in this example. | ||
== Related | == Related Functions == | ||
{{Scripting/Squirrel/Events/Player_Events}} | {{Scripting/Squirrel/Events/Player_Events}} | ||
[[Category:Scripting/Squirrel/Events/Player_Events]] |
Latest revision as of 22:17, 30 January 2017
This function is triggered when a player changes his action or we can say move!. ( not animation ).
Syntax
function onPlayerActionChange( player, oldAction, newAction )
Parameters
- Player player - The player who changes the action.
- oldAction - Players old Action.
- newAction - Players new Action.
Example
In this example i have chosen action "Fire/Shoot", when a player will Fire/shoot, his weapon will be automatically removed for temporary reason. ( the player won't be disarmed ), until he is firing/shooting, he won't be able to use weapons. unless he changes his action. the player will also receive a message "you can't shoot in a RPG server.".
function onPlayerActionChange( player, oldAction, newAction )
{
if ( newAction == 16 ) // 16 is the id of firing/shooting action.
{
player.SetWeapon( 0, 0 ); //sets weapon to 0. which is nothing.
PrivMessage( player, "you can't shoot in a RPG server. );
}
}
you must be wondering how to get actions id?. use this to get ids :)
function onPlayerActionChange( player, oldAction, newAction )
{
if ( newAction ) // it will check if the player goes in new action.
{
PrivMessage( player, "your Current Actions ID: "+newAction ); // it will print the id of the action player is in.
}
}
Notes
Function PrivMessage and function SetWeapon were used in this example.
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 )