ReloadPedWeapon: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Server function}} This function makes a pedestrian reload their weapon. ==Syntax== <syntaxhighlight lang="lua"> bool reloadPedWeapon ( ped thePed ) </syntaxhighlight> ===Required Arguments=== *'''t...)
 
mNo edit summary
Line 13: Line 13:
===Returns===
===Returns===
Returns ''true'' if the pedestrian was made to reload, or ''false'' if invalid arguments were passed or that pedestrian has a weapon which cannot be reloaded.
Returns ''true'' if the pedestrian was made to reload, or ''false'' if invalid arguments were passed or that pedestrian has a weapon which cannot be reloaded.
Note: this will fail but return true if
1) the ped is crouched and moving
2) the ped is using a weapon without clip ammo (or minigun/flamethrower/fire
extinguisher)
3) the ped is using his weapon (shooting/aiming)
4) the ped moved while crouching recently
Due to these circumstances causing problems with this function


==Example==  
==Example==  

Revision as of 14:54, 15 July 2009

This function makes a pedestrian reload their weapon.

Syntax

bool reloadPedWeapon ( ped thePed )

Required Arguments

  • thePed: The ped who will reload their weapon.

Returns

Returns true if the pedestrian was made to reload, or false if invalid arguments were passed or that pedestrian has a weapon which cannot be reloaded. Note: this will fail but return true if 1) the ped is crouched and moving 2) the ped is using a weapon without clip ammo (or minigun/flamethrower/fire extinguisher) 3) the ped is using his weapon (shooting/aiming) 4) the ped moved while crouching recently Due to these circumstances causing problems with this function

Example

This example adds a 'reloadgun' console command that lets players reload their weapon.

function reloadGun ( sourcePlayer, command )
    reloadPedWeapon ( sourcePlayer )
end
addCommandHandler ( "reloadgun", reloadGun )

See Also