RequestSpawn: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Welcome| desc=This will send a request to server for spawning in the currently selected class.| params=<syntaxhighlight lang="lua">NoParams</syntaxhighlight> example=<source lang="lua"> function OnNPCClassSelect() { if(GetPlayerTeam(GetMyID())==2) RequestSpawn(); return 1 } </source>| note= Inside the function, use Team, color, position to check if the class matches as it is not possible to obtain the class id directly.| relfuncs=*RequestClass *OnNP...") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<poem style="border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;"> | |||
This function was added in v1.6 beta 4 patch2 and will not work on previous versions. | |||
</poem> | |||
{{Welcome| | {{Welcome| | ||
desc=This will send a request to server for spawning in the currently selected class.| | desc=This will send a request to server for spawning in the currently selected class.| | ||
params=<syntaxhighlight lang="lua">NoParams</syntaxhighlight> | params=<syntaxhighlight lang="lua">NoParams</syntaxhighlight>| | ||
example=<source lang="lua"> | example=<source lang="lua"> | ||
function OnNPCClassSelect() | function OnNPCClassSelect() | ||
Line 7: | Line 10: | ||
if(GetPlayerTeam(GetMyID())==2) | if(GetPlayerTeam(GetMyID())==2) | ||
RequestSpawn(); | RequestSpawn(); | ||
else | |||
RequestClass(CLASS_NEXT); | |||
return 1 | return 1 | ||
} | } | ||
</source>| | </source>| | ||
note= Inside the function, use Team, color, position to check if the class matches as it is not possible to obtain the class id directly.| | note= Inside the function [[OnNPCClassSelect]], use Team, color, position to check if the class matches as it is not possible to obtain the class id directly.| | ||
retvals=The function returns true on success and false on failure (npc is already spawned).| | |||
relfuncs=*[[RequestClass]] | relfuncs=*[[RequestClass]] | ||
*[[OnNPCClassSelect]] | *[[OnNPCClassSelect]] | ||
}} | }} |
Latest revision as of 14:34, 13 October 2023
This function was added in v1.6 beta 4 patch2 and will not work on previous versions.
Description:
This will send a request to server for spawning in the currently selected class.
Parameters:
NoParams
Return Values:
The function returns true on success and false on failure (npc is already spawned).
Important Note:
Inside the function OnNPCClassSelect, use Team, color, position to check if the class matches as it is not possible to obtain the class id directly.
Example
function OnNPCClassSelect() { if(GetPlayerTeam(GetMyID())==2) RequestSpawn(); else RequestClass(CLASS_NEXT); return 1 }
Related Functions
The following functions may be helpful as they relate to this function in one way or another.