OnPlayerPart: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
(Created page with "This is called when a player disconnects from the server. == Syntax == <pre>function onPlayerPart( player, reason )</pre> == Arguments == * '''player''' - The pointer of t...") |
No edit summary |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 12: | Line 12: | ||
== Example == | == Example == | ||
In this example the server will send a message when a player leaves the server. | |||
<source lang="squirrel"> | <source lang="squirrel"> | ||
function onPlayerPart( player, reason ) | function onPlayerPart( player, reason ) | ||
{ | { | ||
Message( player.Name + " | switch (reason) | ||
{ | |||
case 1: | |||
{ | |||
Message("[#FF77AF][PART] [#ac8000] "+player.Name+" [#ffffff]quit."); | |||
EchoMessage( ICOL_GREEN + " [PART] "+player.Name+" Quito El Juego."); | |||
break; | |||
} | |||
case 1: | |||
{ | |||
Message("[#FF77AF][PART] [#ac8000] "+player.Name+" [#ffffff]Disconnected"); | |||
EchoMessage( ICOL_GREEN + "[PART] "+player.Name+" Desconecto El juego"); | |||
break; | |||
} | |||
case 0: | |||
{ | |||
Message("[#FF77AF][PART] [#ac8000] "+player.Name+ " [#ffffff]timeout."); | |||
EchoMessage( ICOL_GREEN + " [PART] "+player.Name+ " Internet Fuera."); | |||
break; | |||
} | |||
case 2: | |||
{ | |||
Message("[#FF77AF][PART] [#ac8000] "+player.Name+ " [#ffffff]Kicked for banned."); | |||
EchoMessage( ICOL_GREEN + " [PART] "+player.Name+ " Kickeado Por Prohibicion."); | |||
break; | |||
} | |||
case 2: | |||
{ | |||
Message("[#FF77AF][PART] [#ac8000] "+player.Name+" [#FFFFFF]Kicked."); | |||
EchoMessage( ICOL_GREEN + " [PART] "+player.Name+" Kickeado."); | |||
break; | |||
} | |||
case 2: | |||
{ | |||
Message("[#FF77AF][PART] [#ac8000] "+player.Name+" [#FFFFFF]banned."); | |||
EchoMessage( ICOL_GREEN + " [PART] "+player.Name+" Prohibido."); | |||
break; | |||
} | |||
case 3: | |||
{ | |||
Message("[#FF77AF][PART] [#ac8000] "+player.Name+" [#FFFFFF]Error Crash."); | |||
EchoMessage( ICOL_GREEN + " [PART] "+player.Name+" Error del VC."); | |||
break; | |||
} | |||
} | |||
} | } | ||
</source> | </source> | ||
Line 21: | Line 66: | ||
=== Notes === | === Notes === | ||
The functions [[Scripting/Squirrel/Functions/Message|Message]] and [[Scripting/Squirrel/Functions/ | The functions [[Scripting/Squirrel/Functions/Message|Message]] and [[Scripting/Squirrel/Functions/Player.Name|Player.Name]] were used in this example. More info about them in corresponding pages. | ||
== Related Functions == | == Related Functions == | ||
{{Scripting/Squirrel/Events/Player_Events}} | {{Scripting/Squirrel/Events/Player_Events}} | ||
[[Category:Scripting/Squirrel/Events/Player_Events]] |
Latest revision as of 22:14, 30 January 2017
This is called when a player disconnects from the server.
Syntax
function onPlayerPart( player, reason )
Arguments
- player - The pointer of the player
- reason - Reason ID for the part.
Example
In this example the server will send a message when a player leaves the server.
function onPlayerPart( player, reason )
{
switch (reason)
{
case 1:
{
Message("[#FF77AF][PART] [#ac8000] "+player.Name+" [#ffffff]quit.");
EchoMessage( ICOL_GREEN + " [PART] "+player.Name+" Quito El Juego.");
break;
}
case 1:
{
Message("[#FF77AF][PART] [#ac8000] "+player.Name+" [#ffffff]Disconnected");
EchoMessage( ICOL_GREEN + "[PART] "+player.Name+" Desconecto El juego");
break;
}
case 0:
{
Message("[#FF77AF][PART] [#ac8000] "+player.Name+ " [#ffffff]timeout.");
EchoMessage( ICOL_GREEN + " [PART] "+player.Name+ " Internet Fuera.");
break;
}
case 2:
{
Message("[#FF77AF][PART] [#ac8000] "+player.Name+ " [#ffffff]Kicked for banned.");
EchoMessage( ICOL_GREEN + " [PART] "+player.Name+ " Kickeado Por Prohibicion.");
break;
}
case 2:
{
Message("[#FF77AF][PART] [#ac8000] "+player.Name+" [#FFFFFF]Kicked.");
EchoMessage( ICOL_GREEN + " [PART] "+player.Name+" Kickeado.");
break;
}
case 2:
{
Message("[#FF77AF][PART] [#ac8000] "+player.Name+" [#FFFFFF]banned.");
EchoMessage( ICOL_GREEN + " [PART] "+player.Name+" Prohibido.");
break;
}
case 3:
{
Message("[#FF77AF][PART] [#ac8000] "+player.Name+" [#FFFFFF]Error Crash.");
EchoMessage( ICOL_GREEN + " [PART] "+player.Name+" Error del VC.");
break;
}
}
}
Notes
The functions Message and Player.Name were used in this example. More info about them in corresponding pages.
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 )