30.10.2015, 03:40
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:
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]+1; x<=MAX_PLAYERS; x++)
{
if(x == MAX_PLAYERS) x = 0;
if(IsPlayerConnected(x) && x != playerid)
{
if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
{
continue;
}
else
{
StartSpectate(playerid, x);
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]-1; x>=0; x--)
{
if(x == 0) x = MAX_PLAYERS;
if(IsPlayerConnected(x) && x != playerid)
{
if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && User[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
{
continue;
}
else
{
StartSpectate(playerid, x);
break;
}
}
}
}
return 1;
}