auto spec after death problem
#1

So , when a player died he spec others till map dont finish
but when they die they see other player's afk , any help ?

all i can give u is the stock

pawn Код:
stock StartSpectate(playerid, specplayerid)
{
    if(playerid == specplayerid) return StartSpectate(playerid, GetRandomPlayer(playerid));
    for(new x=0; x<MAX_PLAYERS; x++) {
        if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerData[x][SpecID] == playerid) {
           AdvanceSpectate(x);
        }
    }
    SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
    SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(specplayerid));
    TogglePlayerSpectating(playerid, 1);
    Spectekiler[playerid] = 1;

    if(IsPlayerInAnyVehicle(specplayerid)) {
        PlayerSpectateVehicle(playerid, GetPlayerVehicleID(specplayerid));
        PlayerData[playerid][SpecID] = specplayerid;
        PlayerData[playerid][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
    }
    else {
        PlayerSpectatePlayer(playerid, specplayerid);
        PlayerData[playerid][SpecID] = specplayerid;
        PlayerData[playerid][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
    }
    return 1;
}
Reply
#2

so you want to spectate the player that killed you correct?

Well you need to on playerdeath just spectate that player that killed you, then make a timer that runs every idk 3 seconds to check if the player you are spectating is still alive, if he is not alive, find someone that is alive to spectate.
Reply
#3

hmm , i got this on player death

pawn Код:
public OnPlayerDeath(playerid, killerid, reason){
    if(GetServerCount() > 1)
    {
        SetPVarInt(playerid, "Geberdi", 1);
        StartSpectate(playerid, GetRandomPlayer(playerid));
    } else
    if(GetServerCount() == 1)
    {
        ProgressForMap();
    }
    return true;
}

stock GetAliveCount(){
    new p_Count;
    for(new i = 0; i < MAX_PLAYERS; i++){
    if(IsPlayerConnected(i)){
    if(GetPVarInt(i, "Geberdi") == 0){
    p_Count++;
    }}}
    return p_Count;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)