login and force to class
#1

Hello,

I have a problem, I want after you log the server call the OnPlayerRequestClass for choice the team. I use spawnplayer, ForceClassSelection after the login but don't work. thanks.

Код:
public OnPlayerRequestSpawn(playerid)
{
    if(IsPlayerNPC(playerid))return 1;
    if(!gPlayerLogged[playerid])return 0;
    return true;
}

public OnPlayerRequestClass(playerid,classid)
{
    if(IsPlayerNPC(playerid))return 1;
    if(!gPlayerLogged[playerid])return 0;
	SetPlayerClass(playerid, classid);
	gPlayerClass[playerid] = classid;
	switch (classid) {
	    case 0,1:
	        {
				GameTextForPlayer(playerid, "~n~~n~~n~~g~Grove", 500, 3);
				{SetPlayerPos(playerid, 2520.1550,-1671.1104,19.4203);
				 SetPlayerFacingAngle(playerid,270);
				 SetPlayerCameraPos(playerid, 2524.1550,-1671.1104,19.9203);
				 SetPlayerCameraLookAt(playerid, 2520.1550,-1671.1104,19.4203); }
			}
               ...
               ...
	}
	return true;
}

SetPlayerClass(playerid, classid) {

	if(classid == 0) gTeam[playerid] = TEAM_GROVE;
	else if(classid == 1) gTeam[playerid] = TEAM_GROVE;
	...
}

//gamemodeinit
/================================== [ Grove ] ====================================================================
	AddPlayerClass(105,2497.035,-1702.942,1014.734, 0, 24, 500, 32, 250, 9, 1);
	AddPlayerClass(106,2497.035,-1702.942,1014.734, 0, 24, 500, 32, 250, 9, 1);
...


//after the login

format(string, sizeof(string), "~w~hi ~n~~y~   %s", plname);
GameTextForPlayer(extraid, string, 5000, 1);
Freeze(extraid, 1);
SetSpawnInfo( extraid, 0, 135, 1958.3783,-5343.1572,1100.3746,269.1425,0,0,0,0,0,0);
SpawnPlayer(extraid); //or tested ForceClassSelection(extraid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)