OnNPCClassSelect: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:
{  
{  
     RequestSpawn();
     RequestSpawn();
    return 1; //important
}  
}  
</source>|
</source>|

Revision as of 16:45, 24 May 2023

This function was added in v1.6 beta 4 patch2 and will not work on previous versions.


Description:
This function is called when server grants a class to NPC to select for spawning. This function is called not when npc selects a class, but rather when a class is presented to npc.


Parameters:

NoParams


Return Values:
Return true if RequestSpawn was used or you do not want to spawn npc now. Then the program will not send another 'request for spawn' to server. If you return 0, the call will be passed to plugins and if all plugins return 0, then a 'request for spawn' will be send to server.

Important Note:
The npc's team, color and weapons are set according to the classes value, before the function is called.

Example

function OnNPCClassSelect() 
{ 
     RequestSpawn();
     return 1; //important
}

Related Functions

The following functions may be helpful as they relate to this function in one way or another.