Creating A Capturable Ganzone
#1

Hello,

I have create some gangzones on my server and saved each gangzone on the script like this:

pawn Код:
enum gZone
{
    gID, // ID of the gangzone
    gGangID, // The Gang ID it belongs to (0 for NOT TAKEN)
    Float:gLeft, // Min X
    Float:gBottom, // Min Y
    Float:gRight, // MAX X
    Float:gTop, // Max Y
};
new GangZone[15+1][gZone];
Now I want to make it so if a player is inside the turf that is in a gang, it starts a "turf war" after 30 seconds or so..

My only idea of how i can do this is by having a random timer that runs every 30 wseconds that checks to see all the players positions in the server and starts a gang war if the player is inside an enemy turf AND the player is in a gang.

Any ideas would be great!
Reply
#2

I would make a timer that lasts every second, and make a variable decrease by one every second if the player is in the turf. This allows for a "You have %d seconds to leave this turf before you start a turf war" message.

Example:

pawn Код:
//Variables to put under gang enum (or whatever you use)
GangWar[MAX_GANGS] = 0; //Can have a gang war between multiple gangs
//Global:
new Tick_TurfWar[MAX_PLAYERS]
//Under a timer:
Tick_TurfWar[i] -= 1;
I think you can figure the rest out.
Reply
#3

Wouldnt having it run every second cause a lot of server lag?
Reply
#4

I would assume so, unless you have a OnPlayerTriggerGangZone callback.
Reply
#5

How do i make my own callback? With a plugin?
Reply
#6

If you have any timer at all, you could trigger the function if the player's gangzone has changed.

Example:

pawn Код:
//In a timer:
if(GangZone[i] != CurrentGangZone)
{
OnPlayerTriggerGangZone(i, CurrentGangZone); //Then in this function you can check to start a turf war
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)