Spawning Player without Class Selection
#1

I was trying to create something like, If player is registered, he should spawn without entering to class selection. It seems to work, but only when we press any of the class selection keys ( Left/Right Arrow). help me please..

So far I got this.

Code:
public OnPlayerRequestClass(playerid, classid)
{
	if (udb_Exists(PlayerName(playerid)))
		{
	SpawnPlayer(playerid);
 	SetPlayerSkin(playerid,dUserINT(PlayerName(playerid)).("Skin"));
	SendClientMessage(playerid, White, "Account Found! Please login with /login [PASS].");
		}
	else
		{
	SetPlayerPos(playerid, 2110.428955, 2062.340332, 54.546875);
	SetPlayerFacingAngle(playerid, 90.0139);
	SetPlayerInterior(playerid, 0 );
	SetPlayerCameraPos(playerid, 2107.428955, 2062.340332, 56.2);
	SetPlayerCameraLookAt(playerid, 2110.428955, 2062.340332, 55.20);
		}
	return 1;
}
Reply
#2

pawn Code:
public OnPlayerConnect(playerid)
{
  TogglePlayerSpectating(playerid, 1);
  return 1;
}
pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
  SetPlayerCameraPos(playerid, 2107.428955, 2062.340332, 56.2);
  SetPlayerCameraLookAt(playerid, 2110.428955, 2062.340332, 55.20);
  return 1;
}
pawn Code:
// /login
TogglePlayerSpectating(playerid, 0);
SpawnPlayer(playerid);
Reply
#3

That works. But now its not possible to select another class, If the player is registered. When he press F4 and does /kill, it respawns player. Any fix for this?
Reply
#4

Remove /kill command? Or add SpawnPlayer to that.
Reply
#5

You will have to create a player variable (for example: AutoSpawn[MAX_PLAYERS]). Set it equal to 1 (to use auto-spawn) or 0 (do not use auto-spawn) through a command. Then check the value of AutoSpawn[playerid] under OnPlayerRequestClass.
Reply
#6

use
Code:
SetSpawnInfo(forgot the parameters, look em up, in, the, wiki);
SpawnPlayer(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)