Spectating when you die? -
ValentinLaw - 17.08.2012
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.
Re: Spectating when you die? -
leonardo1434 - 17.08.2012
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.
Re: Spectating when you die? -
Dan. - 17.08.2012
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.
Re: Spectating when you die? -
ValentinLaw - 17.08.2012
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.
Re : Spectating when you die? -
ricardo178 - 17.08.2012
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.
Re: Re : Spectating when you die? -
ValentinLaw - 17.08.2012
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?
Re: Spectating when you die? -
Dan. - 17.08.2012
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.
Re: Spectating when you die? -
ValentinLaw - 17.08.2012
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