OnPlayerWeaponshot problem.
#1

pawn Код:
if(hittype == BULLET_HIT_TYPE_OBJECT) {
        if(IsValidObject(hitid)) {
            if(ObjectDamage[hitid] == true) {
   if(Team[playerid]!=A&&ObjectDamage[Object_ID[3]])
            {

                ObjectHP[hitid] -= random(10) + 1;
               
                if(ObjectHP[hitid] >= 0) {
                    new str[128];
                    format(str, sizeof(str), "~G~OBJECT DAMAGED!~N~~Y~OBJECT ID ~W~: ~R~ %d~N~~Y~HP LEFT ~W~: ~R~ %d", hitid, ObjectHP[hitid]);
                   
                    GameTextForPlayer(playerid, str, 1800, 3);
                   
                }
                if(ObjectHP[hitid] <= 0) {
                    DestroyObject(hitid);
                    CreateExplosion(1327.86621, -889.94873, 43.97300,10,10);
                }
            }

        }
    }
    }
The code should work like if team is in A they can't hit the object other team can.
Reply
#2

Quote:
Originally Posted by Gaurav_Rawat
Посмотреть сообщение
The code should work like if team is in A they can't hit the object other team can.
make use of the return values.
Quote:
Originally Posted by wikisamp
0 - Prevent the bullet from causing damage.
1 - Allow the bullet to cause damage.
so
return 1;
will allow the object to be hit
while
return 0;
just won't
Reply
#3

OMG i forgot such simple thing. Tried it and it works
Cutx meng you are my saviour xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)