View Full Version : Strange problem about P.Classes

23/04/2017, 02:25 PM
Hello everyone! I have a problem with my gamemode.

Everytime I log-in it spawns me instead of requesting class (choosing teams). I have added gTeams, and added Classes under GameModeInit but still nothing.

forward SetPlayerTeamFromClass(playerid, classid);
public OnPlayerRequestClass(playerid, classid)
SetPlayerTeamFromClass(playerid, classid);
return 1;
public SetPlayerTeamFromClass(playerid, classid)
if(classid == 0)
gTeam[playerid] = NORMAL;
GameTextForPlayer(playerid,"~w~normal",3000,5); // This will show up an Text , when you select your class
SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
SetPlayerColor(playerid,0xA000FFFF); // Teamcolor
else if(classid == 1)
gTeam[playerid] = POLICE_OFFICER;

AddPlayerClass(217, 401.6212,2532.2688,16.5452,175.4787, 27, 100, 31, 50, 0, 0);
AddPlayerClass(247, 401.6212,2532.2688,16.5452,175.4787, 27, 100, 31, 50, 0, 0);
AddPlayerClass(254, 401.6212,2532.2688,16.5452,175.4787, 27, 100, 31, 50, 0, 0);
AddPlayerClass(111, 401.6212,2532.2688,16.5452,175.4787, 27, 100, 31, 50, 0, 0);

I have removed SpawnPlayer after login/register. But it still won't display select classes, I have worked on gamemode my own and this is first time i'm facing something like this, thanks :)

24/04/2017, 07:21 AM
Could you show us your onplayerconnect and where spawnplayer is used?

24/04/2017, 04:34 PM
OnPlayerConnect doesn't have anything special, only MySQL stuff. SpawnPlayer isn't used anywhere, I have removed usage of it.

25/04/2017, 04:08 AM
There must be something else, this code is not the problem.

Is OnPlayerRequestClass called correctly or not? Is TogglePlayerSpectating used somewhere during login or in OnPlayerConnect?

Any FilterScripts that could interfere? Check the return statements of those scripts in the related callbacks - FilterScripts come first and could theoretically block the callbacks of your gamemode from being called. Check the wiki to see which callbacks actually handle return values and make sure they are correct.