GetWeaponOwner: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function}} Get the owner of the custom weapon (used for lag compensation.) ==Syntax== <syntaxhighlight lang="lua">player getWeaponOwner ( theWeapon )</syntaxhighlight> ===Required Argum...")
 
(Remove obsolete Requirements section)
 
(9 intermediate revisions by 7 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
Get the owner of the custom weapon (used for lag compensation.)
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.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">player getWeaponOwner ( theWeapon )</syntaxhighlight>
<syntaxhighlight lang="lua">bool getWeaponOwner ( weapon theWeapon )</syntaxhighlight>
{{OOP|Pair is completely disabled at the moment (its value is ''[[nil]]'').|[[Element/Weapon|weapon]]:getOwner|owner|setWeaponOwner}}


===Required Arguments===
===Required Arguments===
Line 10: Line 11:


===Returns===
===Returns===
Returns the ''player element'' of the custom weapon owner, ''false'' otherwise.
This function was intended to return the [[player]] which owns the [[Element/Weapon|custom weapon]], and ''false'' if an error occured. However, at the moment it always returns ''false''.


==Requirements==
==Example==
{{Requirements|1.3.0-4555|1.3.0-4555|}}
<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>


==See Also==
==See also==
{{Client weapon functions}}
{{Client weapon creation functions}}

Latest revision as of 17:06, 7 November 2024

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

See also