OnPlayerSpawn: Difference between revisions
Jump to navigation
Jump to search
(Changed the example cuz it would give a loop) |
No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 8: | Line 8: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
*'''posX''': | *'''posX''': the X position the [[player]] spawned at. | ||
*'''posY''': | *'''posY''': the Y position the [[player]] spawned at. | ||
*'''posZ''': | *'''posZ''': the Z position the [[player]] spawned at. | ||
*'''spawnRotation''': | *'''spawnRotation''': the rotation the [[player]] spawned with. | ||
*'''theTeam''': | *'''theTeam''': the [[team]] the [[player]] spawned with. | ||
*'''theSkin''': | *'''theSkin''': the [[Character_Skins|skin/model]] the [[player]] spawned with. | ||
*'''theInterior''': | *'''theInterior''': the [[interior]] the [[player]] spawned in. | ||
*'''theDimension''': | *'''theDimension''': the [[dimension]] the [[player]] spawned in. | ||
==Source== | ==Source== | ||
The [[event system#Event source|source]] of this event is the [[player]] that just spawned. | The [[event system#Event source|source]] of this event is the [[player]] that just spawned. |
Latest revision as of 03:02, 27 September 2018
This event is called when a player spawns.
Parameters
float posX, float posY, float posZ, float spawnRotation, team theTeam, int theSkin, int theInterior, int theDimension
- posX: the X position the player spawned at.
- posY: the Y position the player spawned at.
- posZ: the Z position the player spawned at.
- spawnRotation: the rotation the player spawned with.
- theTeam: the team the player spawned with.
- theSkin: the skin/model the player spawned with.
- theInterior: the interior the player spawned in.
- theDimension: the dimension the player spawned in.
Source
The source of this event is the player that just spawned.
Example
This example plays a sound when a player spawns.
-- when a player spawns, function player_Spawn ( posX, posY, posZ, spawnRotation, theTeam, theSkin, theInterior, theDimension ) -- play a frontend sound for him playSoundFrontEnd ( source, 16 ) end -- add the player_Spawn function as a handler for onPlayerSpawn addEventHandler ( "onPlayerSpawn", getRootElement(), player_Spawn )
Click to collapse [-]
Example 1This example gives the player a weapon whenever he spawns
function Spawn() giveWeapon(source, 31, 500, true) -- Gives the weapon Ak-47, with 500 ammo and on the hand end addEventHandler("onPlayerSpawn", root, Spawn) -- This will exec every time a Player spawn
See Also
Player events
- onPlayerACInfo
- onPlayerBan
- onPlayerChangeNick
- onPlayerChat
- onPlayerClick
- onPlayerCommand
- onPlayerConnect
- onPlayerContact
- onPlayerDamage
- onPlayerJoin
- onPlayerLogin
- onPlayerLogout
- onPlayerMarkerHit
- onPlayerMarkerLeave
- onPlayerModInfo
- onPlayerMute
- onPlayerNetworkStatus
- onPlayerPickupHit
- onPlayerPickupLeave
- onPlayerPickupUse
- onPlayerPrivateMessage
- onPlayerQuit
- onPlayerScreenShot
- onPlayerSpawn
- onPlayerStealthKill
- onPlayerTarget
- onPlayerUnmute
- onPlayerVehicleEnter
- onPlayerVehicleExit
- onPlayerVoiceStart
- onPlayerVoiceStop
- onPlayerWasted
- onPlayerWeaponFire
- onPlayerWeaponSwitch
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled