11.12.2014, 08:44
Hello SA-MP Community,I'm here with a new little problem.The problem is on my /takezone command. I want to add something to it that will interdict to you to use /takezone if the enemie leader is not online,someone could help me with this please?
Here is my code:
Here is my code:
Код:
if(strcmp(cmd,"/takezone",true)==0) { if(PlayerInfo[playerid][pLeader] == 12 || PlayerInfo[playerid][pLeader] == 13 || PlayerInfo[playerid][pLeader] == 14 || PlayerInfo[playerid][pLeader] == 15) { for(new z=0; z<sizeof(ZoneInfo); z++) { if(IsPlayerInZone(playerid,z)) { if(takezone == 1) { SendClientMessage(playerid, COLOR_GREY, "The takezone is already started!"); } else { new leader[30]; format(leader,sizeof(leader),"%s" ,ZoneInfo[GetPlayerZone(playerid)][zOwner]); #define min 30000 GetPlayerName(playerid, sendername, sizeof(sendername)); if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 12 && PlayerInfo[playerid][pLeader] == 12) { SendClientMessage(playerid, COLOR_GREY, "You can't attack your zone!"); } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 13 && PlayerInfo[playerid][pLeader] == 13) { SendClientMessage(playerid, COLOR_GREY, "You can't attack your zone!"); } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 14 && PlayerInfo[playerid][pLeader] == 14) { SendClientMessage(playerid, COLOR_GREY, "You can't attack your zone!"); } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 15 && PlayerInfo[playerid][pLeader] == 15) { SendClientMessage(playerid, COLOR_GREY, "You can't attack your zone!"); } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 16 && PlayerInfo[playerid][pLeader] == 16) { SendClientMessage(playerid, COLOR_GREY, "You can't attack your zone!"); } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 17 && PlayerInfo[playerid][pLeader] == 17) { SendClientMessage(playerid, COLOR_GREY, "You can't attack your zone!"); } if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 12 && PlayerInfo[playerid][pLeader] == 13) { if(cooldownblls == 0) { format(string, sizeof(string), " {FFFFFF}* {C21BE0}Ballas {FFFFFF}Leader %s is attacking a territory held by {05A100}Grove Street{FFFFFF}!",sendername,leader); SendClientMessageToAll(-1, string); takezone=1; ZoneInfo[z][zTakeOn] = 1; GangZoneFlashForAll(GetPlayerZone(playerid), COLOR_RED); timerbllsgst=SetTimer("bllsgst",min*20,0); bllsvsgst = 1; cooldownblls = 21600; } else { format(string, 128, " Ballas has cooldown. Must wait 6 hours (%d seconds).",cooldownblls); SendClientMessage(playerid,COLOR_GREY, string); } } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 12 && PlayerInfo[playerid][pLeader] == 14) { if(cooldownlsv == 0) { format(string, sizeof(string), " {FFFFFF}* {F2EB16}Los Santos Vagos {FFFFFF}Leader %s is attacking a territory held by {05A100}Grove Street{FFFFFF}!",sendername,leader); SendClientMessageToAll( -1, string); takezone=1; ZoneInfo[z][zTakeOn] = 1; GangZoneFlashForAll(GetPlayerZone(playerid), COLOR_RED); timerlsvgst=SetTimer("lsvgst",min*20,0); lsvvsgst = 1; cooldownlsv = 21600; } else { format(string, 128, " Los Santos Vagos has cooldown. Must wait 6 hours (%d seconds).",cooldownlsv); SendClientMessage(playerid,COLOR_GREY, string); } } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 12 && PlayerInfo[playerid][pLeader] == 15) { SendClientMessage(playerid, COLOR_GREY,"Your faction is in an alliance with Grove Street!"); } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 13 && PlayerInfo[playerid][pLeader] == 12) { if(cooldowngst == 0) { format(string, sizeof(string), " {FFFFFF}* {05A100}Grove Street {FFFFFF}Leader %s is attacking a territory held by {C21BE0}Ballas{FFFFFF}!",sendername,leader); SendClientMessageToAll( -1, string); takezone=1; ZoneInfo[z][zTakeOn] = 1; GangZoneFlashForAll(GetPlayerZone(playerid), COLOR_RED); timergstblls=SetTimer("gstblls",min*20,0); cooldowngst = 21600; bllsvsgst = 1; } else { format(string, 128, " Grove Street has cooldown. Must wait 6 hours (%d seconds).",cooldowngst); SendClientMessage(playerid,COLOR_GREY, string); } } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 13 && PlayerInfo[playerid][pLeader] == 14) { SendClientMessage(playerid, COLOR_GREY," Your faction is in an alliance with Ballas!"); } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 13 && PlayerInfo[playerid][pLeader] == 15) { if(cooldownvla == 0) { format(string, sizeof(string), " {FFFFFF}* {00F2FF}Varrios Los Aztecas {FFFFFF}Leader %s is attacking a territory held by {C21BE0}Ballas{FFFFFF}!",sendername,leader); SendClientMessageToAll( -1, string); takezone=1; ZoneInfo[z][zTakeOn] = 1; GangZoneFlashForAll(GetPlayerZone(playerid), COLOR_RED); timervlablls=SetTimer("vlablls",min*20,0); vlavsblls = 1; cooldownvla = 21600; } else { format(string, 128, " Varrios Los Aztecas has cooldown. Must wait 6 hours (%d seconds).",cooldownvla); SendClientMessage(playerid,COLOR_GREY, string); } } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 14 && PlayerInfo[playerid][pLeader] == 12) { if(cooldowngst == 0) { format(string, sizeof(string), " {FFFFFF}* {05A100}Grove Street {FFFFFF}Leader %s is attacking a territory held by {F2EB16}Los Santos Vagos{FFFFFF}!",sendername,leader); SendClientMessageToAll( -1, string); takezone=1; ZoneInfo[z][zTakeOn] = 1; GangZoneFlashForAll(GetPlayerZone(playerid), COLOR_RED); timergstlsv=SetTimer("gstlsv",min*20,0); cooldowngst = 21600; lsvvsgst = 1; } else { format(string, 128, " Grove Street has cooldown. Must wait 6 hours (%d seconds).",cooldowngst); SendClientMessage(playerid,COLOR_GREY, string); } } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 14 && PlayerInfo[playerid][pLeader] == 13) { SendClientMessage(playerid, COLOR_GREY,"Your faction is in an alliance with Los Santos Vagos!"); } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 14 && PlayerInfo[playerid][pLeader] == 15) { if(cooldownvla == 0) { format(string, sizeof(string), " {FFFFFF}* {00F2FF}Varrios Los Aztecas {FFFFFF}Leader %s is attacking a territory held by {F2EB16}Los Santos Vagos{FFFFFF}!",sendername,leader); SendClientMessageToAll( -1, string); takezone=1; ZoneInfo[z][zTakeOn] = 1; GangZoneFlashForAll(GetPlayerZone(playerid), COLOR_RED); timervlalsv=SetTimer("vlalsv",min*20,0); cooldownvla = 21600; vlavslsv = 1; } else { format(string, 128, " Varrios Los Aztecas has cooldown. Must wait 6 hours (%d seconds).",cooldownvla); SendClientMessage(playerid,COLOR_GREY, string); } } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 15 && PlayerInfo[playerid][pLeader] == 12) { SendClientMessage(playerid, COLOR_GREY,"Your faction is in an alliance with Varrios Los Aztecas!"); } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 15 && PlayerInfo[playerid][pLeader] == 13) { if(cooldownblls == 0) { format(string, sizeof(string), " {FFFFFF}* {C21BE0}Ballas {FFFFFF}Leader %s is attacking a territory held by {00F2FF}Varrios Los Aztecas{FFFFFF}!",sendername,leader); SendClientMessageToAll( -1, string); takezone=1; ZoneInfo[z][zTakeOn] = 1; GangZoneFlashForAll(GetPlayerZone(playerid), COLOR_RED); timerbllsvla=SetTimer("bllsvla",min*20,0); cooldownblls = 21600; vlavsblls = 1; } else { format(string, 128, " Ballas has cooldown. Must wait 6 hours (%d seconds).",cooldownblls); SendClientMessage(playerid,COLOR_GREY, string); } } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 15 && PlayerInfo[playerid][pLeader] == 14) { if(cooldownlsv == 0) { format(string, sizeof(string), " {FFFFFF}* {F2EB16}Los Santos Vagos {FFFFFF}Leader %s is attacking a territory held by {00F2FF}Varrios Los Aztecas{FFFFFF}!",sendername,leader); SendClientMessageToAll( -1, string); takezone=1; ZoneInfo[z][zTakeOn] = 1; GangZoneFlashForAll(GetPlayerZone(playerid), COLOR_RED); timerlsvvla=SetTimer("lsvvla",min*20,0); cooldownlsv = 21600; vlavslsv = 1; } else { format(string, 128, " Los Santos Vagos has cooldown. Must wait 6 hours (%d seconds).",cooldownlsv); SendClientMessage(playerid,COLOR_GREY, string); } } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 16 && PlayerInfo[playerid][pLeader] == 17) { if(cooldownsfr == 0) { format(string, sizeof(string), " {FFFFFF}* {40B3BF}San Fierro Rifa {FFFFFF}Leader %s is attacking a territory held by {B79648}Da Nang Boys{FFFFFF}!",sendername,leader); SendClientMessageToAll( -1, string); takezone=1; ZoneInfo[z][zTakeOn] = 1; GangZoneFlashForAll(GetPlayerZone(playerid), COLOR_RED); timersfrdnb=SetTimer("sfrdnb",min*20,0); cooldownsfr = 21600; dnbvssfr = 1; } else { format(string, 128, " San Fierro Rifa has cooldown. Must wait 6 hours (%d seconds).",cooldownsfr); SendClientMessage(playerid,COLOR_GREY, string); } } else if(ZoneInfo[GetPlayerZone(playerid)][zTeam] == 17 && PlayerInfo[playerid][pLeader] == 16) { if(cooldowndnb == 0) { format(string, sizeof(string), " {FFFFFF}* {B79648}Da Nang Boys {FFFFFF}Leader %s is attacking a territory held by {40B3BF}San Fierro Rifa{FFFFFF}!",sendername,leader); SendClientMessageToAll( -1, string); takezone=1; ZoneInfo[z][zTakeOn] = 1; GangZoneFlashForAll(GetPlayerZone(playerid), COLOR_RED); timerdnbsfr=SetTimer("dnbsfr",min*20,0); cooldowndnb = 21600; dnbvssfr = 1; } else { format(string, 128, " Da Nang Boys has cooldown. Must wait 6 hours (%d seconds).",cooldowndnb); SendClientMessage(playerid,COLOR_GREY, string); } } } } } } else SCM(playerid, COLOR_GRAD1, " You are not a Gang Leader!"); return 1; }