From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This event is called when a player spawns.


float posX, float posY, float posZ, float spawnRotation, team theTeam, int theSkin, int theInterior, int theDimension


The source of this event is the player that just spawned.


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 )
-- add the player_Spawn function as a handler for onPlayerSpawn
addEventHandler ( "onPlayerSpawn", getRootElement(), player_Spawn )
Click to collapse [-]
Example 1

This 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
addEventHandler("onPlayerSpawn", root, Spawn) -- This will exec every time a Player spawn

See Also

Player events

Event functions