Advertisement
Guest User

Untitled

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