Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. new WarTime; // Variável onde ficará armazenado o tempo de guerra
  2. new TimerGuerra; // Serve depois pra interromper o timer criado com o comando /guerra
  3. new gHour, gMins, gSecs, smalltext[20];
  4.  
  5. new Float:GuerraMinX;
  6. new Float:GuerraMinY;
  7. new Float:GuerraMaxX;
  8. new Float:GuerraMaxY;
  9.  
  10. new Text:GuerraG[MAX_PLAYERS];
  11. new TempoGuerra;
  12.  
  13.  
  14. HourMinSecs(number)
  15. {
  16. gHour = floatround(number / (60 * 60));
  17. gMins = floatround((number / 60) - (gHour * 60));
  18. gSecs = number % 60;
  19. format(smalltext, 10, "%02d:%02d:%02d", gHour, gMins, gSecs);
  20. return smalltext;
  21. }
  22.  
  23. forward tGuerra();
  24. public tGuerra()
  25. {
  26. WarTime--;
  27. if(WarTime == 0)
  28. {
  29. SendClientMesasge(playerid, COLOR_GRAD1, " A guerra acabou.");
  30. WarTime = 0;
  31. KillTimer(TimerGuerra);// Adicione uma função para acabar a guerra
  32. }
  33. return 1;
  34. }
  35.  
  36.  
  37. if(strcmp(cmd, "/guerra", true) == 0)
  38. {
  39. if(IsPlayerConnected(playerid))
  40. {
  41. if(PlayerInfo[playerid][pJailed] != 0)
  42. {
  43. SendClientMessage(playerid,CINZA," Você não pode criar guerra na cadeia!");
  44. return true;
  45. }
  46. if(TendoGuerra >= 1)
  47. {
  48. SendClientMessage(playerid, CINZA, " Já está tendo uma guerra!");
  49. return true;
  50. }/*
  51. new x_EmpregoG2[32];
  52. x_EmpregoG2 = strtok(cmdtext, idx);
  53. if(!strlen(x_EmpregoG2))
  54. {
  55. SendClientMessage(playerid,COLOR_GRAD1, "/GUERRA [HORAS] (de 1 a 2 Horas, Sendo que 30 é 30 Minutos )");
  56. return true;
  57. }
  58. if(strcmp(x_EmpregoG2,"30",true) == 0)
  59. {
  60. TempoGuerra = SetTimerEx("GuerraTerrorista", 30*60*1000, 0, "i", playerid);
  61. RelogioGuerraG = SetTimer("RelogioGuerra", 30*60*1000, 1);
  62. }
  63. else if(strcmp(x_EmpregoG2,"1",true) == 0)
  64. {
  65. TempoGuerra = SetTimerEx("GuerraTerrorista", 60*60*1000, 0, "i", playerid);
  66. RelogioGuerraG = SetTimer("RelogioGuerra", 60*60*1000, 1);
  67. }
  68. else if(strcmp(x_EmpregoG2,"2",true) == 0)
  69. {
  70. TempoGuerra = SetTimerEx("GuerraTerrorista", 120*60*1000, 0, "i", playerid);
  71. RelogioGuerraG = SetTimer("RelogioGuerra", 120*60*1000, 1);
  72. }*/
  73. new Float:x,Float:y,Float:z;
  74. if(PlayerInfo[playerid][pMembro] == 3 || PlayerInfo[playerid][pLider] == 3)// EXE
  75. {
  76. GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
  77. format(string, sizeof(string), "%s e o Exército iniciaram uma Guerra. Evitem a área Verde!",playername);
  78. SendClientMessageToAll(COLOR_EXE, string);
  79. GetPlayerPos(playerid,x,y,z);
  80. Territorio[MinX] = x-250;
  81. Territorio[MinY] = y-250;
  82. Territorio[MaxX] = x+250;
  83. Territorio[MaxY] = y+250;
  84. Territorio[exemortos] = 0;
  85. Territorio[talmortos] = 0;
  86. Territorio[almortos] = 0;
  87. Territorio[GImortos] = 0;
  88. GuerraMinX = x-250;
  89. GuerraMinY = y-250;
  90. GuerraMaxX = x+250;
  91. GuerraMaxY = y+250;
  92. GZGuerra = GangZoneCreate(x-250,y-250,x+250,y+250);
  93. GangZoneShowForAll(GZGuerra,COLORGZ_EXE);
  94. BPEInfo[playerid][InicioGuerra] = 1;
  95. TendoGuerra = 1;
  96. WarTime = 3600;
  97. TimerGuerra = SetTimer("tGuerra", 1000, true);
  98. }
  99. }
  100. return 1;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement