SA-MP Forums Archive
[HELP]: How to make capture zones! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]: How to make capture zones! (/showthread.php?tid=444327)



[HELP]: How to make capture zones! - Areax - 16.06.2013

Hello!

I searched for Tutorial on "How to make capture zones", but I didn't find anything useful...Can someone explain me a little?

Thanks!


AW: [HELP]: How to make capture zones! - Skimmer - 16.06.2013

Search more.

https://sampforum.blast.hk/showthread.php?tid=250205
https://sampforum.blast.hk/showthread.php?tid=337874
https://sampforum.blast.hk/showthread.php?tid=353267


Re: AW: [HELP]: How to make capture zones! - Areax - 16.06.2013

Quote:
Originally Posted by MouseBreaker
Посмотреть сообщение
I know how to make Gang Zones, but I want to know, how to make a capture zones like: When you enter the red checkpoint, then you have to wait some seconds to capture it... Anyway Thanks


AW: [HELP]: How to make capture zones! - Skimmer - 16.06.2013

Here i scripted an example for you. Don't forgot to give +REP

pawn Код:
new CaptureFlag[MAX_PLAYERS];
new CaptureCounter[MAX_PLAYERS];

forward UpdatePlayerProgress(playerid);
public UpdatePlayerProgress(playerid)
{
    CaptureCounter[playerid]--;
    new string[58];
    format(string, sizeof(string), "~W~Wait ~Y~%d ~W~Seconds", CaptureCounter[playerid]);
    GameTextForPlayer(playerid, string, 1000, 3);
   
    if(CaptureCounter[playerid] == 0)
    {
        // Player has got the flag, what should happen now?
    }
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, X, Y, Z)) // The Player is in capture checkpoint
    {
        // Don't forgot to check player's team.
        CaptureCounter[playerid] = 20;
        CaptureFlag[playerid] = SetTimerEx("UpdatePlayerProgress", 1000, 1, "i", playerid);
        GameTextForPlayer(playerid, "~W~Wait ~Y~20 ~W~Seconds", 1000, 3);
    }
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    if(CaptureCounter[playerid] < 20 && IsPlayerInRangeOfPoint(playerid, 10.0, X, Y, Z))
    {
        KillTimer(CaptureFlag[playerid]);
        GameTextForPlayer(playerid, "Failed! Please Stay~n~In The Checkpoint", 3000, 3);
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(CaptureFlag[playerid]);
    CaptureCounter[playerid] = 20;
    return 1;
}



Re: [HELP]: How to make capture zones! - Areax - 16.06.2013

Thanks