Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. CMD:attack(playerid, params[])
  2. {
  3. if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
  4. new hour,minn,sec;
  5. gettime(hour,minn,sec);
  6. if(IsPlayerConnected(playerid))
  7. {
  8. if(!IsAMember(playerid)) return SCM(playerid,COLOR_WHITE,"You are not a member of a mafia.");
  9. if(PlayerInfo[playerid][pRank] < 4) return SCM(playerid,COLOR_WHITE,"You don't have rank 4.");
  10. if(GetWeekDay() == 1 || GetWeekDay() == 4 || GetWeekDay() == 6) return SendClientMessage(playerid, COLOR_WHITE, "War-ul este permis doar Luni, Miercuri, Vineri si Duminica.");
  11. if(hour == 20 || hour == 21)
  12. {
  13. new turf,faction,string[128],sendername[MAX_PLAYER_NAME];
  14. for(new i = 1; i <= sizeof(TurfInfo); i++)
  15. {
  16. if(IsPlayerInTurf(playerid, i) == 1)
  17. {
  18. turf = i;
  19. break;
  20. }
  21. }
  22. GetPlayerName(playerid, sendername, sizeof(sendername));
  23. if(turf == 0) return SCM(playerid, COLOR_WHITE, "You are not on a turf.");
  24. if(DeelayWar[PlayerInfo[playerid][pMember]] > 0)
  25. {
  26. format(string,sizeof(string),"Your mafia can attack another turf in %d seconds.",DeelayWar[PlayerInfo[playerid][pMember]]);
  27. SendClientMessage(playerid, COLOR_WHITE, string);
  28. return 1;
  29. }
  30. faction = PlayerInfo[playerid][pMember];
  31. if(TurfInfo[turf][zOwned] == faction) return SCM(playerid, COLOR_WHITE, "You can't attack your own turf.");
  32. if(WarInfo[turf][wAttacker] != 0) return SCM(playerid, COLOR_WHITE, "Turf is already attacked.");
  33. if(InWar[faction] == 1) return SCM(playerid, COLOR_WHITE, "You have an active war.");
  34. if(InWar[TurfInfo[turf][zOwned]] == 1) return SCM(playerid, COLOR_WHITE, "This mafia have active war.");
  35. new memberss;
  36. foreach(Player, i)
  37. {
  38. if(IsPlayerConnected(i))
  39. {
  40. if(PlayerInfo[i][pMember] == TurfInfo[turf][zOwned])
  41. {
  42. memberss ++;
  43. }
  44. }
  45. }
  46. if(memberss < 1) return SCM(playerid, COLOR_WHITE, "This mafia don't have members online.");
  47. WarInfo[turf][wTime] = 1200;
  48. WarInfo[turf][wAttacker] = faction;
  49. WarInfo[turf][wFaction] = TurfInfo[turf][zOwned];
  50. format(string,sizeof(string),"[TURF] %s from your group attacked turf %d (owned by %s).",sendername,turf,NumeFactiune(TurfInfo[turf][zOwned]));
  51. SendFamilyMessage(faction,COLOR_GREEN,string);
  52. format(string,sizeof(string),"[TURF] %s from %s attacked turf %d owned by you.",sendername,NumeFactiune(WarInfo[turf][wAttacker]),turf);
  53. SendFamilyMessage(TurfInfo[turf][zOwned],COLOR_GREEN,string);
  54. mysql_query(SQL, "SELECT * FROM wars");
  55. mysql_store_result();
  56. new warid = mysql_num_rows() + 1;
  57. mysql_free_result();
  58. format(string, sizeof(string),"[WAR] %s started a war with %s (war id: %d).",NumeFactiune(WarInfo[turf][wAttacker]),NumeFactiune(TurfInfo[turf][zOwned]),warid);
  59. foreach(Player, i)
  60. {
  61. if(PlayerInfo[i][pMember] == TurfInfo[turf][zOwned] || PlayerInfo[i][pMember] == WarInfo[turf][wAttacker])
  62. {
  63. SetPlayerVirtualWorld(i, 1024);
  64. SendClientMessage(i, COLOR_YELLOW, "Ai fost teleportat intr-un Virtual World unde sunt prezenti doar jucatorii ce participa la war.");
  65. }
  66. }
  67. if(WarInfo[turf][wAttacker] == 4 || TurfInfo[turf][zOwned] == 4)
  68. {
  69. for(new veh; veh < sizeof(Aztecasc); veh++)
  70. {
  71. SetVehicleVirtualWorld(Aztecasc[veh], 1024);
  72. }
  73. }
  74. if(WarInfo[turf][wAttacker] == 5 || TurfInfo[turf][zOwned] == 5)
  75. {
  76. for(new veh; veh < sizeof(Grovec); veh++)
  77. {
  78. SetVehicleVirtualWorld(Grovec[veh], 1024);
  79. }
  80. }
  81. if(WarInfo[turf][wAttacker] == 6 || TurfInfo[turf][zOwned] == 6)
  82. {
  83. for(new veh; veh < sizeof(Vagosc); veh++)
  84. {
  85. SetVehicleVirtualWorld(Vagosc[veh], 1024);
  86. }
  87. }
  88. if(WarInfo[turf][wAttacker] == 10 || TurfInfo[turf][zOwned] == 10)
  89. {
  90. for(new veh; veh < sizeof(Ballasc); veh++)
  91. {
  92. SetVehicleVirtualWorld(Ballasc[veh], 1024);
  93. }
  94. }
  95. new y,m,d,h,mi,s;
  96. getdate(y,m,d);
  97. gettime(h,mi,s);
  98. worstscoreat[turf] = 0;
  99. worstmemberat[turf] = 999;
  100. bestscoreat[turf] = 0;
  101. bestmemberat[turf] = 999;
  102. worstscoredf[turf] = 0;
  103. worstmemberdf[turf] = 999;
  104. bestscoredf[turf] = 0;
  105. bestmemberdf[turf] = 999;
  106. InWar[TurfInfo[turf][zOwned]] = 1;
  107. InWar[faction] = 1;
  108. waitwar[faction] = 60;
  109. }
  110. else return SCM(playerid,COLOR_WHITE,"War must be between 20:00 and 22:00.");
  111. }
  112. return 1;
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement