SA-MP Forums Archive
Territory Problem - 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: Territory Problem (/showthread.php?tid=266996)



Territory Problem - cloudysky - 06.07.2011

Hey I made a territory script which works fine. However there is a problem. When the command to start the war is used then everyone in the server AT THAT TIME can see it but people joining cannot. Its the same when you use the command then relog. Can anyone help me?

pawn Код:
command(startwar, playerid, params[])
{
    if( PlayerInfo[playerid][Admin] >= 2)
    {
        SetGangCheckpoint();
        GangZoneShowForAll(WepDepZone, COLOUR_GREY);
    }
    return 1;
}
Thats the command to start the war.


Re: Territory Problem - Jack_Leslie - 06.07.2011

You've got it so only Level2+ admins can see it?


Re: Territory Problem - cloudysky - 06.07.2011

No, thats what level you have to be to use the command


Re: Territory Problem - cloudysky - 06.07.2011

Sorry for the double post but i really need this fixed. like i said it works but when you relog the checkpoints gone along with the grey gangzone.


Re: Territory Problem - Shadoww5 - 06.07.2011

Could you explain agian what you want ?

And post SetGangCheckpoint.


Re: Territory Problem - cloudysky - 06.07.2011

Hi thanks for responding.

I want it to save when a team captures the territory. It works when you are in game, so for example I do /startwar and the checkpoint appears. Then Grove captures it and the gangzone turns green. However if I leave the game and join again it's as if the admin never done /startwar in the first place. There is not even a gangzone.

pawn Код:
stock SetGangCheckpoint()
{
    new id = random(1);
   
    switch(id)
    {
    case 0: SetCheckpointForAll(CP_WEPDEP, 883.0366, -1242.1566, 15.9840, 50) || SendClientMessageToAll(COLOUR_ALERT, "ALERT: The Weapon Depot is available for capture!" );
    }
}
(It's early in development so there is only one capture point atm)


AW: Territory Problem - Nero_3D - 06.07.2011

You need a flag

pawn Код:
new bool: war = false;
pawn Код:
//In your command, if you start the war
    war = true;
pawn Код:
//OnPlayerConnect
    if(war == true) {
        SetPlayerCheckpoint(...);
        GangZoneShowForPlayer(...);
    }
pawn Код:
//and whenever the war ends
    war = false;
And good luck with your mode


Re: Territory Problem - cloudysky - 07.07.2011

Thanks for the response.

So if there is a capture point already on the map how could you define the current capture point for the player connecting?


AW: Re: Territory Problem - Nero_3D - 07.07.2011

Just save the point in the variable

pawn Код:
new capPoint = -1; // just in invalid number
pawn Код:
stock SetGangCheckpoint()
{
    capPoint = random(1);
   
    switch(capPoint)
    {
        case 0: {
            SetCheckpointForAll(CP_WEPDEP, 883.0366, -1242.1566, 15.9840, 50);
            SendClientMessageToAll(COLOUR_ALERT, "ALERT: The Weapon Depot is available for capture!");
        }
    }
}
pawn Код:
//OnPlayerConnect
    if(capPoint != -1) {
        switch(capPoint) {
            case 0: {
                SetPlayerCheckpoint(...);
                SendClientMessage(...);
            }
        }
        GangZoneShowForPlayer(...);
    }
pawn Код:
//and whenever the war ends
    capPoint = -1



Re: AW: Territory Problem - Vero - 07.07.2011

pawn Код:
new bool: GreenZone = false;
pawn Код:
//OnPlayerSpawn
    if(GreenZone == true) {
        GangZoneShowForPlayer(...);
    }
pawn Код:
//Put this in where the gangzone changes to Green

GreenZone = true;
That's using Nero's idea which will work.