This is another possible solution that has insignificantly longer execution time but doesn't use global variables and is more flexible (can be used for players who aren't local):
Code:
bool playerHasShot(jjPLAYER@ player){
jjOBJ@ obj;
for(int i=0;i<jjObjectCount;i++){
@obj=jjObjects[i];
if(obj.isActive&&(obj.eventID<OBJECT::SMOKERING||obj.eventID==OBJECT::TNT)&&obj.creatorType==CREATOR::PLAYER&&jjPlayers[obj.creator] is player&&(obj.state==STATE::FLY||obj.state==STATE::ROCKETFLY)&&obj.counter==1) return true;
}
return false;
}
__________________
I am an official JJ2+ programmer and this has been an official JJ2+ statement.
Last edited by Sir Ementaler; Aug 17, 2013 at 02:15 PM.
|