Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. CMD:attack(playerid, params[]) {
  2. if(!IsAMember(playerid)) return SendClientMessage(playerid,COLOR_GREY, "Nu faci parte dintr-o mafie.");
  3. if(PlayerInfo[playerid][pRank] < 3) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"You do not have rank 3.");
  4. new turf,string[100];
  5. for(new i = 1; i <= sizeof(TurfInfo); i++) {
  6. if(IsPlayerInTurf(playerid, i) == 1) {
  7. turf = i;
  8. break;
  9. }
  10. }
  11. new hour,minute,second, year, month, day;
  12. gettime(hour,minute,second);
  13. getdate(year, month, day);
  14. new days[180];
  15. format(days, sizeof(days), GetWeekDay(day, month, year));
  16. if(PlayerInfo[playerid][pAdmin] < 7) {
  17. if(strcmp(days,"Saturday",true) == 0 || strcmp(days,"Sunday",true) == 0) return SCM(playerid, COLOR_LIGHTRED, "Nu se dau war-uri in weekend!");
  18. if(hour == 20 || hour == 21) {}
  19. else return SendClientMessage(playerid, COLOR_LIGHTRED, "War-uri se pot da doar in intervalul 20:00 - 22:00!");
  20. if(GetFactionMembersOn2(PlayerInfo[playerid][pMember]) < 0) return SCM(playerid, COLOR_LGREEN, "Nu poti folosi aceasta comanda deoarece nu sunt minim 2 membri conectati din factiunea ta!");
  21. if(GetFactionMembersOn2(TurfInfo[turf][zOwned]) < 0) return SCM(playerid, COLOR_LGREEN, "Nu poti folosi aceasta comanda deoarece nu sunt minim 2 membri conectati din factiunea care detine teritoriul!");
  22. }
  23. if(turf == 0) return SendClientMessage(playerid, COLOR_WHITE, "Nu esti pe un teritoriu!");
  24. new faction = PlayerInfo[playerid][pMember];
  25. if(TurfInfo[turf][zOwned] == faction) return SendClientMessage(playerid, COLOR_GREY, "Nu poti ataca turful mafiei tale.");
  26. if(WarInfo[turf][wAttacker] != 0) return SendClientMessage(playerid, COLOR_WHITE, "Acest turf este deja atacat.");
  27. if(InWar[faction] == 1) return SendClientMessage(playerid, COLOR_WHITE, "Este deja un war activ.");
  28. if(InWar[TurfInfo[turf][zOwned]] == 1) return SendClientMessage(playerid, COLOR_WHITE, "Aceasta mafie are deja un war activ.");
  29. if(FactionDeelay[PlayerInfo[playerid][pMember]] != 0) {
  30. format(string, sizeof(string), "Poti folosi aceasta comanda peste %d minute (%d secunde).", FactionDeelay[PlayerInfo[playerid][pMember]]/60, FactionDeelay[PlayerInfo[playerid][pMember]]);
  31. SCM(playerid, COLOR_LGREEN, string);
  32. return 1;
  33. }
  34. format(string, sizeof(string), "[WAR] %s a atacat teritoriul %d detinut de factiunea %s.",GetName(playerid),turf,NumeFactiune(TurfInfo[turf][zOwned]));
  35. SendFactionMessage(faction,COLOR_MONEY,string);
  36. format(string, sizeof(string), "[WAR] %s (%s) a atacat teritoriul %d detinut de factiunea ta.",NumeFactiune(WarInfo[turf][wAttacker]),GetName(playerid),turf);
  37. SendFactionMessage(TurfInfo[turf][zOwned],COLOR_MONEY,string);
  38. new query[128];
  39. format(query,sizeof(query),"UPDATE `turfs` SET `Time`='24' WHERE `ID`='%d'",turf);
  40. mysql_query(SQL,query);
  41.  
  42. TurfInfo[turf][zTime] = 24;
  43. WarInfo[turf][wTime] = 1200;
  44. WarInfo[turf][wAttacker] = faction;
  45. WarInfo[turf][wFaction] = TurfInfo[turf][zOwned];
  46. worstscoreat[turf] = 0;
  47. worstmemberat[turf] = 999;
  48. bestscoreat[turf] = 0;
  49. bestmemberat[turf] = 999;
  50. worstscoredf[turf] = 0;
  51. worstmemberdf[turf] = 999;
  52. bestscoredf[turf] = 0;
  53. bestmemberdf[turf] = 999;
  54. InWar[TurfInfo[turf][zOwned]] = 1;
  55. InWar[faction] = 1;
  56.  
  57. InWarTurf[faction] = turf;
  58. InWarTurf[TurfInfo[turf][zOwned]] = turf;
  59.  
  60. foreach(Player, i) {
  61. if(IsPlayerLogged[i] == 1) {
  62. if(PlayerInfo[i][pMember] == faction || PlayerInfo[i][pMember] == TurfInfo[turf][zOwned]) UpdateVar(i, "WarTurf", turf);
  63. }
  64. }
  65.  
  66. SetVehicle(faction, turf);
  67. SetVehicle(TurfInfo[turf][zOwned], turf);
  68. return 1;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement