GetWeaponOwner: Difference between revisions
Jump to navigation
Jump to search
m (→Syntax) |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
This function gets the owner of a [[Element/Weapon|custom weapon]]. Weapon ownership system was, however, disabled, so this function always returns ''false''. Please refer to [[setWeaponOwner]] for details. | This function gets the owner of a [[Element/Weapon|custom weapon]]. Weapon ownership system was, however, disabled, so this function always returns ''false''. Please refer to [[setWeaponOwner]] for details. | ||
Line 15: | Line 14: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua">-- | <syntaxhighlight lang="lua">function arma() | ||
minigun = createWeapon("minigun", 1, 1, 3)--Create the weapon | |||
setWeaponClipAmmo(minigun, 99999) | |||
setWeaponState(minigun, "firing") | |||
setWeaponProperty(minigun, "fire_rotation", 0, -30, 0) | |||
dueno = getWeaponOwner(minigun)--This gets the owner | |||
outputChatBox(tostring(dueno))--And this say it in the chatbox | |||
end | |||
addCommandHandler("weapon", arma)--CommandHandler</syntaxhighlight> | |||
==Requirements== | ==Requirements== |
Latest revision as of 20:42, 20 May 2015
This function gets the owner of a custom weapon. Weapon ownership system was, however, disabled, so this function always returns false. Please refer to setWeaponOwner for details.
Syntax
bool getWeaponOwner ( weapon theWeapon )
OOP Syntax Help! I don't understand this!
- Note: Pair is completely disabled at the moment (its value is nil).
- Method: weapon:getOwner(...)
- Variable: .owner
- Counterpart: setWeaponOwner
Required Arguments
- theWeapon: The weapon to get the owner of.
Returns
This function was intended to return the player which owns the custom weapon, and false if an error occured. However, at the moment it always returns false.
Example
function arma() minigun = createWeapon("minigun", 1, 1, 3)--Create the weapon setWeaponClipAmmo(minigun, 99999) setWeaponState(minigun, "firing") setWeaponProperty(minigun, "fire_rotation", 0, -30, 0) dueno = getWeaponOwner(minigun)--This gets the owner outputChatBox(tostring(dueno))--And this say it in the chatbox end addCommandHandler("weapon", arma)--CommandHandler
Requirements
Minimum server version | n/a |
---|---|
Minimum client version | 1.3.0-9.04555 |
Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.3.0-9.04555" />
See also
- createWeapon
- fireWeapon
- getWeaponAmmo
- getWeaponClipAmmo
- getWeaponFiringRate
- getWeaponFlags
- getWeaponOwner
- getWeaponProperty
- getWeaponState
- getWeaponTarget
- resetWeaponFiringRate
- setWeaponAmmo
- setWeaponClipAmmo
- setWeaponFiringRate
- setWeaponFlags
- setWeaponProperty
- setWeaponState
- setWeaponTarget