SA-MP Forums Archive
Spawning Player without Class Selection - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Spawning Player without Class Selection (/showthread.php?tid=97481)



Spawning Player without Class Selection - Vichuzz - 14.09.2009

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;
}



Re: Spawning Player without Class Selection - Finn - 14.09.2009

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);



Re: Spawning Player without Class Selection - Vichuzz - 15.09.2009

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?


Re: Spawning Player without Class Selection - Face9000 - 13.05.2012

Remove /kill command? Or add SpawnPlayer to that.


Re: Spawning Player without Class Selection - Yuryfury - 14.05.2012

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.


Re: Spawning Player without Class Selection - dowster - 14.05.2012

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