[Tutorial] Creating captureable GangZones. [Best for TDM]
#21

Nice Work !
Reply
#22

I made something similar for my server then i found a bug.
Try to capture a zone then disconnect from the server, then connect again..and the zone doesn't show for the player
But when you try to enter the capture Check Point it says already take by your team.
So you should add something like this to the tuto
HTML Code:
public OnPlayerSpawn(playerid)
{
if(tCheck[Zone] == TEAM_RUSSIA)return GangZoneShowForPlayer(Zone, COLOR_RUSSIA);
if(tCheck[Zone] == TEAM_USA)return GangZoneShowForPlayer(Zone, COLOR_USA);
return 1;
}
And that will be a lot of coding if you have many zones
Reply
#23

Make the zone captureable when someone kills about 2-3 players from X team in that zone. And start a war, as in Single Player.
Nice tutorial, and code.
Reply
#24

Good job!
Reply
#25

Great, this is simply great and helped me a lot.
Reply
#26

Good Job Dude
The only thing that i didn't got is zDefine thing and #define Zone 1 i didn't got its use btw :P
I have to define like
Code:
#define Zone 1
#define Zone2  2
#define Zone3 3
?? or like what??
Reply
#27

Yes, you doing correct darkKiller, you've to define like that only.
Reply
#28

This is an incomplete tutorial with a lot of faults at some stages.

1) I don't understand the use of zDefine variable. The script should work fine without that.

2) This script has no mechanism to set the gangzone colour to the captured team colour after the player respawns on reconnects. I suggest the use of following code.

Under OnPlayerConnect or OnPlayerSpawn callback.
pawn Code:
#define INVALID_TEAM_ID 0

if(tCheck[Zone1] != INVALID_TEAM_ID) GangZoneShowForAll(Zone[Zone1], GetPlayerColor(playerid));
else GangZoneShowForAll(Zone[Zone1], COLOR_GREY);
   
if(tCheck[Zone2] != INVALID_TEAM_ID) GangZoneShowForAll(Zone[Zone2], GetPlayerColor(playerid));
else GangZoneShowForAll(Zone[Zone2], COLOR_GREY);

if(tCheck[Zone3] != INVALID_TEAM_ID) GangZoneShowForAll(Zone[Zone3], GetPlayerColor(playerid));
else GangZoneShowForAll(Zone[Zone3], COLOR_GREY);
3) Your code under OnPlayerLeaveDynamicCP is also incomplete. Suppose if a player enters a capture-zone and starts capturing it. Meanwhile, another player gets into the checkpoint. The server will respond "This zone is already being fought over" to the second player. But when the second player gets out of the checkpoint. It will mess up everything for the first player i.e; it will stop the gangzone flash for all.

So I suggest the use of this under OnPlayerLeaveDynamicCP.

pawn Code:
new UnderAttack [MAX_PLAYERS][30]

if(checkpointid == CP[Zone1] && UnderAttack[playerid][Zone1] == 1)
{
    UnderAttack[playerid][Zone1] = 0;
    GangZoneStopFlashForAll(Zone[Zone1]);
    KillTimer(timer[playerid][Zone1]);
}
In a nutshell, this tutorial requires a lot of modifications. I'm surprised on how no one pointed out these mistakes before.
Reply
#29

Quote:
Originally Posted by Inverse
View Post
This is an incomplete tutorial with a lot of faults at some stages.

1) I don't understand the use of zDefine variable. The script should work fine without that.

2) This script has no mechanism to set the gangzone colour to the captured team colour after the player respawns on reconnects. I suggest the use of following code.

Under OnPlayerConnect or OnPlayerSpawn callback.
pawn Code:
#define INVALID_TEAM_ID 0

if(tCheck[Zone1] != INVALID_TEAM_ID) GangZoneShowForAll(Zone[Zone1], GetPlayerColor(playerid));
else GangZoneShowForAll(Zone[Zone1], COLOR_GREY);
   
if(tCheck[Zone2] != INVALID_TEAM_ID) GangZoneShowForAll(Zone[Zone2], GetPlayerColor(playerid));
else GangZoneShowForAll(Zone[Zone2], COLOR_GREY);

if(tCheck[Zone3] != INVALID_TEAM_ID) GangZoneShowForAll(Zone[Zone3], GetPlayerColor(playerid));
else GangZoneShowForAll(Zone[Zone3], COLOR_GREY);
3) Your code under OnPlayerLeaveDynamicCP is also incomplete. Suppose if a player enters a capture-zone and starts capturing it. Meanwhile, another player gets into the checkpoint. The server will respond "This zone is already being fought over" to the second player. But when the second player gets out of the checkpoint. It will mess up everything for the first player i.e; it will stop the gangzone flash for all.

So I suggest the use of this under OnPlayerLeaveDynamicCP.

pawn Code:
new UnderAttack [MAX_PLAYERS][30]

if(checkpointid == CP[Zone1] && UnderAttack[playerid][Zone1] == 1)
{
    UnderAttack[playerid][Zone1] = 0;
    GangZoneStopFlashForAll(Zone[Zone1]);
    KillTimer(timer[playerid][Zone1]);
}
In a nutshell, this tutorial requires a lot of modifications. I'm surprised on how no one pointed out these mistakes before.
Right. I did however report a bug on my previous post.
Hopefully I'll have time to make a new and proper tutorial about this.
Reply
#30

Quote:
Originally Posted by DaRk_RaiN
View Post
Right. I did however report a bug on my previous post.
Hopefully I'll have time to make a new and proper tutorial about this.
Oh, didn't see that. Yeah it would be good if you make one since I can see only 2 capture zone tutorials here and both of them are inaccurate plus not properly explained.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)