Spectate
#1

I was doing a few modifications on my admin system.
The spectate system is working fine, however i wanted to modify the way how the Advance and Previous Spectate system works.

Spectating is stopped once i use the Advance / Previous Spectate (If there are only 2 players, Me and the Player).

Is it possible to change the function to something else, something like, for instence it won't work, blocking the function unless there are one more player connected (you can use the Advance / Previous Spectate).

Credits to LAdmin:
PHP код:
stock AdvanceSpectate(playerid)
{
    if(
Iter_Count(Player) == 2) { StopSpectate(playerid); return 1; } // this part needs to be changed?
    
if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && User[playerid][SpecID] != INVALID_PLAYER_ID)
    {
        for(new 
x=User[playerid][SpecID]+1x<=MAX_PLAYERSx++)
        {
            if(
== MAX_PLAYERS0;
            if(
IsPlayerConnected(x) && != playerid)
            {
                if(
GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != && GetPlayerState(x) != && GetPlayerState(x) != 3))
                {
                    continue;
                }
                else
                {
                    
StartSpectate(playeridx);
                    break;
                }
            }
        }
    }
    return 
1;
}
stock ReverseSpectate(playerid)
{
    if(
Iter_Count(Player) == 2) { StopSpectate(playerid); return 1; } // this part needs to be changed?
    
if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && User[playerid][SpecID] != INVALID_PLAYER_ID)
    {
        for(new 
x=User[playerid][SpecID]-1x>=0x--)
        {
            if(
== 0MAX_PLAYERS;
            if(
IsPlayerConnected(x) && != playerid)
            {
                if(
GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != && GetPlayerState(x) != && GetPlayerState(x) != 3))
                {
                    continue;
                }
                else
                {
                    
StartSpectate(playeridx);
                    break;
                }
            }
        }
    }
    return 
1;

Reply
#2

I assume Iter_Count stores how many players are connected to the server. You probably just want to remove the StopSpectate function call so it doesn't stop spectating and replace it with a message such as "There are no other players to spectate.".
Reply
#3

Daamn... didn't knew about that.

Thank you for clearing it out, my mind is blank at the moment ..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)