OnPlayerSpawn doesn't call.
#1

public OnPlayerSpawn doesn't call. Only while spawned first time, this is called.

Код:
public OnPlayerSpawn(playerid)
{
    print("Executing spawn...");
	if(Logged[playerid] == false) return 1;
    GetPlayerPos(playerid, PlayerInfo[playerid][pos_xl], PlayerInfo[playerid][pos_yl], PlayerInfo[playerid][pos_zl]);
	SetCameraBehindPlayer(playerid);
    Spawn[playerid] = true;
	SetPlayerColor(playerid, PlayerColor[playerid]);
	if(BattleInfo[playerid][pOnBattle] == 1)
 	{
 	    BattleInfo[playerid][pDed] +=1;
 	    new lstat[256];
		format(lstat, sizeof(lstat), "Twoje lokalne statystyki:\nDrużyna: %d\nPunkty: %d\nŚmierci: %d\nFlagi: %d\nBomby: %d", BattleInfo[playerid][pBattleTeam],BattleInfo[playerid][pPoints],BattleInfo[playerid][pDed],BattleInfo[playerid][pFlag],BattleInfo[playerid][pBomb]);
  		UpdatePlayer3DTextLabelText(playerid, BattleLocal, COLOR_GREEN, lstat);
		if(BattleInfo[playerid][pBattleTeam] == 0)
		{
		    Battle[bAlives] -=1;
		}
		if(BattleInfo[playerid][pBattleTeam] == 1)
		{
		    Battle[bAlivesA] -=1;
		}
		if(BattleInfo[playerid][pBattleTeam] == 2)
		{
		    Battle[bAlivesB] -=1;
		}
 	    SetPlayerPos(playerid, 1431.5,757.0,16.1);
	 	PreferPlayerBattle(playerid);
	 	return 1;
 	}
    if(PlayerInfo[playerid][aj] != 0)
    {
        SetPlayerInterior(playerid, Ustawienia[AJ_INT]);
        SetPlayerPos(playerid, Ustawienia[AJ_X], Ustawienia[AJ_Y], Ustawienia[AJ_Z]);
        SetPlayerVirtualWorld(playerid, playerid);
    }
    else if(PlayerInfo[playerid][prisontime] > 0)
    {
        TogglePlayerControllable(playerid, 0);
        SetPlayerPos(playerid, 2425.18994141,108.06999969,-72.15000153);
        SetPlayerVirtualWorld(playerid, 0);
        GameTextForPlayer(playerid,"~r~Wczytywanie obiektow~n~~g~Jestes w wiezieniu",3000,3);
        SetTimerEx("ToggleFreeze", 5000, 0, "i", playerid);
	}
  	else if(PlayerInfo[playerid][bw] != 0)
    {
    	PlayerInfo[playerid][health] = 10.0;
        SetPlayerHealth(playerid, 10.0);
        SetPlayerPos(playerid, PlayerInfo[playerid][pos_x], PlayerInfo[playerid][pos_y], PlayerInfo[playerid][pos_z]+0.3);
        SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pos_vw]);
        SetPlayerInterior(playerid, PlayerInfo[playerid][pos_int]);
    }
	else if(GetPVarInt(playerid, "spawn") == 3) //hotel
    {
		SetPlayerPos(playerid, Hotels[PlayerInfo[playerid][hoteli]][inside_x], Hotels[PlayerInfo[playerid][hoteli]][inside_y], Hotels[PlayerInfo[playerid][hoteli]][inside_z]);
		SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][player_uid]);
	   	SetPlayerInterior(playerid, Hotels[PlayerInfo[playerid][hoteli]][inside_int]);
	   	hotel[playerid][0] = 1;
	   	hotel[playerid][1] = PlayerInfo[playerid][hoteli];
   	}
   	else if(GetPVarInt(playerid, "spawn") == 2) //dom
   	{
		SetPlayerPos(playerid, DoorInfo[PlayerInfo[playerid][dom]][inside_x], DoorInfo[PlayerInfo[playerid][dom]][inside_y], DoorInfo[PlayerInfo[playerid][dom]][inside_z]);
		SetPlayerVirtualWorld(playerid, DoorInfo[PlayerInfo[playerid][dom]][inside_vw]);
	   	SetPlayerInterior(playerid, DoorInfo[PlayerInfo[playerid][dom]][inside_int]);
   	}
    else if(GetPVarInt(playerid, "spawn") == 11)
    {
        SetPlayerPos(playerid, Ustawienia[Spawn1][0], Ustawienia[Spawn1][1], Ustawienia[Spawn1][2]);
        SetPlayerFacingAngle(playerid, 90);
		SetPlayerVirtualWorld(playerid, 0);
	    SetPlayerInterior(playerid, 0);
        PlayerPlaySound(playerid, 6400, Ustawienia[Spawn1][0], Ustawienia[Spawn1][1], Ustawienia[Spawn1][2]);
    }
	else if(GetPVarInt(playerid, "spawn") == 1)
	{
	    SendClientMessage(playerid, CLR_GREEN, "Twoja pozycja została przywrуcona!");
        SetPlayerPos(playerid, PlayerInfo[playerid][pos_x], PlayerInfo[playerid][pos_y], PlayerInfo[playerid][pos_z]+0.3);
        SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pos_vw]);
        SetPlayerInterior(playerid, PlayerInfo[playerid][pos_int]);
	}

	SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 			1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 	1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, 	1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, 			1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 	1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, 	1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 		1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, 				1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 			1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, 				1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, 		1);

	SetPlayerFightingStyle(playerid, PlayerInfo[playerid][sztukawalki]);
    SetPlayerHealth(playerid, PlayerInfo[playerid][health]);
	SetPlayerDrunkLevel(playerid, PlayerInfo[playerid][drunklvl]);
    Nicki(playerid);
    DeletePVar(playerid, "spawn");
	return 1;
}
Why this callback isn't called?
Please, help me.

Yesterday this worked. Today it isn't. I didn't change nothing!
Reply
#2

Try this(not tested):

Код:
public OnPlayerRequestSpawn(playerid)
{
CallLocalFunction("OnPlayerSpawn","i",playerid);
return 1;
}
Reply
#3

I don't have spawn request becouse player loggin without class selection. I have MySQL and spawning in selected places.
Reply
#4

Then use:
pawn Код:
SpawnPlayer(playerid);
Reply
#5

Im not stupid...
I already had this in code.
Reply
#6

Any idea?
Reply
#7

It must work fine. Or, you can use the function 'SpawnPlayer' under OnPlayerDeath and on cases where player gets spawned. Spawn callback can get called well then.
Reply
#8

Same. Public isn't working.
Reply
#9

OK. Works fine now!
The callback didn't called becouse player skin ID was invalid!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)