Advertisement
Custura

Untitled

Apr 11th, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. CMD:attack(playerid, params[])
  2. {
  3. new hour,minn,sec;
  4. gettime(hour,minn,sec);
  5. if(hour != 16) return SCM(playerid,COLOR_WHITE,"{FFB870}Error: Now you can't use this command.");
  6. if(!IsAMember(playerid)) return SCM(playerid,COLOR_WHITE,"{FFB870}Error: You are not a member of the Mafia.");
  7. if(PlayerData[playerid][pFactionRank] < 3) return SCM(playerid,TEAM_AZTECAS_COLOR,"Error: You do not have rank 3.");
  8. new turf,faction,string[100],sendername[MAX_PLAYER_NAME];
  9. for(new i = 0; i <= sizeof(TurfInfo); i++)
  10. {
  11. if(IsPlayerInTurf(playerid, i) == 0)
  12. {
  13. turf = i;
  14. break;
  15. }
  16. }
  17. GetPlayerName(playerid, sendername, sizeof(sendername));
  18. if(turf == -1) return SCM(playerid, TEAM_AZTECAS_COLOR, "Error: You are not on a territory.");
  19. faction = PlayerData[playerid][pFaction];
  20. if(TurfInfo[turf][zOwned] == faction) return SCM(playerid, TEAM_AZTECAS_COLOR, "Error: You can't attack your own turf.");
  21. printf("turfinfoturfzowned. %d", TurfInfo[turf][zOwned]);
  22. printf("turf. %d", turf);
  23. if(WarInfo[turf][wAttacker] != 0) return SCM(playerid, TEAM_AZTECAS_COLOR, "Error: Turf is already attacked.");
  24. if(TurfInfo[turf][zTime] > 0)
  25. {
  26. format(string,sizeof(string),"Error: Turf can be attacked in %d hours.",TurfInfo[turf][zTime]);
  27. SCM(playerid, TEAM_AZTECAS_COLOR,string);
  28. return 1;
  29. }
  30. if(InWar[faction] == 1) return SCM(playerid, TEAM_AZTECAS_COLOR, "Error: You have an active war.");
  31. if(InWar[TurfInfo[turf][zOwned]] == 1) return SCM(playerid, TEAM_AZTECAS_COLOR, "Error: This mafia have active war.");
  32. TurfInfo[turf][zTime] = 24;
  33. new query[128];
  34. format(query, sizeof(query), "UPDATE `turfs` SET `Time`='24' WHERE `ID`='%d'",turf);
  35. mysql_tquery(g_iHandle, query);
  36. WarInfo[turf][wTime] = 900;
  37. WarInfo[turf][wAttacker] = faction;
  38. WarInfo[turf][wFaction] = TurfInfo[turf][zOwned];
  39. format(string,sizeof(string),"Your mafia (%s) attacked turf %d owned by %s",sendername,turf,Faction_GetName(TurfInfo[turf][zOwned]));
  40. SendFactionMessage(faction,TEAM_AZTECAS_COLOR,string);
  41. format(string,sizeof(string),"Turf %d, Time remaining: %s",turf,CalculeazaTimp(WarInfo[turf][wTime]));
  42. SendFactionMessage(faction,TEAM_AZTECAS_COLOR,string);
  43. format(string,sizeof(string),"%s (%s) attacked your turf %d",Faction_GetName(WarInfo[turf][wAttacker]),sendername,turf);
  44. SendFactionMessage(TurfInfo[turf][zOwned],TEAM_AZTECAS_COLOR,string);
  45. format(string,sizeof(string),"Turf %d, Time remaining: %s",turf,CalculeazaTimp(WarInfo[turf][wTime]));
  46. SendFactionMessage(TurfInfo[turf][zOwned],TEAM_AZTECAS_COLOR,string);
  47. worstscoreat[turf] = 0;
  48. worstmemberat[turf] = 999;
  49. bestscoreat[turf] = 0;
  50. bestmemberat[turf] = 999;
  51. worstscoredf[turf] = 0;
  52. worstmemberdf[turf] = 999;
  53. bestscoredf[turf] = 0;
  54. bestmemberdf[turf] = 999;
  55. InWar[TurfInfo[turf][zOwned]] = 1;
  56. InWar[faction] = 1;
  57. return 1;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement