CreateSWATRope: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Removed client section in the example because it is unnecesary)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
{{Needs Example}}
Creates a SWAT rope like that of the rope in single player used by SWAT Teams abseiling from the Police Maverick.
Creates a SWAT rope like that of the rope in single player used by SWAT Teams abseiling from the Police Maverick.


Line 15: Line 14:
==Example==
==Example==
This example creates a Swat rope in police maverick when you use the command /createrope  
This example creates a Swat rope in police maverick when you use the command /createrope  
<section name="Client" class="client" show="true">


<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 22: Line 20:
     if myVehicle and getVehicleName(myVehicle) == "Police Maverick" then
     if myVehicle and getVehicleName(myVehicle) == "Police Maverick" then
         local x,y,z = getElementPosition(myVehicle)
         local x,y,z = getElementPosition(myVehicle)
         createSWATRope(x, y, z, 11111)
         createSWATRope(x, y, z, 11111)
    else
        outputChatBox("Enter Police Maverick!", 255, 0, 0)
     end
     end
end
end
addCommandHandler("createrope", SwatRope)
addCommandHandler("createrope", SwatRope)
</syntaxhighlight>
</syntaxhighlight>
</section>


==Requirements==
==Requirements==

Latest revision as of 15:03, 8 December 2015

Creates a SWAT rope like that of the rope in single player used by SWAT Teams abseiling from the Police Maverick.

Syntax

bool createSWATRope ( float fx, float fy, float fZ, int duration )

Required Arguments

  • fx, fy, fz: the world coordinates where the effect originates.
  • duration: the amount in miliseconds the rope will be there before falling to the ground.

Example

This example creates a Swat rope in police maverick when you use the command /createrope

function SwatRope()
    local myVehicle = getPedOccupiedVehicle(localPlayer)
    if myVehicle and getVehicleName(myVehicle) == "Police Maverick" then
        local x,y,z = getElementPosition(myVehicle)
        createSWATRope(x, y, z, 11111)  
    end
end
addCommandHandler("createrope", SwatRope)

Requirements

Minimum server version n/a
Minimum client version 1.1.1-9.03250

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.1.1-9.03250" />

See Also