GetWeaponOwner: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:


==Example==
==Example==
<syntaxhighlight lang="lua">--TODO</syntaxhighlight>
<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==

Revision as of 16:16, 20 May 2015

Accessories-text-editor.png Script Example Missing Function GetWeaponOwner needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.

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

This template will be deleted.

See also