IsPedInWater: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{ | {{Server client function}} | ||
Checks whether or not a ped is currently in water. | Checks whether or not a ped is currently in water. | ||
Line 16: | Line 16: | ||
==Example== | ==Example== | ||
<section name="Client" class="client" show="true"> | |||
This example shows all players that are in water in a list to the player who enters the 'playersInWater' command. | This example shows all players that are in water in a list to the player who enters the 'playersInWater' command. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function showPlayersInWater(sourcePlayer, command) | function showPlayersInWater ( sourcePlayer, command ) | ||
local players = getElementsByType("player") | local players = getElementsByType ( "player" ) | ||
local list = "" | local list = "" | ||
for k,v in ipairs(players) do | for k,v in ipairs ( players ) do | ||
if isPedInWater(v) then | if isPedInWater ( v ) then | ||
list = list .. " " .. getPlayerName(v) | list = list .. " " .. getPlayerName ( v ) | ||
end | end | ||
end | end | ||
Line 30: | Line 31: | ||
addCommandHandler("playersInWater", showPlayersInWater) | addCommandHandler("playersInWater", showPlayersInWater) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{ | {{Ped_functions}} |
Revision as of 20:20, 25 May 2008
Checks whether or not a ped is currently in water.
Syntax
bool isPedInWater ( ped thePed )
Required Arguments
- thePed: the ped you want to check
Returns
Returns true if the ped is in water, false if he is not or an invalid element was passed.
Example
Click to collapse [-]
ClientThis example shows all players that are in water in a list to the player who enters the 'playersInWater' command.
function showPlayersInWater ( sourcePlayer, command ) local players = getElementsByType ( "player" ) local list = "" for k,v in ipairs ( players ) do if isPedInWater ( v ) then list = list .. " " .. getPlayerName ( v ) end end outputChatBox("Players pretending to be trouts: " .. list, sourcePlayer) end addCommandHandler("playersInWater", showPlayersInWater)
See Also
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle