Spectating when you die?
#1

Hello all,

First of all I have several questions:
I'm pretty new to scripting so I wanted to ask:

Once you die you mustn't able to re-spawn but you automatically spectate someone.
When only one person is left, the game re-starts again and you can spawn.

Is this possible, if yes may you help me out?

Thanks.
Reply
#2

Yes, it's kinda easy, but i guess no one here will help you since you don't even tried to make.

Just take a look at callback onplayerdeath and the function toggleplayerspectating it may help.
Reply
#3

This is the timer, a player spectates his killer for 6 seconds after the player dies:
pawn Код:
//
    if(killerid != INVALID_PLAYER_ID)
    {
        TogglePlayerSpectating(playerid, 1);
        if(IsPlayerInAnyVehicle(killerid))
        {
            new vehicleid = GetPlayerVehicleID(killerid);
            PlayerSpectateVehicle(playerid, vehicleid);
        }
        else
        {
            PlayerSpectatePlayer(playerid, killerid);
        }

        SetTimerEx("DeathCameraStop", 1000*6, false, "i", playerid);
    }
And timer:
pawn Код:
forward DeathCameraStop(playerid);
public DeathCameraStop(playerid)
{
    TogglePlayerSpectating(playerid, 0);
    return 1;
}
You can edit so it meets your standards.
Reply
#4

Quote:
Originally Posted by Dan.
Посмотреть сообщение
This is the timer, a player spectates his killer for 6 seconds after the player dies:
pawn Код:
//
    if(killerid != INVALID_PLAYER_ID)
    {
        TogglePlayerSpectating(playerid, 1);
        if(IsPlayerInAnyVehicle(killerid))
        {
            new vehicleid = GetPlayerVehicleID(killerid);
            PlayerSpectateVehicle(playerid, vehicleid);
        }
        else
        {
            PlayerSpectatePlayer(playerid, killerid);
        }

        SetTimerEx("DeathCameraStop", 1000*6, false, "i", playerid);
    }
And timer:
pawn Код:
forward DeathCameraStop(playerid);
public DeathCameraStop(playerid)
{
    TogglePlayerSpectating(playerid, 0);
    return 1;
}
You can edit so it meets your standards.
Hmm sounds good, but this is more a racing server and when you die/explode/fall you got to spectate other racers till the everyone is dead and till one is left. Then you re-spawn.
Reply
#5

Lol, trying to make a copy of New Dawn DD/DM server. xD

When player die, check on every players (MAX_PLAYERS) for who is still in race and spect him.
Reply
#6

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
Lol, trying to make a copy of New Dawn DD/DM server. xD

When player die, check on every players (MAX_PLAYERS) for who is still in race and spect him.
I don't really know how that works, any help?
Reply
#7

You should learn how to use loops. When a player dies, you loop through all the other players. When a player is still in the race, you make the dead player spectate him. When the driver dies, you loop again through all players and spectate a new driver and so on.
Reply
#8

Quote:
Originally Posted by Dan.
Посмотреть сообщение
You should learn how to use loops. When a player dies, you loop through all the other players. When a player is still in the race, you make the dead player spectate him. When the driver dies, you loop again through all players and spectate a new driver and so on.
Thats exactly what I want, I can pay for a scripter if he may help me.. Please let me know
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)