PDA

View Full Version : gangzonecreate


Strier
10/06/2013, 09:58 PM
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == CP[ 0 ])
{
if(cZone[ 0 ] == gTeam[ playerid ])
{
SendClientMessage(playerid, -1, "This zone is already controlled by your team..!");
}
if(UnderAttack[ 0 ] == 1) return SendClientMessage(playerid, -1, "This zone it's already being captured!");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "You can't capture if you're in a vehicle..!");
UnderAttack[ 0 ] = 1;
timer[ playerid ][ 0 ] = SetTimerEx("SetZone",15000,false,"i", playerid);
if(gTeam[ playerid ] == TEAM_LEPRE)
{
GangZoneFlashForAll(gZ[ 0 ], 0x6699FF);
}
else if(gTeam[ playerid ] == TEAM_BUNNY)
{
GangZoneFlashForAll(gZ[ 0 ], 0xFF9900);
}
SendClientMessageToAll(-1, "Zone is being captured!");
zoneDefine[ playerid ] = 1;
}
return 1;
}

public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
if(checkpointid == CP[ 0 ])
{
UnderAttack[ 0 ] = 0;
GangZoneStopFlashForAll(gZ[ 0 ]);
KillTimer(timer[playerid][ 0 ]);
}
return 1;
}

forward SetZone(playerid);
public SetZone(playerid)
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 3);
SendClientMessage(playerid,-1,"Congrats, you captured the zone now you're able to enter the flying vehicles! ");
UnderAttack[ 0 ] = 0;
GangZoneShowForAll(gZ[ 0 ], GetPlayerColor(playerid));
KillTimer(timer[playerid][0]);
SetGangZone(playerid);
return 1;
}

forward SetGangZone(playerid);
public SetGangZone(playerid)
{
if(zoneDefine[playerid] == gZ[ 0 ])
{
GangZoneShowForAll(gZ[ 0 ],GetPlayerColor(playerid));
new string[126], pName5[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName5,sizeof(pName5));
format(string,sizeof string,"*%s has captured the airfield for team %s",pName5, gTeam[ playerid ]);
SendClientMessageToAll(-1, string);
GangZoneStopFlashForAll(gZ[ 0 ]);
cZone[ 0 ] = gTeam[ playerid ];
}
return 1;
}

Well, it compiles fine, but the error is when i enter the checkpoint it says "This zone is already captured by your team", seen in the line

if(cZone[ 0 ] == gTeam[ playerid ])

please help me to fix this...