21.06.2013, 07:27
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.
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.
In a nutshell, this tutorial requires a lot of modifications. I'm surprised on how no one pointed out these mistakes before.
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);
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]);
}