24.05.2010, 23:05
Hi, I am trying to create a simple car alarm system which sounds 50% of the time when a players state changes to driver.
When the alarm sounds it is only heard by the person that entered the vehicle, I actually want all nearby players to hear it also. I know my code should only work for the individual player, I just want to know what should be added to make it work as desired.
Here is the code:
Any help or suggestions are welcome, thanks.
When the alarm sounds it is only heard by the person that entered the vehicle, I actually want all nearby players to hear it also. I know my code should only work for the individual player, I just want to know what should be added to make it work as desired.
Here is the code:
Код:
public CarAlarmTimer() { for(new i=0; i<MAX_PLAYERS; i++) { if (IsPlayerConnected(i) && AlarmSounded[i] <= 9) { AlarmSounded[i] += 1; if (AlarmSounded[i] <= 9) { new currentveh; currentveh = GetPlayerVehicleID(i); new Float:vehx, Float:vehy, Float:vehz; GetVehiclePos(currentveh, vehx, vehy, vehz); PlayerPlaySound(i, 1147, vehx, vehy, vehz); } else { KillTimer(CarAlarm); AlarmSounded[i] = 10; } } } }