28.07.2015, 18:49
(
Последний раз редактировалось SalmaN97; 29.07.2015 в 05:41.
)
Hello I am trying to make a turf system if a player wants to take a turf then there should be 2 or more players from same team to start capturing this thing works well but while 2 players from same team capturing incase if one player dies or leave turf area i want the capturing to stop for the other guy
so in few words if there is more than 2 players capturing should be fine but when there is less than 2 players i want the capturing stop
here is my code:
Command :
Timer and score giving:
When player leave area:
Please help
so in few words if there is more than 2 players capturing should be fine but when there is less than 2 players i want the capturing stop
here is my code:
Command :
PHP код:
CMD:tt(playerid, params[])
{
new gang[50], string[128], count;
else if(gTeam[playerid] == TEAM_BALLAS) format(gang, sizeof(gang), "Ballas");
else if(gTeam[playerid] == TEAM_GROVES) format(gang, sizeof(gang), "Groves");
else if(gTeam[playerid] == TEAM_VAGOS) format(gang, sizeof(gang), "Vagos");
if(IsPlayerInDynamicArea(playerid, TurfArea[SantaMariaBeach]))
{
foreach(new i : Player)
{if(IsPlayerInDynamicArea(i, TurfArea[SantaMariaBeach]) && gTeam[i] == gTeam[playerid]) count++;}
if(TeamCheck[SantaMariaBeach] == gTeam[playerid]) return SendClientMessage(playerid, -1,"{FFD443}[ TurfWar ]: {FFE797}This Turf Is Already Captured By Your Gang.");
if(count <=1) return SendClientMessage(playerid, -1,"{FF0000}[ TurfWar ]: {FFCCCC}You Need Atleast One Gang Member To Help You Capturing The Turf!");
if(aDuty[playerid] == 1) return SendClientMessage(playerid, -1,"{FF0000}[ TurfWar ]: {FFCCCC}You Cant Capture A Turf While OnDuty!");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1,"{FF0000}[ TurfWar ]: {FFCCCC}You Cannot Capture A Turf While In Vehicle!");
if(zUnderAttack[SantaMariaBeach] == 0)
{
zUnderAttack[SantaMariaBeach] = 1;
IsPlayerCapturing[playerid] = 1;
PlayerTextDrawShow(playerid, Bar);
ProgBarTimer[playerid] = SetTimerEx("tProgressbarTimer",1000,true,"i", playerid);
GangZoneFlashForAll(GangZone[SantaMariaBeach],GetPlayerColor(playerid));
format(string, sizeof(string), "Beach' is being TakenBy %s Gang.", gang);
SendClientMessageToAll(-1, string);
ZoneDefine[playerid] = Beach;
}
}
}
PHP код:
public ProgressTimer(playerid)
{
captureTime[playerid] += 1000;
if(captureTime[playerid]== 1000)
{
PlayerTextDrawSetString(playerid, Bar, "l");
}
else if(captureTime[playerid]== 2000)
{
PlayerTextDrawSetString(playerid, Bar, "ll");
}
else if(captureTime[playerid]== 3000)
{
PlayerTextDrawSetString(playerid, Bar, "lll");
}
else if(captureTime[playerid]== 4000)
{
PlayerTextDrawSetString(playerid, Bar, "llll");
}
else if(captureTime[playerid] == 5000)
{
PlayerTextDrawSetString(playerid, Bar, "lllll");
}
else if(captureTime[playerid]== 6000)
{
PlayerTextDrawSetString(playerid, Bar, "llllll");
}
else if(captureTime[playerid]== 7000)
{
PlayerTextDrawSetString(playerid, Bar, "lllllll");
}
else if(captureTime[playerid]== 8000)
{
PlayerTextDrawSetString(playerid, Bar, "llllllll");
}
else if(captureTime[playerid]== 9000)
{
PlayerTextDrawSetString(playerid, Bar, "lllllllll");
}
else if(captureTime[playerid]== 10000)
{
PlayerTextDrawSetString(playerid, Bar, "llllllllll");
}
else if(captureTime[playerid]== 11000)
{
PlayerTextDrawSetString(playerid, Bar, "lllllllllll");
}
else if(captureTime[playerid]== 12000)
{
PlayerTextDrawSetString(playerid, Bar, "llllllllllll");
}
else if(captureTime[playerid]== 13000)
{
PlayerTextDrawSetString(playerid, Bar, "lllllllllllll");
}
else if(captureTime[playerid]== 14000)
{
PlayerTextDrawSetString(playerid, Bar, "llllllllllllll");
}
else if(captureTime[playerid]== 15000)
{
PlayerTextDrawSetString(playerid, Bar, "lllllllllllllll");
}
else if(captureTime[playerid]== 16000)
{
PlayerTextDrawSetString(playerid, Bar, "llllllllllllllll");
}
else if(captureTime[playerid]== 17000)
{
PlayerTextDrawSetString(playerid, Bar, "lllllllllllllllll");
}
else if(captureTime[playerid]== 18000)
{
PlayerTextDrawSetString(playerid, Bar, "llllllllllllllllll");
}
else if(captureTime[playerid]== 19000)
{
PlayerTextDrawSetString(playerid, Bar, "lllllllllllllllllll");
}
else if(captureTime[playerid] == 20000)
{
PlayerTextDrawSetString(playerid, Bar, "llllllllllllllllllll");
}
else if(captureTime[playerid]== 21000)
{
PlayerTextDrawSetString(playerid, Bar, "lllllllllllllllllllll");
}
else if(captureTime[playerid]== 22000)
{
PlayerTextDrawSetString(playerid, Bar, "llllllllllllllllllllll");
}
else if(captureTime[playerid]== 23000)
{
PlayerTextDrawSetString(playerid, Bar, "lllllllllllllllllllllll");
}
else if(captureTime[playerid]== 24000)
{
PlayerTextDrawSetString(playerid, Bar, "llllllllllllllllllllllll");
}
else if(captureTime[playerid]== 25000)
{
PlayerTextDrawSetString(playerid, Bar, "lllllllllllllllllllllllll");
}
else if(captureTime[playerid]== 26000)
{
PlayerTextDrawSetString(playerid, Bar, "llllllllllllllllllllllllll");
}
else if(captureTime[playerid]== 27000)
{
PlayerTextDrawSetString(playerid, Bar, "lllllllllllllllllllllllllll");
}
else if(captureTime[playerid]== 28000)
{
PlayerTextDrawSetString(playerid, Bar, "llllllllllllllllllllllllllll");
}
else if(captureTime[playerid]== 29000)
{
PlayerTextDrawSetString(playerid, Bar, "lllllllllllllllllllllllllllll");
}
else if(captureTime[playerid]== 30000)
{
PlayerTextDrawSetString(playerid, Bar, " ");
PlayerTextDrawHide(playerid, Bar);
captureTime[playerid]= 0;
//The finish code here:
foreach(new i : Player)
{
if(gTeam[i] == gTeam[playerid])
{
SetPlayerScore(i, GetPlayerScore(i) + 5); //Giving score and money
GivePlayerMoney(i, 5000);
SendClientMessage(playerid,-1,"You get 5 scores and 5000!");
}
}
KillTimer(ZoneTimer[playerid][SBeach]);
KillTimer(Bar[playerid]);
SetGangZone(playerid);
}
return 1;
}
PHP код:
public OnPlayerLeaveDynamicArea(playerid, areaid)
{
foreach(new i : Player)
if(areaid == TurfArea[Beach])
{
new count;
{if(IsPlayerInDynamicArea(i, TurfArea[Beach]) && gTeam[i] == gTeam[playerid])count++;}
if(UnderAttack[Beach] == 1 && (count <=1))
{
UnderAttack[Beach] = 0;
GangZoneStopFlashForAll(GangZone[Beach]);
KillTimer(Bar[i]);
KillTimer(ZoneTimer[i][Beach]);
captureTime[i]= 0;
PlayerTextDrawSetString(playerid, Bar, " ");
PlayerTextDrawHide(playerid, Bar);
SendClientMessage(playerid, -1,"Turf attack cancled");
}
return 1;
}