Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public CheckFireExinguishing(toolate)
- {
- if(gettime() >= toolate)
- {
- for(new b = 0; b < GlobalInfo[TotalFireObjects]; b ++)
- {
- DestroyDynamicObject(FireObject[b]);
- FireObject[b] = 0;
- }
- for(new i = 0; i < MAX_PLAYERS; i ++)
- {
- if(IsPlayerConnected(i))
- {
- if(GetPVarInt(i,"gTeam") == JOB_BBFD)
- {
- SetPVarInt(i,"ExtinguisedFlames",0);
- GlobalInfo[DestroyedFireObjects] = 0;
- GlobalInfo[TotalFireObjects] = 0;
- KillTimer(GlobalInfo[FireTimer]);
- SendClientMessage(i,COLOR_RED,"Shame on you! You didn't extinguish the flames in time.");
- }
- }
- }
- }
- new rand = random(20);
- if(rand == 7)
- {
- new rand_obj = random(GlobalInfo[TotalFireObjects]), Float:Pos[3];
- while(!IsValidDynamicObject(FireObject[rand_obj])) rand_obj = random(GlobalInfo[TotalFireObjects]);
- GetDynamicObjectPos(FireObject[rand_obj],Pos[0],Pos[1],Pos[2]);
- CreateExplosion(Pos[0],Pos[1],Pos[2],0,4);
- }
- for(new i = 0; i < MAX_PLAYERS; i ++)
- {
- if(IsPlayerConnected(i))
- {
- if(GetPVarInt(i,"gTeam") == JOB_BBFD)
- {
- if(GetPlayerWeapon(i) == 42)
- {
- new animlib[32],animname[32];
- GetAnimationName(GetPlayerAnimationIndex(i),animlib,sizeof(animlib),animname,sizeof(animname));
- if(!strcmp(animlib,"PED",true) && !strcmp(animname,"GUN_STAND"))
- {
- new keys, updown, leftright;
- GetPlayerKeys(i,keys,updown,leftright);
- if(keys == 4)
- {
- for(new o = 0; o < 15; o ++)
- {
- new Float:Pos[3];
- GetDynamicObjectPos(FireObject[o],Pos[0],Pos[1],Pos[2]);
- if(IsPlayerInRangeOfPoint(i,3,Pos[0],Pos[1],Pos[2]))
- {
- DestroyDynamicObject(FireObject[o]);
- SetInfoBoxMessage(i,"~y~Extinguished a ~r~flame!",3000);
- SetPVarInt(i,"ExtinguishedFlames",GetPVarInt(i,"ExtinguishedFlames") + 1);
- GlobalInfo[DestroyedFireObjects] ++;
- if(GlobalInfo[DestroyedFireObjects] == GlobalInfo[TotalFireObjects])
- {
- for(new p = 0; p < MAX_PLAYERS; p ++)
- {
- if(IsPlayerConnected(p))
- {
- if(GetPVarInt(p,"gTeam") == JOB_BBFD)
- {
- new flames = GetPVarInt(p,"ExtinguishedFlames");
- if(flames > 0)
- {
- new string[128];
- format(string,sizeof(string),"~y~You have ~r~extinguished ~y~%d flames, therefore you receive $%d",flames,(flames * 5));
- SetInfoBoxMessage(p,string,4000);
- SetPVarInt(p,"PayDayExtra",GetPVarInt(p,"PayDayExtra") + 500);
- for(new b = 0; b < GlobalInfo[TotalFireObjects]; b ++) FireObject[b] = 0;
- SetPVarInt(p,"ExtinguishedFlames",0);
- GlobalInfo[DestroyedFireObjects] = 0;
- GlobalInfo[TotalFireObjects] = 0;
- KillTimer(GlobalInfo[FireTimer]);
- }
- }
- }
- if(p == (MAX_PLAYERS -1)) return 1;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment