Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:attack(playerid, params[])
- {
- new hour,minn,sec;
- gettime(hour,minn,sec);
- if(hour != 16) return SCM(playerid,COLOR_WHITE,"{FFB870}Error: Now you can't use this command.");
- if(!IsAMember(playerid)) return SCM(playerid,COLOR_WHITE,"{FFB870}Error: You are not a member of the Mafia.");
- if(PlayerData[playerid][pFactionRank] < 3) return SCM(playerid,TEAM_AZTECAS_COLOR,"Error: You do not have rank 3.");
- new turf,faction,string[100],sendername[MAX_PLAYER_NAME];
- for(new i = 0; i <= sizeof(TurfInfo); i++)
- {
- if(IsPlayerInTurf(playerid, i) == 0)
- {
- turf = i;
- break;
- }
- }
- GetPlayerName(playerid, sendername, sizeof(sendername));
- if(turf == -1) return SCM(playerid, TEAM_AZTECAS_COLOR, "Error: You are not on a territory.");
- faction = PlayerData[playerid][pFaction];
- if(TurfInfo[turf][zOwned] == faction) return SCM(playerid, TEAM_AZTECAS_COLOR, "Error: You can't attack your own turf.");
- printf("turfinfoturfzowned. %d", TurfInfo[turf][zOwned]);
- printf("turf. %d", turf);
- if(WarInfo[turf][wAttacker] != 0) return SCM(playerid, TEAM_AZTECAS_COLOR, "Error: Turf is already attacked.");
- if(TurfInfo[turf][zTime] > 0)
- {
- format(string,sizeof(string),"Error: Turf can be attacked in %d hours.",TurfInfo[turf][zTime]);
- SCM(playerid, TEAM_AZTECAS_COLOR,string);
- return 1;
- }
- if(InWar[faction] == 1) return SCM(playerid, TEAM_AZTECAS_COLOR, "Error: You have an active war.");
- if(InWar[TurfInfo[turf][zOwned]] == 1) return SCM(playerid, TEAM_AZTECAS_COLOR, "Error: This mafia have active war.");
- TurfInfo[turf][zTime] = 24;
- new query[128];
- format(query, sizeof(query), "UPDATE `turfs` SET `Time`='24' WHERE `ID`='%d'",turf);
- mysql_tquery(g_iHandle, query);
- WarInfo[turf][wTime] = 900;
- WarInfo[turf][wAttacker] = faction;
- WarInfo[turf][wFaction] = TurfInfo[turf][zOwned];
- format(string,sizeof(string),"Your mafia (%s) attacked turf %d owned by %s",sendername,turf,Faction_GetName(TurfInfo[turf][zOwned]));
- SendFactionMessage(faction,TEAM_AZTECAS_COLOR,string);
- format(string,sizeof(string),"Turf %d, Time remaining: %s",turf,CalculeazaTimp(WarInfo[turf][wTime]));
- SendFactionMessage(faction,TEAM_AZTECAS_COLOR,string);
- format(string,sizeof(string),"%s (%s) attacked your turf %d",Faction_GetName(WarInfo[turf][wAttacker]),sendername,turf);
- SendFactionMessage(TurfInfo[turf][zOwned],TEAM_AZTECAS_COLOR,string);
- format(string,sizeof(string),"Turf %d, Time remaining: %s",turf,CalculeazaTimp(WarInfo[turf][wTime]));
- SendFactionMessage(TurfInfo[turf][zOwned],TEAM_AZTECAS_COLOR,string);
- worstscoreat[turf] = 0;
- worstmemberat[turf] = 999;
- bestscoreat[turf] = 0;
- bestmemberat[turf] = 999;
- worstscoredf[turf] = 0;
- worstmemberdf[turf] = 999;
- bestscoredf[turf] = 0;
- bestmemberdf[turf] = 999;
- InWar[TurfInfo[turf][zOwned]] = 1;
- InWar[faction] = 1;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement