DestroyNPC: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|DestroyNPC(npc)}} {{FuncParameters}} {{FuncParam|npc|__EDIT_ME__}} {{FuncReturnValue|__EDIT_ME__}..."
 
Kuzkay (talk | contribs)
No edit summary
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Destroy/remove any NPC by its id}}


{{FuncSyntax|DestroyNPC(npc)}}
{{FuncSyntax|DestroyNPC(npc)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|npc|__EDIT_ME__}}
{{FuncParam|npc|NPC You want to destroy/remove}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|__EDIT_ME__}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
function deleteNPC(player, npc)
  if IsValidNPC(tonumber(npc)) then --Check if npc is valid first
      DestroyNPC(tonumber(npc))
  end
end
AddCommand('removenpc', deleteNPC)
</syntaxhighlight>
 


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
__EDIT_ME__

Revision as of 19:55, 13 November 2019

DestroyNPC

Type: Function
Context: Server
Introduced: v1.0

Description

Destroy/remove any NPC by its id

Syntax

DestroyNPC(npc)

Parameters

  • npc
    NPC You want to destroy/remove

Return Value

  • __EDIT_ME__

Example

function deleteNPC(player, npc)
   if IsValidNPC(tonumber(npc)) then --Check if npc is valid first
      DestroyNPC(tonumber(npc))
   end
end
AddCommand('removenpc', deleteNPC)


See also

__EDIT_ME__