24.08.2012, 19:56
Hello everyone.
I have am developing a script which would work as metal detector. If a player walks pass a place (between 2 objects), and he will be armed, a sirens will start flashing, but if he wont be armed, they wont.
I have programmed that but the problem is that the sirens start flashing only if person who is armed has the weapon in his hands. If the weapon is not in his hands but stored somewhere on the player, the lights wont go on. I appreciate every effort of help. Thank you.
Current code:
I have am developing a script which would work as metal detector. If a player walks pass a place (between 2 objects), and he will be armed, a sirens will start flashing, but if he wont be armed, they wont.
I have programmed that but the problem is that the sirens start flashing only if person who is armed has the weapon in his hands. If the weapon is not in his hands but stored somewhere on the player, the lights wont go on. I appreciate every effort of help. Thank you.
Current code:
Код:
new bool:SirenCreated; new obj1; new obj2; public OnPlayerUpdate(playerid) { if(IsPlayerInRangeOfPoint(playerid, 0.3, 1207.0170, -1333.9816, 13.3984) && SirenCreated == false && GetPlayerWeapon(playerid) > 0) { SirenCreated = true; obj1 = CreateObject(18646, 1207.5631, -1334.1051, 13.5816, 0.0, 0.0, 0.0); obj2 = CreateObject(18646, 1206.5031, -1334.1051, 13.5816, 0.0, 0.0, 0.0); } if(!IsPlayerInRangeOfPoint(playerid, 0.3, 1207.0170, -1333.9816, 13.3984) && SirenCreated == true) { SirenCreated = false; DestroyObject(obj1); DestroyObject(obj2); } return 1; }