IsPedHeadless: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(added code examples) |
||
Line 13: | Line 13: | ||
==Example== | ==Example== | ||
<section class="client" name="Client" show="true"> | <section class="client" name="Client" show="true"> | ||
Add a command to check whether the player is a zombie or not | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function checkZombie(commandName) | ||
local player = getLocalPlayer() | |||
-- check whether the player is headless (a zombie) | |||
local message = isPedHeadless(player) and "Yes, you are a zombie!" or "No, you aren't a zombie yet!" | |||
outputChatBox(message) | |||
end | |||
addCommandHandler("amIaZombie?", checkZombie) | |||
</syntaxhighlight> | |||
</section> | |||
<section class="server" name="Server" show="true"> | |||
Add a command to check whether a player is a zombie or not | |||
<syntaxhighlight lang="lua"> | |||
function checkZombie(playerSource, commandName, playerTargetNick) | |||
local playerTarget = getPlayerFromName(playerTargetNick) | |||
if (not playerTarget) then outputChatBox("Player not online!", playerSource, 255, 0, 0) end | |||
-- check whether the playerTarget is headless (a zombie) | |||
local message = isPedHeadless(playerTarget) and "This Player is a zombie!" or "This player is not a zombie!" | |||
outputChatBox(message, playerSource) | |||
end | |||
addCommandHandler("zombieOrNot", checkZombie) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> |
Revision as of 00:35, 6 February 2010
With this function, you can check if a ped has a head or not.
Syntax
bool isPedHeadless ( ped thePed )
Required Arguments
- thePed: The ped to check.
Returns
Returns true if the ped is headless, false otherwise.
Example
Click to collapse [-]
ClientAdd a command to check whether the player is a zombie or not
function checkZombie(commandName) local player = getLocalPlayer() -- check whether the player is headless (a zombie) local message = isPedHeadless(player) and "Yes, you are a zombie!" or "No, you aren't a zombie yet!" outputChatBox(message) end addCommandHandler("amIaZombie?", checkZombie)
Click to collapse [-]
ServerAdd a command to check whether a player is a zombie or not
function checkZombie(playerSource, commandName, playerTargetNick) local playerTarget = getPlayerFromName(playerTargetNick) if (not playerTarget) then outputChatBox("Player not online!", playerSource, 255, 0, 0) end -- check whether the playerTarget is headless (a zombie) local message = isPedHeadless(playerTarget) and "This Player is a zombie!" or "This player is not a zombie!" outputChatBox(message, playerSource) end addCommandHandler("zombieOrNot", checkZombie)
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