GetValidPedModels: Difference between revisions
Jump to navigation
Jump to search
(Created page with '{{Server client function}} __NOTOC__ This function returns all valid ped models. ==Syntax== <syntaxhighlight lang="lua"> table getValidPedModels ( ) </syntaxhighlight> ===Returns=== Returns a table …') |
|||
Line 12: | Line 12: | ||
==Example== | ==Example== | ||
This example will get if the specified skin is a valid skin or not. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function isValidSkin( thePlayer, command, specifiedSkin ) -- Define the function | ||
if ( specifiedSkin ) then -- If skin specified | |||
local allSkins = getValidPedModels ( ) -- Get valid skin IDs | |||
local result = false -- Define result, it is currently false | |||
for key, skin in ipairs( allSkins ) do -- Check all skins | |||
if skin == tonumber( specifiedSkin ) then -- If skin equals specified one, it is valid | |||
result = skin -- So set it as result | |||
end | |||
end | |||
if ( result ) then -- If we got results | |||
outputChatBox( tostring( skin ) .. " is a valid skin ID.", thePlayer, 0, 255, 0 ) -- It is valid, output it | |||
else -- If we didn't get results | |||
outputChatBox( specifiedSkin .. " is not a valid skin ID.", thePlayer, 0, 255, 0 ) -- No result, it is not valid | |||
end | |||
else -- If no skin specified | |||
outputChatBox( "Please specify a skin ID to check!", thePlayer, 255, 0, 0 ) -- Tell it to the player | |||
end | |||
end | |||
addCommandHandler("checkskin",isValidSkin) -- bind 'checkskin' command to 'isValidSkin' function | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 17:12, 26 September 2011
This function returns all valid ped models.
Syntax
table getValidPedModels ( )
Returns
Returns a table with all valid ped models.
Example
This example will get if the specified skin is a valid skin or not.
function isValidSkin( thePlayer, command, specifiedSkin ) -- Define the function if ( specifiedSkin ) then -- If skin specified local allSkins = getValidPedModels ( ) -- Get valid skin IDs local result = false -- Define result, it is currently false for key, skin in ipairs( allSkins ) do -- Check all skins if skin == tonumber( specifiedSkin ) then -- If skin equals specified one, it is valid result = skin -- So set it as result end end if ( result ) then -- If we got results outputChatBox( tostring( skin ) .. " is a valid skin ID.", thePlayer, 0, 255, 0 ) -- It is valid, output it else -- If we didn't get results outputChatBox( specifiedSkin .. " is not a valid skin ID.", thePlayer, 0, 255, 0 ) -- No result, it is not valid end else -- If no skin specified outputChatBox( "Please specify a skin ID to check!", thePlayer, 255, 0, 0 ) -- Tell it to the player end end addCommandHandler("checkskin",isValidSkin) -- bind 'checkskin' command to 'isValidSkin' function
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