у меня виснет spectate
#1

pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    for(new x = 0; x < MAX_PLAYERS; x++)
    {
        if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && Player[x][gSpectateID] == playerid)
        {
            if(Player[x][pTeam] == T_REF)
                AdvanceSpectate(x);
            else
                AdvanceTeamSpectate(x);
        }
    }
    return true;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    for(new x = 0; x < MAXPLAYER; x++)
    {
        if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && Player[x][gSpectateID] == playerid)
        {
            if(Player[x][pTeam] == T_REF)
                AdvanceSpectate(x);
            else
                AdvanceTeamSpectate(x);
        }
    }
    return true;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    for (new x; x != MAXPLAYER; ++x)
    {
        if(IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_SPECTATING && Player[x][gSpectateID] == playerid)
            SetPlayerInterior(x, newinteriorid);
    }
    return true;
}
public OnPlayerEnterVehicle(playerid, vehicleid)
{
    for (new x; x != MAXPLAYER; ++x)
    {
        if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && Player[x][gSpectateID] == playerid)
        {
            TogglePlayerSpectating(x, 1);
            PlayerSpectateVehicle(x, vehicleid);
        }
    }
    return true;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
    for (new x; x != MAXPLAYER; ++x)
    {
        if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && Player[x][gSpectateID] == playerid )
        {
            TogglePlayerSpectating(x, 1);
            PlayerSpectatePlayer(x, playerid);
        }
    }
    return true;
}
public StartSpectate(playerid, specid)
{
    SetPlayerInterior(playerid, GetPlayerInterior(specid));
    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(specid));
    TogglePlayerSpectating(playerid, 1);
    if(IsPlayerInAnyVehicle(specid))
        PlayerSpectateVehicle(playerid, GetPlayerVehicleID(specid));
    else
        PlayerSpectatePlayer(playerid, specid);
    Player[playerid][gSpectateID] = specid;
    Player[playerid][Specing]     = true;
    Player[playerid][pPlaying]    = false;
    TextDrawShowForPlayer(playerid, Player[playerid][SpecText]);
    UpdatePlayer(playerid);
    return true;
}
stock StopSpectate(playerid)
{
    KillTimer(SUT[playerid]);
    TogglePlayerSpectating(playerid, 0);
    Player[playerid][Specing]    = false;
    Player[playerid][gSpectateID] = INVALID_PLAYER_ID;
    TextDrawHideForPlayer(playerid, Player[playerid][SpecText]);
    return true;
}
stock adminspec_strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
        index++;

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
AdvanceTeamSpectate(playerid)
{
    if(GetActivePlayersOnTeam(Player[playerid][pTeam]) < 1)return StopSpectate(playerid);
    if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && Player[playerid][gSpectateID] != INVALID_PLAYER_ID)
    {
        for (new x = Player[playerid][gSpectateID] + 1; x <= MAXPLAYER; x++)
        {
            if(x >= MAXPLAYER)x = 0;
            if (IsPlayerConnected(x) && x != playerid && Player[x][pPlaying] == true && Player[x][pTeam] == Player[playerid][pTeam])
            {
                if (GetPlayerState(x) == PLAYER_STATE_SPECTATING && Player[x][gSpectateID] != INVALID_PLAYER_ID && Player[x][pPlaying] == true || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
                {
                    continue;
                }
                else
                {
                    StartSpectate(playerid, x);
                    return true;
                }
            }
        }
    }
    return StopSpectate(playerid);
}
GetActivePlayersOnTeam(team)
{
    new players = 0;
    foreach(i)
    {
        if(Player[i][pTeam] == team && Player[i][pPlaying] == true)
            players++;
    }
    return players;
}
AdvanceSpectate(playerid)
{
    if(PlayersAvailable() < 1){StopSpectate(playerid); return true;}
    if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && Player[playerid][gSpectateID] != INVALID_PLAYER_ID)
    {
        for(new x = Player[playerid][gSpectateID]+1; x <= MAXPLAYER; x++)
        {
            if(x == MAXPLAYER)x = 0;
            if(IsPlayerConnected(x) && x != playerid && Player[x][pPlaying] == true)
            {
                if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && Player[x][gSpectateID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
                {
                    continue;
                }
                else
                {
                    StartSpectate(playerid, x);
                    break;

                }
            }
        }
    }
    return true;
}
PlayersAvailable()
{
    new players = 0;
    foreach(i) if(Player[i][pPlaying] == true && Player[i][pSpawned] && Player[i][Specing] == false && GetPlayerState(i) != PLAYER_STATE_SPECTATING && Player[i][pTeam] != T_REF)
        players++;
    return players;
}
Здравствуйте! Помогите разобраться почему у меня виснет спек. Он виснет не сразу и в какой момент именно, я понять не могу. Но когда его вообще нет в моде, работает все хорошо. Прошу вашей помощи. Что именно заставляет его повиснуть понять.
Reply


Messages In This Thread
у меня виснет spectate - by Nikid - 14.04.2012, 15:00
Re: Спек - by iEnemY - 14.04.2012, 20:34
Re: Спек - by jhonyxakep - 14.04.2012, 23:58
Re: Спек - by Nikid - 15.04.2012, 03:29
Re: Спек - by iEnemY - 15.04.2012, 03:54
Re: Спек - by Stepashka - 15.04.2012, 04:05
Re: у меня виснет spectate - by Nikid - 01.05.2012, 14:00
Re: у меня виснет spectate - by iEnemY - 01.05.2012, 14:24
Re: у меня виснет spectate - by Nikid - 01.05.2012, 14:30
Re: у меня виснет spectate - by Stepashka - 01.05.2012, 19:53
Re: у меня виснет spectate - by iEnemY - 01.05.2012, 20:03
Re: у меня виснет spectate - by Nikid - 09.05.2012, 03:14
Re: у меня виснет spectate - by Gameyer - 09.05.2012, 04:01
Re: у меня виснет spectate - by Nikid - 09.05.2012, 04:41
Re: у меня виснет spectate - by Gameyer - 09.05.2012, 09:43
Re: у меня виснет spectate - by Nikid - 09.05.2012, 10:06

Forum Jump:


Users browsing this thread: 3 Guest(s)