Spawn bug
#1

Hello scripters,

I have a bug with my spawnplayer.
If someone registers he should spawn and see a interpolate camera.

Sometimes it works but sometimes not?
I always got spawned at the lv stairways but I have set spawninfo at register dialog response:

Код:
if(dialogid == 1)
	{
	if (!response) return Kick(playerid);
  	if(response)
		{
			if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
			new INI:File = INI_Open(UserPath(playerid));
   			INI_SetTag(File,"data");
			INI_WriteInt(File,"Password",udb_hash(inputtext));
			INI_Close(File);
			gPlayerLogged[playerid] = 1;
			PlayerInfo[playerid][pFirstJoined] = 0;
			PlayerInfo[playerid][pFirstJoined] = 0;
			SetSpawnInfo( playerid, 0, 121, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
			SpawnPlayer(playerid);
			
		}
	}
This is also my spawnplayer:
Код:
public OnPlayerSpawn(playerid)
{
//=============[if joined once]==========
    if(PlayerInfo[playerid][pFirstJoined] > 0)
	{
		SetTimer("ShowMessage", MESSAGE_TIME, true);
		TextDrawHideForPlayer(playerid, Textdraw0);
		TextDrawHideForPlayer(playerid, Textdraw1);
		TextDrawHideForPlayer(playerid, Textdraw2);
		TextDrawHideForPlayer(playerid, Textdraw3);
		TextDrawHideForPlayer(playerid, Textdraw4);
		TextDrawHideForPlayer(playerid, Textdraw5);
		TextDrawHideForPlayer(playerid, Textdraw22);
		TextDrawHideForPlayer(playerid, Textdraw23);
		TextDrawHideForPlayer(playerid, Textdraw24);
		TextDrawHideForPlayer(playerid, Textdraw25);
		TextDrawHideForPlayer(playerid, Textdraw26);
		TextDrawHideForPlayer(playerid, Textdraw27);
		TextDrawHideForPlayer(playerid, Textdraw28);
		TextDrawHideForPlayer(playerid, Textdraw29);
		TextDrawHideForPlayer(playerid, Textdraw30);
		TextDrawHideForPlayer(playerid, Textdraw31);
		TextDrawHideForPlayer(playerid, Textdraw32);
		TextDrawHideForPlayer(playerid, Textdraw33);
		TextDrawHideForPlayer(playerid, Textdraw34);
		TextDrawHideForPlayer(playerid, Textdraw35);
		TextDrawHideForPlayer(playerid, Textdraw36);
		TextDrawHideForPlayer(playerid, Textdraw37);
		SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
		TextDrawShowForPlayer(playerid,Textdraw56);
		TextDrawShowForPlayer(playerid,Textdraw57[playerid]);
		TextDrawShowForPlayer(playerid,Textdraw58[playerid]);
		SetPlayerCash(playerid, PlayerInfo[playerid][pCash]);
		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
		SetPlayerInterior(playerid, PlayerInfo[playerid][pInterior]);
		SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVirtualWorld]);
		SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
		return 1;
	}
//=============[if register for first time]==========
	gPlayerTutorialing[playerid] = 1;
	TextDrawHideForPlayer(playerid, Textdraw2);
	TextDrawHideForPlayer(playerid, Textdraw3);
	TextDrawHideForPlayer(playerid, Textdraw4);
	TextDrawHideForPlayer(playerid, Textdraw5);
	SetPlayerHealth(playerid,100);
	SetTimer("spawn1",5000,0);
	SetPlayerPos(playerid,2616.7766,-1734.1464,6);
	InterpolateCameraPos(playerid, 2634.726318, -1782.372802, 56.108455, 1410.175170, -878.355651, 83.202194, 60000, 1);
	InterpolateCameraLookAt(playerid, 2634.463623, -1782.143676, 52.123676, 1410.262939, -874.362243, 83.414848, 60000, 1);
	PlayAudioStreamForPlayer(playerid, "http://www.ffa-sa.com/spawn.mp3");
	SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
	new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File,"data");
	INI_WriteInt(File, "Level",PlayerInfo[playerid][pLevel] = 1);
	INI_WriteInt(File, "Money",PlayerInfo[playerid][pCash] = 0);
	INI_WriteInt(File, "Admin",PlayerInfo[playerid][pAdmin] = 0);
	INI_WriteInt(File, "Tester",PlayerInfo[playerid][pTester] = 0);
	INI_WriteInt(File, "Vip", PlayerInfo[playerid][pVip] = 0);
	INI_WriteInt(File, "Spawn", PlayerInfo[playerid][pSpawn] = 1);
	INI_WriteInt(File, "Model", PlayerInfo[playerid][pModel] = 23);
	INI_WriteInt(File, "Locked", PlayerInfo[playerid][pLocked] = 0);
	INI_WriteInt(File, "FirstJoined", PlayerInfo[playerid][pFirstJoined] = 0);
	INI_WriteInt(File, "Continent", PlayerInfo[playerid][pPlace] = 0);
	INI_WriteInt(File, "Sex", PlayerInfo[playerid][pSex] = 0);
	INI_WriteInt(File, "Selected", PlayerInfo[playerid][pSelected] = 1);
	INI_WriteInt(File, "Age", PlayerInfo[playerid][pAge] = 0);
	INI_WriteInt(File, "Origin", PlayerInfo[playerid][pOrigin] = 0);
	INI_WriteInt(File, "Respect", PlayerInfo[playerid][pExp] = 0);
	INI_WriteInt(File, "Warns", PlayerInfo[playerid][pWarns] = 0);
	INI_WriteInt(File, "Muted", PlayerInfo[playerid][pMuted] = 0);
	INI_WriteInt(File, "MuteTime", PlayerInfo[playerid][pMuteTime] = 0);
	new rp = 100000 + random(899999);
	INI_WriteInt(File, "Ph", PlayerInfo[playerid][pNumber] = rp);
	INI_WriteInt(File, "DriveLic",PlayerInfo[playerid][pDriveLic] = 0);
	INI_Close(File);
	new kills = PlayerInfo[playerid][pKills];
	new deaths = PlayerInfo[playerid][pDeaths];
	new money = PlayerInfo[playerid][pCash];
	new moneybank = PlayerInfo[playerid][pBankWealth];
	new model = PlayerInfo[playerid][pModel];
	new vip = PlayerInfo[playerid][pVip];
	new warnings = PlayerInfo[playerid][pWarns];
	new muted = PlayerInfo[playerid][pMuted];
	new query[128], pname[100]; //Creates the variables
	GetPlayerName(playerid, pname, 100); //Gets the players name.
	format(query, sizeof(query), "INSERT INTO playerdata SET user='%s', kills=%d, deaths=%d, money=%d, moneybank=%d, model=%d, vip=%d, warnings=%d, muted=%d", pname, kills, deaths, money, moneybank, model, vip, warnings, muted);
	mysql_query(query);
    // Setup local variables
	new HouseID;

	// Reset the HouseID where the player is located
	APlayerData[playerid][CurrentHouse] = 0;

	// If SpawnAtHouse is set to "true", re-position the player at the first house in his list of owned houses
	if (SpawnAtHouse == true)
	{
		// Get the first HouseID in your list of owned houses
		HouseID = APlayerData[playerid][Houses][0];
		// Check if the player has a house in this first slot
		if (HouseID != 0)
		{
			// Re-position the player at the house's coordinates
			SetPlayerPos(playerid, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]);
		}
	}
	if(gPlayerLogged[playerid] == 0)
	{
    	SendClientMessage(playerid, COLOR_LIGHTRED, "** This server requires a Login BEFORE spawn (Kicked) **");
        Kick(playerid);
 	}
	return 1;
}
Can anybody help me with this?
Thanks!
Reply
#2

Anybody?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)