Guest User

Untitled

a guest
Apr 29th, 2018
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.58 KB | None | 0 0
  1. YCMD:attack(playerid, params[], help)
  2. {
  3. if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
  4. new hour,minn,sec,y,m,d;
  5. gettime(hour,minn,sec);
  6. getdate(y,m,d);
  7. if(IsPlayerConnected(playerid))
  8. {
  9. if(!IsAMember(playerid))
  10. return SCM(playerid,COLOR_WHITE,"You are not a member of a mafia.");
  11.  
  12. if(PlayerInfo[playerid][pRank] < 4)
  13. return SCM(playerid,COLOR_WHITE,"You don't have rank 4.");
  14.  
  15. new turf,faction,string[128],sendername[MAX_PLAYER_NAME];
  16. for(new i = 1; i <= sizeof(TurfInfo); i++)
  17. {
  18. if(IsPlayerInTurf(playerid, i) == 1)
  19. {
  20. turf = i;
  21. break;
  22. }
  23. }
  24. GetPlayerName(playerid, sendername, sizeof(sendername));
  25. if(turf == 0) return SCM(playerid, COLOR_WHITE, "You are not on a turf.");
  26. if(DeelayWar[PlayerInfo[playerid][pMember]] > 0)
  27. {
  28. format(string,sizeof(string),"Your mafia can attack another turf in %d seconds.",DeelayWar[PlayerInfo[playerid][pMember]]);
  29. SendClientMessage(playerid, COLOR_WHITE, string);
  30. return 1;
  31. }
  32. faction = PlayerInfo[playerid][pMember];
  33. if(TurfInfo[turf][zOwned] == faction) return SCM(playerid, COLOR_WHITE, "You can't attack your own turf.");
  34. if(WarInfo[turf][wAttacker] != 0) return SCM(playerid, COLOR_WHITE, "Turf is already attacked.");
  35. if(InWar[faction] == 1) return SCM(playerid, COLOR_WHITE, "You have an active war.");
  36. if(InWar[TurfInfo[turf][zOwned]] == 1) return SCM(playerid, COLOR_WHITE, "This mafia have active war.");
  37. new memberss;
  38. foreach(new i : Player)
  39. {
  40. if(IsPlayerConnected(i))
  41. {
  42. if(PlayerInfo[i][pMember] == TurfInfo[turf][zOwned])
  43. {
  44. memberss ++;
  45. }
  46. }
  47. }
  48. if(memberss < 1) return SCM(playerid, COLOR_WHITE, "This mafia don't have members online.");
  49. WarInfo[turf][wTime] = 1200;
  50. WarInfo[turf][wAttacker] = faction;
  51. WarInfo[turf][wFaction] = TurfInfo[turf][zOwned];
  52. format(string,sizeof(string),"{008080}(War) {FFFFFF}%s from your group attacked turf %d (owned by %s).",sendername,turf,NumeFactiune(TurfInfo[turf][zOwned]));
  53. SendFactionMessage(faction,COLOR_GREEN,string);
  54. format(string,sizeof(string),"{008080}(War) {FFFFFF}%s from %s attacked turf %d owned by you.",sendername,NumeFactiune(WarInfo[turf][wAttacker]),turf);
  55. SendFactionMessage(TurfInfo[turf][zOwned],COLOR_GREEN,string);
  56. new Cache: abs = mysql_query(SQL, "SELECT * FROM wars");
  57. new warid = cache_get_row_count() + 1;
  58. cache_delete(abs);
  59. format(string, sizeof(string),"{008080}(War) {FFFFFF} group %s started a war with group %s [warid: %d].",NumeFactiune(WarInfo[turf][wAttacker]),NumeFactiune(TurfInfo[turf][zOwned]),warid);
  60. ABroadCast(COLOR_ADMCOMMANDS,string,1);
  61. foreach(new i : Player)
  62. {
  63. if(PlayerInfo[i][pMember] == TurfInfo[turf][zOwned] || PlayerInfo[i][pMember] == WarInfo[turf][wAttacker])
  64. {
  65. SetPlayerVirtualWorld(i, 1024);
  66. SendClientMessage(i, COLOR_YELLOW, "{008080}(War) {FFFFFF}Ai fost teleportat intr-un Virtual World unde sunt prezenti doar jucatorii ce participa la war.");
  67. }
  68. }
  69. if(WarInfo[turf][wAttacker] == 4 || TurfInfo[turf][zOwned] == 4)
  70. {
  71. for(new x = 0; x < sizeof(VehicleInfo); x++)
  72. {
  73. if(VehicleInfo[x][vehGroup] == 4)
  74. {
  75. SetVehicleVirtualWorld(VehicleInfo[x][vehCarID], 1024);
  76. }
  77. }
  78. }
  79. if(WarInfo[turf][wAttacker] == 5 || TurfInfo[turf][zOwned] == 5)
  80. {
  81. for(new x = 0; x < sizeof(VehicleInfo); x++)
  82. {
  83. if(VehicleInfo[x][vehGroup] == 5)
  84. {
  85. SetVehicleVirtualWorld(VehicleInfo[x][vehCarID], 1024);
  86. }
  87. }
  88. }
  89. if(WarInfo[turf][wAttacker] == 6 || TurfInfo[turf][zOwned] == 6)
  90. {
  91. for(new x = 0; x < sizeof(VehicleInfo); x++)
  92. {
  93. if(VehicleInfo[x][vehGroup] == 6)
  94. {
  95. SetVehicleVirtualWorld(VehicleInfo[x][vehCarID], 1024);
  96. }
  97. }
  98. }
  99. if(WarInfo[turf][wAttacker] == 10 || TurfInfo[turf][zOwned] == 10)
  100. {
  101. for(new x = 0; x < sizeof(VehicleInfo); x++)
  102. {
  103. if(VehicleInfo[x][vehGroup] == 10)
  104. {
  105. SetVehicleVirtualWorld(VehicleInfo[x][vehCarID], 1024);
  106. }
  107. }
  108. }
  109. worstscoreat[turf] = 0;
  110. worstmemberat[turf] = 999;
  111. bestscoreat[turf] = 0;
  112. bestmemberat[turf] = 999;
  113. worstscoredf[turf] = 0;
  114. worstmemberdf[turf] = 999;
  115. bestscoredf[turf] = 0;
  116. bestmemberdf[turf] = 999;
  117. InWar[TurfInfo[turf][zOwned]] = 1;
  118. InWar[faction] = 1;
  119. waitwar[faction] = 60;
  120. }
  121. return 1;
  122. }
  123. enum zInfo
  124. {
  125. zID,
  126. zOwned,
  127. Float:zMinX,
  128. Float:zMinY,
  129. Float:zMaxX,
  130. Float:zMaxY
  131. };
  132. new TurfInfo[50][zInfo],
  133. Turfs[50];
  134. enum wInfo
  135. {
  136. wFaction,
  137. wAttacker,
  138. wTime,
  139. };
  140. new WarInfo[sizeof(TurfInfo)][wInfo],
Advertisement
Add Comment
Please, Sign In to add comment