Jochemd

Untitled

May 5th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. public CheckFireExinguishing(toolate)
  2. {
  3. if(gettime() >= toolate)
  4. {
  5. for(new b = 0; b < GlobalInfo[TotalFireObjects]; b ++)
  6. {
  7. DestroyDynamicObject(FireObject[b]);
  8. FireObject[b] = 0;
  9. }
  10. for(new i = 0; i < MAX_PLAYERS; i ++)
  11. {
  12. if(IsPlayerConnected(i))
  13. {
  14. if(GetPVarInt(i,"gTeam") == JOB_BBFD)
  15. {
  16. SetPVarInt(i,"ExtinguisedFlames",0);
  17. GlobalInfo[DestroyedFireObjects] = 0;
  18. GlobalInfo[TotalFireObjects] = 0;
  19. KillTimer(GlobalInfo[FireTimer]);
  20. SendClientMessage(i,COLOR_RED,"Shame on you! You didn't extinguish the flames in time.");
  21. }
  22. }
  23. }
  24. }
  25. new rand = random(20);
  26. if(rand == 7)
  27. {
  28. new rand_obj = random(GlobalInfo[TotalFireObjects]), Float:Pos[3];
  29. while(!IsValidDynamicObject(FireObject[rand_obj])) rand_obj = random(GlobalInfo[TotalFireObjects]);
  30. GetDynamicObjectPos(FireObject[rand_obj],Pos[0],Pos[1],Pos[2]);
  31. CreateExplosion(Pos[0],Pos[1],Pos[2],0,4);
  32. }
  33. for(new i = 0; i < MAX_PLAYERS; i ++)
  34. {
  35. if(IsPlayerConnected(i))
  36. {
  37. if(GetPVarInt(i,"gTeam") == JOB_BBFD)
  38. {
  39. if(GetPlayerWeapon(i) == 42)
  40. {
  41. new animlib[32],animname[32];
  42. GetAnimationName(GetPlayerAnimationIndex(i),animlib,sizeof(animlib),animname,sizeof(animname));
  43. if(!strcmp(animlib,"PED",true) && !strcmp(animname,"GUN_STAND"))
  44. {
  45. new keys, updown, leftright;
  46. GetPlayerKeys(i,keys,updown,leftright);
  47. if(keys == 4)
  48. {
  49. for(new o = 0; o < 15; o ++)
  50. {
  51. new Float:Pos[3];
  52. GetDynamicObjectPos(FireObject[o],Pos[0],Pos[1],Pos[2]);
  53. if(IsPlayerInRangeOfPoint(i,3,Pos[0],Pos[1],Pos[2]))
  54. {
  55. DestroyDynamicObject(FireObject[o]);
  56. SetInfoBoxMessage(i,"~y~Extinguished a ~r~flame!",3000);
  57. SetPVarInt(i,"ExtinguishedFlames",GetPVarInt(i,"ExtinguishedFlames") + 1);
  58. GlobalInfo[DestroyedFireObjects] ++;
  59. if(GlobalInfo[DestroyedFireObjects] == GlobalInfo[TotalFireObjects])
  60. {
  61. for(new p = 0; p < MAX_PLAYERS; p ++)
  62. {
  63. if(IsPlayerConnected(p))
  64. {
  65. if(GetPVarInt(p,"gTeam") == JOB_BBFD)
  66. {
  67. new flames = GetPVarInt(p,"ExtinguishedFlames");
  68. if(flames > 0)
  69. {
  70. new string[128];
  71. format(string,sizeof(string),"~y~You have ~r~extinguished ~y~%d flames, therefore you receive $%d",flames,(flames * 5));
  72. SetInfoBoxMessage(p,string,4000);
  73. SetPVarInt(p,"PayDayExtra",GetPVarInt(p,"PayDayExtra") + 500);
  74. for(new b = 0; b < GlobalInfo[TotalFireObjects]; b ++) FireObject[b] = 0;
  75. SetPVarInt(p,"ExtinguishedFlames",0);
  76. GlobalInfo[DestroyedFireObjects] = 0;
  77. GlobalInfo[TotalFireObjects] = 0;
  78. KillTimer(GlobalInfo[FireTimer]);
  79. }
  80. }
  81. }
  82. if(p == (MAX_PLAYERS -1)) return 1;
  83. }
  84. }
  85. }
  86. }
  87. }
  88. }
  89. }
  90. }
  91. }
  92. }
  93. return 1;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment