Points...
#8

pawn Код:
//===============================[Points Info]=====================================
enum fPInfo
{
    Float:Pointx,
    Float:Pointy,
    Float:Pointz,
    Type,
    Vulnerable,
    MatPoint,
    CratePoint,
    Announced,
    ClaimerId,
    ClaimerTeam,
    TimeToClaim,
    TimeLeft,
    Owner[32],
    PlayerNameCapping[MAX_PLAYER_NAME],
    CapperName[MAX_PLAYER_NAME],
    Name[32],
    TakeOverTimerStarted,
    TakeOverTimer,
    Text3D:TextLabel,
    CaptureTimerEx2,
    Stock,
    Text3D:CaptureProccess,
    Text3D:CaptureProgress,
    CaptureProccessEx,
    Float: Capturex,
    Float: Capturey,
    Float: Capturez,
    PointPickupID,
    Bar:PointBarID,
}

new Points[MAX_POINTS][fPInfo];
//===============================[Points]=======================================
public CaptureTimer(point)
{
    new string[128];
    new fam;
    if(Points[point][TimeToClaim])
    {
        new claimer = Points[point][ClaimerId];
        new Float: x, Float: y, Float: z;
        GetPlayerPos(claimer, x, y, z);
        if (Points[point][Capturex] != x || Points[point][Capturey] != y || Points[point][Capturez] != z || GetPVarInt(Points[point][ClaimerId],"Injured") == 1)
        {
            SendClientMessage(Points[point][ClaimerId], COLOR_LIGHTBLUE, "You failed to capture. You either moved or died while attempting to capture.");
            Points[point][ClaimerId] = INVALID_PLAYER_ID;
            Points[point][TimeToClaim] = 0;
        }
        else
        {
            if(Points[point][Vulnerable] > 0)
            {
                SendClientMessage(Points[point][ClaimerId], COLOR_LIGHTBLUE, "You failed to capture. The point was already captured.");
                Points[point][ClaimerId] = INVALID_PLAYER_ID;
                Points[point][TimeToClaim] = 0;
                return 1;
            }
            if(PlayerInfo[claimer][pFMember] == 255)
            {
                Points[point][PlayerNameCapping] = GetPlayerNameEx(claimer);
                format(string, sizeof(string), "%s has attempted to take control of the %s for %s, it will be theirs in %d minutes.", Points[point][PlayerNameCapping], Points[point][Name], FamilyInfo[fam][FamilyName], TIME_TO_TAKEOVER);
                SendClientMessageToAll(COLOR_YELLOW, string);
            }
            if(Points[point][CaptureProccessEx] >= 1)
            {
                UpdateDynamic3DTextLabelText(Points[point][CaptureProccess], COLOR_YELLOW, string);
                Points[point][CaptureProccessEx] = 2;
            }
            Points[point][TakeOverTimerStarted] = 1;
            Points[point][TakeOverTimer] = 10;
            Points[point][ClaimerId] = INVALID_PLAYER_ID;
            Points[point][ClaimerTeam] = fam;
            Points[point][TimeToClaim] = 0;
            if(Points[point][CaptureTimerEx2] != -1) KillTimer(Points[point][CaptureTimerEx2]);
            Points[point][CaptureTimerEx2] = SetTimerEx("CaptureTimerEx", 60000, 1, "d", point);
        }
    }
    return 1;
}

public ProgressTimer(point)
{
    if (Points[point][ClaimerId] != INVALID_PLAYER_ID && Points[point][TimeToClaim])
    {
        Points[point][TimeLeft]--;
        SetProgressBarValue(Points[point][PointBarID], GetProgressBarValue(Points[point][PointBarID])-10.0);
        UpdateProgressBar(Points[point][PointBarID], Points[point][ClaimerId]);
        if(GetProgressBarValue(Points[point][PointBarID]) >= 10) SetTimerEx("ProgressTimer", 1000, 0, "d", point);
        new string[128];
        format(string, sizeof(string), "%s is attempting to capture the point, time left: %d", GetPlayerNameEx(Points[point][ClaimerId]), Points[point][TimeLeft]);
        if(Points[point][TimeLeft] == 9) Points[point][CaptureProgress] = CreateDynamic3DTextLabel(string, COLOR_RED, Points[point][Pointx], Points[point][Pointy], Points[point][Pointz]+1.0, 10.0);
        else if(Points[point][TimeLeft] < 9 && Points[point][TimeLeft] >= 0) UpdateDynamic3DTextLabelText(Points[point][CaptureProgress], COLOR_RED, string);

        if(GetProgressBarValue(Points[point][PointBarID]) == 50.0)
        {
            SetProgressBarColor(Points[point][PointBarID], COLOR_YELLOW);
            UpdateProgressBar(Points[point][PointBarID], Points[point][ClaimerId]);
        }
        else if(GetProgressBarValue(Points[point][PointBarID]) == 20.0)
        {
            SetProgressBarColor(Points[point][PointBarID], COLOR_RED);
            UpdateProgressBar(Points[point][PointBarID], Points[point][ClaimerId]);
        }
        else if(GetProgressBarValue(Points[point][PointBarID]) <= 0.0 && Points[point][TimeLeft] <= 0)
        {
            CaptureTimer(point);
            Points[point][TimeLeft] = 0;
            DestroyProgressBar(Points[point][PointBarID]);
            DestroyDynamic3DTextLabel(Points[point][CaptureProgress]);
        }
    }
    else
    {
        DestroyProgressBar(Points[point][PointBarID]);
        DestroyDynamic3DTextLabel(Points[point][CaptureProgress]);
        Points[point][ClaimerId] = INVALID_PLAYER_ID;
        Points[point][TimeToClaim] = 0;
    }
    return 1;
}
Reply


Messages In This Thread
Points... - by iBots - 29.11.2013, 13:18
Re: Points... - by xVIP3Rx - 29.11.2013, 13:25
Re: Points... - by Konstantinos - 29.11.2013, 13:28
Re: Points... - by iBots - 29.11.2013, 13:33
Re: Points... - by Konstantinos - 29.11.2013, 13:37
Re: Points... - by iBots - 29.11.2013, 13:37
Re: Points... - by Konstantinos - 29.11.2013, 13:41
Re: Points... - by iBots - 29.11.2013, 13:43
Re: Points... - by iBots - 29.11.2013, 13:49
Re: Points... - by iBots - 29.11.2013, 14:08

Forum Jump:


Users browsing this thread: 1 Guest(s)