SetSpawnFunction problem -
xtremedeblin - 27.02.2010
Its realy annoying - I have separate function in callback OnPlayerSpawn called SetPlayerSpawn.
It runs greate with 28 calls (respawns) then... Its gone
I have made test variable which count function calls and its 28 calls before function stop responding.
Код:
public SetPlayerSpawn(playerid)
{
test++;
printf("SetPlayerSpawn Count: %d", test);
if(IsPlayerConnected(playerid))
{
printf("SetPlayerSpawn - IsPlayerConnected - 1");
if(PlayerInfo[playerid][pCrashed] == 1)
{
printf("SetPlayerSpawn - Crashed - 0");
if(AdminDuty[playerid] == 1)
{
SetPlayerColor(playerid,COLOR_ADMINDUTY);
SetPlayerHealth(playerid,99999);
SetPlayerArmour(playerid,99999);
}
//SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
SetPlayerToPos(playerid,PlayerInfo[playerid][pCrashX],PlayerInfo[playerid][pCrashY],PlayerInfo[playerid][pCrashZ]);
SetPlayerInterior(playerid,PlayerInfo[playerid][pCrashInt]);
SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pCrashW]);
PlayerInfo[playerid][pCrashed] = 0;
GameTextForPlayer(playerid, "~r~Crashed...~n~~g~Respawn na ostatniej znanej pozycji.", 7000, 6);
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerLocalMessage(playerid,15.0,"został przeniesiony na ostatnią znaną pozycje.");
}
else
{
PlayerLocalMessage(playerid,15.0,"została przeniesiony na ostatnią znaną pozycje.");
}
return 1;
}
if(PlayerInfo[playerid][pCrashed] == 0)
{
printf("SetPlayerSpawn - Crashed - 0");
if(JustDied[playerid] == 1)
{
printf("SetPlayerSpawn - JustDied - 1");
//SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
if(PlayerInfo[playerid][pLevel] >=1 && PlayerInfo[playerid][pLevel] < 10)
{
SetPlayerHealth(playerid,50);
}
if(PlayerInfo[playerid][pLevel] >= 10 && PlayerInfo[playerid][pLevel] < 20)
{
SetPlayerHealth(playerid,75);
}
if(AdminDuty[playerid] == 1)
{
SetPlayerColor(playerid,COLOR_ADMINDUTY);
SetPlayerHealth(playerid,99999);
SetPlayerArmour(playerid,99999);
new house = PlayerInfo[playerid][pHouseKey];
if(house != 255 && PlayerInfo[playerid][pSpawnPoint] == 1)
{
SetPlayerInterior(playerid,Houses[house][ExitInterior]);
SetPlayerToPos(playerid, Houses[house][ExitX], Houses[house][ExitY],Houses[house][ExitZ]);
SetPlayerVirtualWorld(playerid,house);
JustDied[playerid] = 0;
return 1;
}
if(PlayerInfo[playerid][pFaction] != 255 && PlayerInfo[playerid][pSpawnPoint] == 0)
{
SetPlayerToFactionColor(playerid);
SetPlayerToFactionSkin(playerid);
SetPlayerToPos(playerid, -2649.4966,576.2688,14.6094);
SetPlayerFacingAngle(playerid, 180.5617);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
JustDied[playerid] = 0;
return 1;
}
}
if(AdminDuty[playerid] == 0)
{
if(PlayerInfo[playerid][pFaction] != 255 && PlayerInfo[playerid][pJailed] == 0)
{
SetPlayerToFactionColor(playerid);
SetPlayerToFactionSkin(playerid);
SetPlayerToPos(playerid, -2649.4966,576.2688,14.6094);
SetPlayerFacingAngle(playerid, 180.5617);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
JustDied[playerid] = 0;
return 1;
}
if(PlayerInfo[playerid][pFaction] == 255 && PlayerInfo[playerid][pJailed] == 0)
{
SetPlayerToPos(playerid, -2649.4966,576.2688,14.6094);
SetPlayerFacingAngle(playerid, 180.5617);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
JustDied[playerid] = 0;
return 1;
}
if(PlayerInfo[playerid][pJailed] == 1)
{
if(PlayerInfo[playerid][pFaction] != 255)
{
SetPlayerToFactionColor(playerid);
SetPlayerToFactionSkin(playerid);
}
SetPlayerVirtualWorld(playerid,2); //BUILDING ID 2, MAKE SURE PD IS ID 2
SetPlayerInterior(playerid, 6);
SetPlayerToPos(playerid,264.5743,77.5118,1001.0391);
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[BLAD:] Miłego czekania !");
JustDied[playerid] = 0;
return 1;
}
}
}
else
{
printf("SetPlayerSpawn - JustDied - 0");
//SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
if(PlayerInfo[playerid][pLevel] >=1 && PlayerInfo[playerid][pLevel] < 10)
{
SetPlayerHealth(playerid,50);
}
if(PlayerInfo[playerid][pLevel] >= 10 && PlayerInfo[playerid][pLevel] < 20)
{
SetPlayerHealth(playerid,75);
}
if(AdminDuty[playerid] == 1)
{
SetPlayerColor(playerid,COLOR_ADMINDUTY);
SetPlayerHealth(playerid,99999);
SetPlayerArmour(playerid,99999);
}
if(PlayerInfo[playerid][pJailed] == 1)
{
if(PlayerInfo[playerid][pFaction] != 255)
{
SetPlayerToFactionColor(playerid);
SetPlayerToFactionSkin(playerid);
}
SetPlayerVirtualWorld(playerid,2); //BUILDING ID 2, MAKE SURE PD IS ID 2
SetPlayerInterior(playerid, 6);
SetPlayerToPos(playerid,264.5743,77.5118,1001.0391);
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[BLAD:] Nie jesteś jeszcze wolny !");
return 1;
}
if(PlayerInfo[playerid][pHouseKey] != 255 && PlayerInfo[playerid][pSpawnPoint] == 1 && PlayerInfo[playerid][pJailed] == 0)
{
SetPlayerInterior(playerid,Houses[PlayerInfo[playerid][pHouseKey]][ExitInterior]);
SetPlayerToPos(playerid, Houses[PlayerInfo[playerid][pHouseKey]][ExitX], Houses[PlayerInfo[playerid][pHouseKey]][ExitY],Houses[PlayerInfo[playerid][pHouseKey]][ExitZ]);
SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pHouseKey]);
return 1;
}
if(PlayerInfo[playerid][pFaction] != 255 && PlayerInfo[playerid][pSpawnPoint] == 0 && PlayerInfo[playerid][pJailed] == 0)
{
SetPlayerToFactionColor(playerid);
SetPlayerToFactionSkin(playerid);
SetPlayerToPos(playerid,DynamicFactions[PlayerInfo[playerid][pFaction]][fX],DynamicFactions[PlayerInfo[playerid][pFaction]][fY],DynamicFactions[PlayerInfo[playerid][pFaction]][fZ]);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);
return 1;
}
if(PlayerInfo[playerid][pFaction] == 255 && PlayerInfo[playerid][pHouseKey] == 255 && PlayerInfo[playerid][pJailed] == 0)
{
//====================[Setting Civilian Position]==========================
SetPlayerToPos(playerid,CivilianSpawn[X],CivilianSpawn[Y],CivilianSpawn[Z]);
SetPlayerVirtualWorld(playerid, CivilianSpawn[World]);
SetPlayerInterior(playerid, CivilianSpawn[Interior]);
SetPlayerFacingAngle(playerid,CivilianSpawn[Angle]);
//=========================================================================
return 1;
}
}
}
}
return 1;
}
Re: SetSpawnFunction problem -
-Rebel Son- - 27.02.2010
I See you got two returns, Wouldnt changing the very bottom one 0 fix the problem?
Re: SetSpawnFunction problem -
xtremedeblin - 27.02.2010
Nope, problem still exist.
Re: SetSpawnFunction problem -
dice7 - 27.02.2010
Does it say anything like "SERVER: Unknown command" in the 29th respawn ? If so, then you have a buffer overflow. Also, debug your code to see what exactly happens on the 29th respawn, to see where it stops
Re: SetSpawnFunction problem -
xtremedeblin - 27.02.2010
There is no info like "SERVER: Unknown command", nothing happend. Maybe I show some code in OnPlayerSpawn. Maybe here is something wrong.
Код:
SetPlayerWantedLevelEx(playerid, PlayerInfo[playerid][pWantedLvl]);
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],CivilianSpawn[X],CivilianSpawn[Y],CivilianSpawn[Z],0,0,0,0,0,0,0);
SetPlayerSpawn(playerid); //function causing problems
}
return 1;
Re: SetSpawnFunction problem -
xtremedeblin - 27.02.2010
Anyone ?