OnPlayerWeaponshot problem. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerWeaponshot problem. (
/showthread.php?tid=554375)
OnPlayerWeaponshot problem. -
Gaurav_Rawat - 03.01.2015
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.
AW: OnPlayerWeaponshot problem. -
CutX - 03.01.2015
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
Re: OnPlayerWeaponshot problem. -
Gaurav_Rawat - 03.01.2015
OMG i forgot such simple thing. Tried it and it works
Cutx meng you are my saviour xD