User talk:Lil Toady: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(Removing all content from page)
 
Line 1: Line 1:
__NOTOC__
This function plays a frontend sound for the specified player.
==Usage==
Both server-side and client-side. "thePlayer" argument isn't used in client-side version of this function.


==Syntax==
===Server===
<syntaxhighlight lang="lua">
bool playSoundFrontEnd ( player thePlayer, int sound ) 
</syntaxhighlight>
===Client===
<syntaxhighlight lang="lua">
bool playSoundFrontEnd ( int sound ) 
</syntaxhighlight>
===Required Arguments===
*'''thePlayer:''' The [[player]] you want the sound to play for.
*'''sound:''' A whole [[int]] specifying the sound id to play. Valid values are:
{{Sounds}}
===Returns===
Returns ''true'' if the sound was successfully played , ''false'' otherwise.
==Example==
===Server===
This example plays a sound when a player spawns
<syntaxhighlight lang="lua">
function onPlayerSpawn ( spawnpoint, team ) --when a player spawns
  playSoundFrontEnd ( source, 16 ) --play a sound for him
end
addEventHandler ( "onPlayerSpawn", getElementRoot(), onPlayerSpawn ) --add an event for onPlayerSpawn
</syntaxhighlight>
===Client===
This example plays a sound when a player spawns
<syntaxhighlight lang="lua">
function onPlayerSpawn ( spawnpoint, team ) --when a player spawns
  playSoundFrontEnd ( 16 ) --play a sound for him
end
addEventHandler ( "onPlayerSpawn", getElementRoot(), onPlayerSpawn ) --add an event for onPlayerSpawn
</syntaxhighlight>

Latest revision as of 21:43, 5 January 2008