RequestClassAbs: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
(Created page with "{{v1_8_beta}} {{Welcome|desc=Request a class by specifying its absolute class ID (0,1,2,3,4,..) rather than choosing it relatively (-1,0,1) through RequestClass. This function must be called when npc is not spawned. Calling it when npc is spawned has no effect.| params=<source lang="lua">(classId)</source> <poem> :: classId : The ID of the class to select </poem>| retvals=true, on success and false, on failure (classId out of range)| example=<source lang="lua"> </so...")
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
params=<source lang="lua">(classId)</source>
params=<source lang="lua">(classId)</source>
<poem>
<poem>
:: classId : The ID of the class to select  
:: classId : The ID of the class to select. Values must be non-negative and not more than <source inline>49</source>
</poem>|
</poem>|
retvals=true, on success and false, on failure (classId out of range)|
retvals=true, on success and false, on failure (classId out of range)|
example=<source lang="lua">
example=<source lang="lua">
function OnPlayerDeath(playerid)
{
if(playerid==GetMyID())
        RequestClassAbs(3);
}
</source>|
</source>|
relfuncs=*[[RequestClass]]
relfuncs=*[[RequestClass]]
*[[OnNPCClassSelect]]}}
*[[OnNPCClassSelect]]}}

Latest revision as of 17:11, 8 February 2024

This function was added in v1.8 beta and will not work on previous versions.


Description:
Request a class by specifying its absolute class ID (0,1,2,3,4,..) rather than choosing it relatively (-1,0,1) through RequestClass. This function must be called when npc is not spawned. Calling it when npc is spawned has no effect.


Parameters:

(classId)

classId : The ID of the class to select. Values must be non-negative and not more than 49


Return Values:
true, on success and false, on failure (classId out of range)


Example

function OnPlayerDeath(playerid)
{
	if(playerid==GetMyID())
        RequestClassAbs(3);
}

Related Functions

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