OnNPCClassSelect

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search

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 1 (return true is bugged as of dec.2023. fixed in next version) if RequestSpawn was used or you do not want to spawn npc in this class. 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()
{
    if(GetPlayerSkin(GetMyID())==1) //cop skin in some class
      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.