Switching classes OnPlayerRequestClass -
Darth1993 - 02.04.2013
Hello.
I have a weird problem.
I added eight classes and I can't switch around. (First class -> then eighth or eighth class -> then first)
I can switch classes only forward from 1 to 8 or backward from 8 to 1.
When I switch few times forward from 8, I see same class as 8 and when I want to switch back, I need to switch backward few times until I reach eighth class.
Here is my code:
Код:
//male
AddPlayerClass(287,2296.5662,2451.6270,10.8203,87.8270,0,0,0,0,0,0);
AddPlayerClass(179,2296.5662,2451.6270,10.8203,87.8270,0,0,0,0,0,0);
AddPlayerClass(121,2296.5662,2451.6270,10.8203,87.8270,0,0,0,0,0,0);
AddPlayerClass(292,2296.5662,2451.6270,10.8203,87.8270,0,0,0,0,0,0);
//female
AddPlayerClass(192,2296.5662,2451.6270,10.8203,87.8270,0,0,0,0,0,0);
AddPlayerClass(191,2296.5662,2451.6270,10.8203,87.8270,0,0,0,0,0,0);
AddPlayerClass(195,2296.5662,2451.6270,10.8203,87.8270,0,0,0,0,0,0);
AddPlayerClass(214,2296.5662,2451.6270,10.8203,87.8270,0,0,0,0,0,0);
Код:
public OnPlayerRequestClass(playerid, classid)
{
switch(classid) // switch between the classid's displayed in OnGameModeInit.
{
case 0, 4:
{
SetPlayerPos(playerid, 2516.9578,2447.6992,11.0313); //this is the players position
SetPlayerFacingAngle(playerid, 269.7719); //their facing angle
SetPlayerCameraPos(playerid, 2521.2405,2447.5195,12.0313); //this is the cameras position
SetPlayerCameraLookAt(playerid, 2516.9578,2447.6992,11.0313); //this is what the camera will look at
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_HANDSUP);
}
case 1, 5:
{
SetPlayerPos(playerid, 2516.9578,2447.6992,11.0313); //this is the players position
SetPlayerFacingAngle(playerid, 269.7719); //their facing angle
SetPlayerCameraPos(playerid, 2521.2405,2447.5195,12.0313); //this is the cameras position
SetPlayerCameraLookAt(playerid, 2516.9578,2447.6992,11.0313); //this is what the camera will look at
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_HANDSUP);
}
case 2, 6:
{
SetPlayerPos(playerid, 2516.9578,2447.6992,11.0313); //this is the players position
SetPlayerFacingAngle(playerid, 269.7719); //their facing angle
SetPlayerCameraPos(playerid, 2521.2405,2447.5195,12.0313); //this is the cameras position
SetPlayerCameraLookAt(playerid, 2516.9578,2447.6992,11.0313); //this is what the camera will look at
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_HANDSUP);
}
case 3, 7:
{
SetPlayerPos(playerid, 2516.9578,2447.6992,11.0313); //this is the players position
SetPlayerFacingAngle(playerid, 269.7719); //their facing angle
SetPlayerCameraPos(playerid, 2521.2405,2447.5195,12.0313); //this is the cameras position
SetPlayerCameraLookAt(playerid, 2516.9578,2447.6992,11.0313); //this is what the camera will look at
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_HANDSUP);
}
}
return 1;
}
Please help. :S
Re: Switching classes OnPlayerRequestClass -
Darth1993 - 02.04.2013
Problem solved.
I forgot that AddPlayerClass must be added inside OnGameModeInit().