Cap Zones -
Insulin - 31.03.2013
So i made this script for capture zones,
pawn Код:
//===============================[POWER]==========================================
stock ActivePOWER(playerid)
{
if(Spectating[playerid] == 0 || PlayerInfo[playerid][OnDuty] == 0)
{
if(UnderAttack[POWER] == 0)
{
if(!IsPlayerInAnyVehicle(playerid))
{
UnderAttack[POWER] = 1;
timer[playerid][POWER] = SetTimerEx("POWER", 25000, false,"i",playerid);
Captured[playerid][POWER] = 0;
SendClientMessage(playerid, 0xFFFFFFFF,"| - Stay in this checkpoint for 25 seconds to capture! - |");
PlayAudioStreamForPlayer(playerid, "http://files.mboxdrive.com/100000435279790/capturing.MP3");
if(gTeam[playerid] == TEAM_EURASIA)
{
GangZoneFlashForAll(Zone[POWER], TEAM_ZONE_EURASIA_COLOR);
}
else if(gTeam[playerid] == TEAM_ARAB)
{
GangZoneFlashForAll(Zone[POWER], TEAM_ZONE_ARAB_COLOR);
}
else if(gTeam[playerid] == TEAM_SOVIET)
{
GangZoneFlashForAll(Zone[POWER], TEAM_ZONE_SOVIET_COLOR);
}
else if(gTeam[playerid] == TEAM_USA)
{
GangZoneFlashForAll(Zone[POWER], TEAM_ZONE_USA_COLOR);
}
else if(gTeam[playerid] == TEAM_AUS)
{
GangZoneFlashForAll(Zone[POWER], TEAM_ZONE_AUS_COLOR);
}
//------Message-----
if(tCP[POWER] == TEAM_EURASIA)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<EURASIA>");
SendTeamMessage(TEAM_EURASIA, green,"*Power House is under attack!");
}
else if(tCP[POWER] == TEAM_ARAB)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<ARAB>");
SendTeamMessage(TEAM_ARAB, green,"*Power House is under attack!");
}
else if(tCP[POWER] == TEAM_SOVIET)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<SOVIET>");
SendTeamMessage(TEAM_SOVIET, green,"*Power House is under attack!");
}
else if(tCP[POWER] == TEAM_USA)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<USA>");
SendTeamMessage(TEAM_USA, green,"*Power House is under attack!");
}
else if(tCP[POWER] == TEAM_AUS)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<AUSTRALIA>");
SendTeamMessage(TEAM_AUS, green,"*Power House is under attack!");
}
else if(tCP[POWER] == TEAM_NONE)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is not controlled by any team");
}
//---------loop-------//
for(new i = 0; i < MAX_PLAYERS; i ++)
{
IsPlayerCapturing[i][POWER] = 1;
}
}
else return CaptureZoneMessage(playerid, 1);
}
else return CaptureZoneMessage(playerid, 2);
}
else return CaptureZoneMessage(playerid, 3);
return 1;
}
stock POWERCaptured(playerid)
{
Captured[playerid][POWER] = 1;
UnderAttack[POWER] = 0;
KillTimer(timer[playerid][POWER]);
TextDrawHideForPlayer(playerid, CountText[playerid]);
CountVar[playerid][POWER] = 25;
GivePlayerScore(playerid, 3);
GivePlayerMoney(playerid, 5000);
SendClientMessage(playerid, green,"Congratulations! You have captured \"POWER\" you received +3 scores and +$5000 cash!");
PlayAudioStreamForPlayer(playerid, "http://files.mboxdrive.com/100000435279790/Captured%20success.MP3");
//==========================================================================
for(new i = 0; i < MAX_PLAYERS; i++)
{
IsPlayerCapturing[i][POWER] = 0;
if(gTeam[i] == gTeam[playerid] && i != playerid && PlayerInfo[i][OnDuty] == 0)
{
SendClientMessage(i, 0xFFFFFFFF,"*Your team has captured "cred"POWER"cwhite"! You received +1 score for it!");
GivePlayerScore(i, 1);
}
}
//==========================================================================
tCP[POWER] = gTeam[playerid];
GangZoneStopFlashForAll(Zone[POWER]);
//==========================================================================
if(gTeam[playerid] == TEAM_EURASIA)
{
GangZoneShowForAll(Zone[POWER], TEAM_ZONE_EURASIA_COLOR);
}
else if(gTeam[playerid] == TEAM_ARAB)
{
GangZoneShowForAll(Zone[POWER], TEAM_ZONE_ARAB_COLOR);
}
else if(gTeam[playerid] == TEAM_SOVIET)
{
GangZoneShowForAll(Zone[POWER], TEAM_ZONE_SOVIET_COLOR);
}
else if(gTeam[playerid] == TEAM_USA)
{
GangZoneShowForAll(Zone[POWER], TEAM_ZONE_USA_COLOR);
}
else if(gTeam[playerid] == TEAM_AUS)
{
GangZoneShowForAll(Zone[POWER], TEAM_ZONE_AUS_COLOR);
}
//==========================================================================
new str[128];
format(str, sizeof(str),"%s has captured \"POWER\" for team %s", pName(playerid), GetTeamName(playerid));
SendClientMessageToAll(orange, str);
return 1;
}
stock LeavingPower(playerid)
{
Captured[playerid][POWER] = 1;
UnderAttack[POWER] = 0;
KillTimer(timer[playerid][POWER]);
TextDrawHideForPlayer(playerid, CountText[playerid]);
CountVar[playerid][POWER] = 25;
GangZoneStopFlashForAll(Zone[POWER]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
IsPlayerCapturing[i][POWER] = 0;
}
SendClientMessage(playerid, red,"*You have been failed to capture this zone!");
PlayAudioStreamForPlayer(playerid, "http://files.mboxdrive.com/100000435279790/failed%20capture.MP3");
return 1;
}
forward POWER(playerid);
public POWER(playerid)
{
POWERCaptured(playerid);
return 1;
}
and it worked fine, later i wanted to add one more capture zone so i changed it's name to this
pawn Код:
//===============================[LVA]==========================================
stock ActiveLVA(playerid)
{
if(Spectating[playerid] == 0 || PlayerInfo[playerid][OnDuty] == 0)
{
if(UnderAttack[LVA] == 0)
{
if(!IsPlayerInAnyVehicle(playerid))
{
UnderAttack[LVA] = 1;
timer[playerid][LVA] = SetTimerEx("LVA", 25000, false,"i",playerid);
Captured[playerid][LVA] = 0;
SendClientMessage(playerid, 0xFFFFFFFF,"| - Stay in this checkpoint for 25 seconds to capture! - |");
PlayAudioStreamForPlayer(playerid, "http://files.mboxdrive.com/100000435279790/capturing.MP3");
if(gTeam[playerid] == TEAM_EURASIA)
{
GangZoneFlashForAll(Zone[LVA], TEAM_ZONE_EURASIA_COLOR);
}
else if(gTeam[playerid] == TEAM_ARAB)
{
GangZoneFlashForAll(Zone[LVA], TEAM_ZONE_ARAB_COLOR);
}
else if(gTeam[playerid] == TEAM_SOVIET)
{
GangZoneFlashForAll(Zone[LVA], TEAM_ZONE_SOVIET_COLOR);
}
else if(gTeam[playerid] == TEAM_USA)
{
GangZoneFlashForAll(Zone[LVA], TEAM_ZONE_USA_COLOR);
}
else if(gTeam[playerid] == TEAM_AUS)
{
GangZoneFlashForAll(Zone[LVA], TEAM_ZONE_AUS_COLOR);
}
//------Message-----
if(tCP[LVA] == TEAM_EURASIA)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<EURASIA>");
SendTeamMessage(TEAM_EURASIA, green,"*LVA House is under attack!");
}
else if(tCP[LVA] == TEAM_ARAB)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<ARAB>");
SendTeamMessage(TEAM_ARAB, green,"*LVA House is under attack!");
}
else if(tCP[LVA] == TEAM_SOVIET)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<SOVIET>");
SendTeamMessage(TEAM_SOVIET, green,"*LVA House is under attack!");
}
else if(tCP[LVA] == TEAM_USA)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<USA>");
SendTeamMessage(TEAM_USA, green,"*LVA House is under attack!");
}
else if(tCP[LVA] == TEAM_AUS)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<AUSTRALIA>");
SendTeamMessage(TEAM_AUS, green,"*LVA House is under attack!");
}
else if(tCP[LVA] == TEAM_NONE)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is not controlled by any team");
}
//---------loop-------//
for(new i = 0; i < MAX_PLAYERS; i ++)
{
IsPlayerCapturing[i][LVA] = 1;
}
}
else return CaptureZoneMessage(playerid, 1);
}
else return CaptureZoneMessage(playerid, 2);
}
else return CaptureZoneMessage(playerid, 3);
return 1;
}
stock LVACaptured(playerid)
{
Captured[playerid][LVA] = 1;
UnderAttack[LVA] = 0;
KillTimer(timer[playerid][LVA]);
TextDrawHideForPlayer(playerid, CountText[playerid]);
CountVar[playerid][LVA] = 25;
GivePlayerScore(playerid, 3);
GivePlayerMoney(playerid, 5000);
SendClientMessage(playerid, green,"Congratulations! You have captured \"LVA\" you received +3 scores and +$5000 cash!");
PlayAudioStreamForPlayer(playerid, "http://files.mboxdrive.com/100000435279790/Captured%20success.MP3");
//==========================================================================
for(new i = 0; i < MAX_PLAYERS; i++)
{
IsPlayerCapturing[i][LVA] = 0;
if(gTeam[i] == gTeam[playerid] && i != playerid && PlayerInfo[i][OnDuty] == 0)
{
SendClientMessage(i, 0xFFFFFFFF,"*Your team has captured "cred"LVA"cwhite"! You received +1 score for it!");
GivePlayerScore(i, 1);
}
}
//==========================================================================
tCP[LVA] = gTeam[playerid];
GangZoneStopFlashForAll(Zone[LVA]);
//==========================================================================
if(gTeam[playerid] == TEAM_EURASIA)
{
GangZoneShowForAll(Zone[LVA], TEAM_ZONE_EURASIA_COLOR);
}
else if(gTeam[playerid] == TEAM_ARAB)
{
GangZoneShowForAll(Zone[LVA], TEAM_ZONE_ARAB_COLOR);
}
else if(gTeam[playerid] == TEAM_SOVIET)
{
GangZoneShowForAll(Zone[LVA], TEAM_ZONE_SOVIET_COLOR);
}
else if(gTeam[playerid] == TEAM_USA)
{
GangZoneShowForAll(Zone[LVA], TEAM_ZONE_USA_COLOR);
}
else if(gTeam[playerid] == TEAM_AUS)
{
GangZoneShowForAll(Zone[LVA], TEAM_ZONE_AUS_COLOR);
}
//==========================================================================
new str[128];
format(str, sizeof(str),"%s has captured \"LVA\" for team %s", pName(playerid), GetTeamName(playerid));
SendClientMessageToAll(orange, str);
return 1;
}
stock LeavingLvA(playerid)
{
Captured[playerid][LVA] = 1;
UnderAttack[LVA] = 0;
KillTimer(timer[playerid][LVA]);
TextDrawHideForPlayer(playerid, CountText[playerid]);
CountVar[playerid][LVA] = 25;
GangZoneStopFlashForAll(Zone[LVA]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
IsPlayerCapturing[i][LVA] = 0;
}
SendClientMessage(playerid, red,"*You have been failed to capture this zone!");
PlayAudioStreamForPlayer(playerid, "http://files.mboxdrive.com/100000435279790/failed%20capture.MP3");
return 1;
}
forward LVA(playerid);
public LVA(playerid)
{
LVACaptured(playerid);
return 1;
}
but when i compiles i got this error
Код:
C:\Users\user\Desktop\codww.pwn(7694) : error 010: invalid function or declaration
C:\Users\user\Desktop\codww.pwn(7695) : error 001: expected token: "-identifier-", but found "-integer value-"
Re: Cap Zones -
Insulin - 01.04.2013
please some one help!