SetSpawnInfo didn't helped.
I've built a new death system and I noticed something.
The system:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerLoggedIn(playerid))
{
new string[128];
new Float:pPosX, Float:pPosY, Float:pPosZ, Gun, Ammos;
GetPlayerPos(playerid, pPosX, pPosY, pPosZ);
Gun = GetPlayerWeapon(playerid);
Ammos = GetPlayerAmmo(playerid);
if(Gun != 0 && Ammos != 0 && !IsAGov(playerid) && !PlayerInfo[playerid][pFacDuty]) CreateDroppedGun(Gun, Ammos, pPosX+random(2)-random(2), pPosY+random(2)-random(2), pPosZ);
if(Event[playerid])
{
format(string, sizeof(string), "OnEventDeath: %s has killed %s using %s.", RPN(killerid), RPN(playerid), RWN(reason));
foreach(Player, i)
{
if(Event[i]) SendClientMessage(i, COLOR_REPORT, string);
}
Event[playerid] = 0;
}
if(aDuty[playerid])
{
SetPlayerPos(playerid,1177.4894,-1324.2737,14.0732);
SetPlayerFacingAngle(playerid, 268.8192);
TogglePlayerControllable(playerid, 1);
SetPlayerColor(playerid, 0x4d729400);
SetPlayerHealth(playerid, 50000000);
}
if(PlayerInfo[playerid][pDead])
{
PlayerInfo[playerid][pDead] = 0;
SetPlayerHealth(playerid, 100);
PlayerInfo[playerid][pHealth] = 100;
PlayerInfo[playerid][pSpawnFreeze] = 0;
SetPlayerVirtualWorld(playerid, 0);
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
SetPlayerInterior(playerid, 0);
TogglePlayerControllable(playerid, 1);
Delete3DTextLabel(Death[playerid]);
SetPlayerPos(playerid, 1190.7158,-1323.1836,13.3984);
GiveZaiatMoney(playerid, -1500);
SendClientMessage(playerid, COLOR_GREEN, "You were killed.");
return 1;
}
if(PlayerInfo[playerid][pPrison])
{
GiveZaiatMoney(playerid, -150);
format(string, sizeof(string), "You were killed by %s using a %s while being imprisoned.", RPN(killerid), RWN(GetPlayerWeapon(killerid)));
SendClientMessage(playerid, COLOR_LIGHTRED, string);
SpawnCharInCell(playerid);
}
else
{
new Float:Pos[3];
new vw = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
PlayerInfo[playerid][pDead] = 1;
PlayerInfo[playerid][pSpawnFreeze] = 1;
PlayerInfo[playerid][pArmor] = 0;
PlayerInfo[playerid][pHealth] = 15;
SetPlayerHealth(playerid, 15);
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
TogglePlayerControllable(playerid, 0);
LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
Death[playerid] = Create3DTextLabel("Injured", COLOR_LIGHTRED, 0, 0, 0, 10, vw, 1); //adding textlabel
Attach3DTextLabelToPlayer(Death[playerid], playerid, 0.0, 0.0, 0.7);
if(BeingCalled[playerid] || Calling[playerid])
{
if(BeingCalled[playerid]) SendClientMessage(Caller[playerid], COLOR_ORANGE, " The line went dead...");
else if(Calling[playerid]) SendClientMessage(Called[playerid], COLOR_ORANGE, " The line went dead...");
new params[1];
cmd_hangup(playerid, params);
}
if(IsPlayerLoggedIn(killerid))
{
format(string, sizeof(string), "OnPlayerDeath: %s has killed %s using %s.", RPN(killerid), RPN(playerid), RWN(reason));
SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/kill.log", string);
}
return 1;
}
}
return 1;
}
There's more but that's not important, what I've noticed that on those lines in OnPlayerDeath
Код:
new Float:Pos[3];
new vw = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
PlayerInfo[playerid][pDead] = 1;
PlayerInfo[playerid][pSpawnFreeze] = 1;
PlayerInfo[playerid][pArmor] = 0;
PlayerInfo[playerid][pHealth] = 15;
SetPlayerHealth(playerid, 15);
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
TogglePlayerControllable(playerid, 0);
LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
It gets the player pos and then sets it, well it's actually setting him on LV, the known request class background and does all of the others, what means that for some reason on his death he gets spawn there with CJ's skin...