SA-MP Forums Archive
(Difficult Question) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: (Difficult Question) (/showthread.php?tid=124095)



(Difficult Question) - nesty - 28.01.2010

hi, everyone I try to script a GM with bases which can conquered! And nearly everything is running perfectly but there is one problem because I wanna make a basesystem where there is a certain time that runs down (countdown) and after this countdown the following variables will set.
pawn Код:
CONQUERED_BASE_GASSTATION = 1;// for Team 1
CONQUERED_BASE_GASSTATION = 2;// for Team 2
here my code:
pawn Код:
new CONQUERED_BASE_GASSTATION;
pawn Код:
SetTimer("BASE_CHECK", 100, true);
pawn Код:
public BASE_CHECK(BASE_CHECK_ID)
{
for(new i; i<GetMaxPlayers(); i++)
{
if(!IsPlayerInAnyVehicle(i))
{
    if(BASE_CHECK_IsPlayerInBASE(i,BASE_GASSTATION))
    {
        if(gTeam[i] == TEAM_1)
        {
            if((CONQUERED_BASE_GASSTATION==0)||(CONQUERED_BASE_GASSTATION==2))
                {
                CONQUERED_BASE_BAUPLATZ = 1;
                SendClientMessageToAll(COLOR_RED,"CONQUERED_BASE_GASSTATION by Team 1");
                Update3DTextLabelText(TEXTLABEL_GASSTATION ,COLOR_BLUE, "GASSTATION");
                }
            else if(CONQUERED_BASE_GASSTATION ==1)
                {
                SendClientMessage(i,COLOR_RED,"Already Conquered!");
                }
        }
        else if(gTeam[i] == TEAM_2)
        {
            if((CONQUERED_BASE_GASSTATION ==0)||(CONQUERED_BASE_GASSTATION ==1))
                {
                CONQUERED_BASE_GASSTATION = 2;
                SendClientMessageToAll(COLOR_RED,"CONQUERED_BASE_GASSTATION by Team 2");
                Update3DTextLabelText(TEXTLABEL_GASSTATION ,COLOR_RED, "GASSTATION");
                }
            else if(CONQUERED_BASE_GASSTATION ==2)
                {
                SendClientMessage(i,COLOR_RED,"Already Conquered!");
                }
        }
        else SendClientMessagel(i,COLOR_RED,"VIEWER Can't Conquer Bases!");
    }
    else
    {
    }
}
}
}
ok hope someone can help me
It's a basal question because if i fix this problem i think my GM is finished.
I know that isn't a simple question so i hope anyone will take a look at this


Re: (Difficult Question) - Babul - 28.01.2010

hm.. maybe you give this snipped a try:
pawn Код:
public BASE_CHECK(BASE_CHECK_ID)
{
    for(new i; i<GetMaxPlayers(); i++)
    {
        if(!IsPlayerInAnyVehicle(i))
        {
            if(BASE_CHECK_IsPlayerInBASE(i,BASE_GASSTATION))
            {
                if(gTeam[i]==0) return SendClientMessagel(i,COLOR_RED,"VIEWER Can't Conquer Bases!");
                if(CONQUERED_BASE_GASSTATION==gTeam[i]) return SendClientMessage(i,COLOR_RED,"Already Conquered!");

//              CONQUERED_BASE_BAUPLATZ=gTeam[i];//der bauplatz ist nie benutzt. habs mal durch gasstation ersetzt. stimmts so?
                CONQUERED_BASE_GASSTATION=gTeam[i];
                new string[64];
                format(string,sizeof(string),"CONQUERED_BASE_GASSTATION by Team %d",gTeam[i]);
                SendClientMessageToAll(COLOR_RED,string);
                Update3DTextLabelText(TEXTLABEL_GASSTATION ,COLOR_BLUE, "GASSTATION");
                return 1;
            }
        }
    }
    return 1;
}
...and as usual, some algorithmic changes 4 free inclusive


Re: (Difficult Question) - nesty - 28.01.2010

thanks for the reply
and how can i set a countdown (timer).
I'm trying to explain the scenario:
If one member or more of a team is at the certain point (like pickup or something) it will set an personal [i] Timer. Once there are no teammembers at this certain point the timer will be killed. But if one of them is still at the point during the Countdown(Timer) has count down (= 0) the global not personal Variable CONQUERED_BASE_GASSTATION will set the value of the Team like:
pawn Код:
CONQUERED_BASE_GASSTATION = 1; //here for team 1
(THE Question: How can i fix this with the timer? ) hope for replies


Re: (Difficult Question) - Babul - 28.01.2010

ok i think i got what u want: a "u need to stay 10 seconds at this point to capture this base. 9 seconds left..."
i will script it in my gamemode, but i will handle it different this time, how about this idea:
the more players are staying in the CP, the faster taking over the base would be? its even easier to script instead a cunstom timer for each player imo



Re: (Difficult Question) - nesty - 29.01.2010

can u explain me how i can use this or send me a pice of your script ? because i just tried it but it doesn't work lol (1 Month unsolved)
pls.


Re: (Difficult Question) - adi360 - 29.01.2010

babul u mean a system like battlefield? has?


Re: (Difficult Question) - nesty - 29.01.2010

iam not babul but it should be like battlefield2 lol