Death Spawn Problem
#1

Hi guys

I was working on my death system and I found out that every time you die, it will take you to the skin selection and spawn when I want it to just spawn you at your death point.

Is there any way of trying to stop it showing as its really annoying me now.
Reply
#2

How can we know what you have coded? Give us your codes..
Reply
#3

pawn Код:
SetPlayerPos(playerid, DeathInfo[playerid][DeathPosX], DeathInfo[playerid][DeathPosY], DeathInfo[playerid][DeathPosZ]);
        SetPlayerCameraPos(playerid, DeathInfo[playerid][DeathPosX], DeathInfo[playerid][DeathPosY], DeathInfo[playerid][DeathPosZ]+5);
        SetPlayerCameraLookAt(playerid, DeathInfo[playerid][DeathPosX], DeathInfo[playerid][DeathPosY], DeathInfo[playerid][DeathPosZ]);
        TogglePlayerControllable(playerid, 0);
        SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
        ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0);
        ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0);
        ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0);
        SetTimerEx("AutoDeath", AUTODEATH_SECONDS * 1000, false, "i", playerid);
        SendClientMessage(playerid, COLOR_TWPINK, "------------------ Health Advise -----------------");
        SendClientMessage(playerid, COLOR_TWPINK, "You have been critically injured!");
        SendClientMessage(playerid, COLOR_TWPINK, "You can '/request medic' or '/acceptdeath'!");
        SendClientMessage(playerid, COLOR_TWPINK, "--------------------------------------------------------");
Thats the section for when a player spawns, the if statement is DeathInfo[playerid][IsDead] == 1

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(DeathInfo[playerid][IsDead] == 0)
    {
        new Float:pX, Float:pY, Float:pZ;
        GetPlayerPos(playerid, pX, pY, pZ);
        DeathInfo[playerid][DeathPosX] = pX;
        DeathInfo[playerid][DeathPosY] = pY;
        DeathInfo[playerid][DeathPosZ] = pZ;
        DeathInfo[playerid][IsDead] = 1;
        PlayerInfo[killerid][pKills]++;
        PlayerInfo[playerid][pDeaths]++;
        SetPVarInt(playerid, "Hospital", ClosestHospital(playerid));
        TogglePlayerSpectating(playerid, true);
        SpawnPlayer(playerid);
    }
    else if(DeathInfo[playerid][IsDead] == 1)
    {
        SetTimerEx("AutoDeath", AUTODEATH_SECONDS * 1000, false, "i", playerid);
    }
    return 1;
}
And this is when the player dies
Reply
#4

OnPlayerRequestSpawn & OnPlayerRequestClass

->
pawn Код:
if(PlayerInfo[playerid][Logged] == true) SpawnPlayer(playerid); // Simple as that
Reply
#5

Quote:
Originally Posted by Sime30
Посмотреть сообщение
OnPlayerRequestSpawn & OnPlayerRequestClass

->
pawn Код:
if(PlayerInfo[playerid][Logged] == true) SpawnPlayer(playerid); // Simple as that
Yes, simple as that but that is not what the guy asked for.

OT: Try to create a boolean variable like PlayerDied or something like that. When the player dies, set the variable to true and save the player's position. Under OnPlayerSpawn, add a timer with ~250 ms interval and when it gets called, set the player's position to the saved one.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)