Player spawn
#1

Hello.

Could anyone properly explain how to fully control player's spawn data? How to prevent this ton of bugs like a Grove Street with bottle of rum or get stuck in the class selecting without possibilities to get out of there, etc. I tried don't use SetSpawnInfo() (using SetPlayerPos/FacingAngle() in OnPlayerSpawn and other stuff instead), but it's not that I need.
Reply
#2

Can you send post the pieces of script: OnPlayerRequestClass (), OnPlayerSpawn()
Are you using dialogs? Post the OnDialogResponse() here too please
Reply
#3

Quote:
Originally Posted by Deroxi
Посмотреть сообщение
Can you send post the pieces of script: OnPlayerRequestClass (), OnPlayerSpawn()
Are you using dialogs? Post the OnDialogResponse() here too please
Sure.
Код:
public OnPlayerSpawn(playerid)
{
	if(Players[playerid][m_bLogged] == 0)
	{
		SendClientMessage(playerid, RED, "...");
		kick(playerid);
		return true;
	}

	SetPlayerVirtualWorld(playerid, Players[playerid][m_iSpawnWorld]);
	SetPlayerInterior(playerid, Players[playerid][m_iSpawnInt]);

	player.ResetSpawn(playerid);

	Players[playerid][m_bSpawned] = 1;
	Players[playerid][m_bAlive]   = 1;
	return true;
}

public OnPlayerRequestClass(playerid, classid)
{
	new Float:x;
	new Float:y;
	new Float:z;

	GetPlayerPos(playerid, x, y, z);

	RemoveBuildingForPlayer(playerid, 1484, x, y, z, 10.0);
	RemoveBuildingForPlayer(playerid, 1485, x, y, z, 10.0);
	RemoveBuildingForPlayer(playerid, 1486, x, y, z, 10.0);

	player.ResetSpawn(playerid);

	if(Players[playerid][m_bLogged] == 1)
	{
		SpawnPlayer(playerid);
	}
	else
	{
		TogglePlayerSpectating(playerid, true);
		SetTimerEx("@__camera_class", 150, false, "i", playerid);
	}

	SendDebugMessage("Player(%i)::RequestClass %i", playerid, classid);
}

@__camera_class(i);
@__camera_class(i)
{
	SetPlayerCameraPos(i, 1879.984252, -2908.610107, 1.996365);
	SetPlayerCameraLookAt(i, 1879.666870, -2913.487304, 0.941269); 
}
A part of ResetSpawn():
Код:
player.ResetSpawn(playerid)
{
	if(Players[playerid][m_iHouse] != -1)
	{
		new house 	 = Players[playerid][m_iHouse];
		new interior = Houses.baseInfo[house][m_iInterior];

		Players[playerid][m_fSpawnX] = houses.interiors[interior][m_fX];
		Players[playerid][m_fSpawnY] = houses.interiors[interior][m_fY];
		Players[playerid][m_fSpawnZ] = houses.interiors[interior][m_fZ];
		Players[playerid][m_fSpawnR] = houses.interiors[interior][m_fR];
		Players[playerid][m_iSpawnInt] = houses.interiors[interior][m_iInteriorID];
		Players[playerid][m_iSpawnWorld] = Players[playerid][m_iHouse];
		Players[playerid][m_iLastHouse] = Players[playerid][m_iHouse];
		Players[playerid][m_bInHouse] = 1;
	}

                //Some code (setting spawn vars)

		SetSpawnInfo(playerid, 
					 0, 
					 Players[playerid][m_iSkin], 
					 Players[playerid][m_fSpawnX], 
					 Players[playerid][m_fSpawnY],
					 Players[playerid][m_fSpawnZ],
					 Players[playerid][m_fSpawnR],
					 0, 0, 0, 0, 0, 0);
}
I am using dialogs and I am using an 'easyDialogs' include.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)