Difference between revisions of "LUA:CastEntityCommand"

(Created page with "= LUA Functions: CastEntityCommand() = Casts an entity command on the target ==== Syntax ==== CastEntityCommand(param1, param2, param3) ==== Parameters ==== ; Required - ''pa...")
 
 
Line 4: Line 4:
  
 
==== Syntax ====
 
==== Syntax ====
CastEntityCommand(param1, param2, param3)
+
CastEntityCommand(param1, param2, param3, param4)
  
  
 
==== Parameters ====
 
==== Parameters ====
; Required - ''param1'' (Spawn), ''param2'' (Spawn), ''param3'' (String)
+
; Required - ''param1'' (Spawn), ''param2'' (Spawn), ''param3'' (int32), ''param4'' (String)
 
: ''param1'' is the caster of the entity command, must be a player
 
: ''param1'' is the caster of the entity command, must be a player
 
: ''param2'' is the target of the entity command
 
: ''param2'' is the target of the entity command
: ''param3'' is the entity command
+
: ''param3'' is the id of the list in the database
 +
: ''param4'' is the command you want to cast
  
  
Line 19: Line 20:
 
     target = GetTarget(Spawn)
 
     target = GetTarget(Spawn)
 
     if target ~= nil then
 
     if target ~= nil then
         CastEntityCommand(Spawn, target, "Test entity command")
+
         CastEntityCommand(Spawn, target, 1, "Test entity command")
 
     end
 
     end
 
end
 
end
 
</pre>
 
</pre>
  
This item script will cast the "Test entity command" entity command on the players target when the item is used
+
This item script will cast the "Test entity command" entity command from list 1 on the players target when the item is used

Latest revision as of 20:26, 23 May 2013

LUA Functions: CastEntityCommand()

Casts an entity command on the target


Syntax

CastEntityCommand(param1, param2, param3, param4)


Parameters

Required - param1 (Spawn), param2 (Spawn), param3 (int32), param4 (String)
param1 is the caster of the entity command, must be a player
param2 is the target of the entity command
param3 is the id of the list in the database
param4 is the command you want to cast


Usage

function used(Item, Spawn)
    target = GetTarget(Spawn)
    if target ~= nil then
        CastEntityCommand(Spawn, target, 1, "Test entity command")
    end
end

This item script will cast the "Test entity command" entity command from list 1 on the players target when the item is used