Hello guys i made an alarm system but the problem is only the guy hotwires the car hears it... Can somone help me? this is the code:
Код:
forward Alarmstart(playerid);
public Alarmstart(playerid)
{
if(alarmon[playerid] <= 30 )
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (ProxDetectorS(5.0, playerid, i))
{
alarmon[playerid] += 1;
PlayerPlaySound(i, 1147, 0.0,0.0,0.0);
alarmtimer = SetTimerEx("Alarmstart",1000,0,"i",playerid);
return 1;
}
}
}
}
Код:
forward Alarmstart(playerid);
public Alarmstart(playerid)
{
if(alarmon[playerid] <= 30 )
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if (ProxDetectorS(18.0, playerid, i))
{
alarmon[playerid] += 1;
PlayerPlaySound(i, 1147, 0.0,0.0,0.0);
alarmtimer = SetTimerEx("Alarmstart",1000,0,"i",playerid);
return 1;
}
}
}
}
}
pawn Код:
public StartAlarm(playerid)
{
new panels, doors, lights, tires;
GetVehicleDamageStatus(gLastCar[playerid], panels, doors, lights, tires);
StopAlarm[playerid] ++;
if(StopAlarm[playerid] == SHUTDOWN)
{
KillTimer(AlarmTime[playerid]);
StopAlarm[playerid] = 0;
lights = encode_lights(0, 0, 0, 0);
return 1;
}
switch(GetPVarInt(playerid, "VehON"))
{
case 0:
{
lights = encode_lights(1, 1, 1, 1);
SetPVarInt(playerid, "VehON", 1);
GetVehiclePos(gLastCar[playerid], Ala_x[playerid], Ala_y[playerid], Ala_z[playerid]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerPlaySound(i, 1147, Ala_x[playerid], Ala_y[playerid], Ala_z[playerid]);
}
}
case 1:
{
lights = encode_lights(0, 0, 0, 0);
SetPVarInt(playerid, "VehON", 0);
GetVehiclePos(gLastCar[playerid], Ala_x[playerid], Ala_y[playerid], Ala_z[playerid]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerPlaySound(i, 1147, Ala_x[playerid], Ala_y[playerid], Ala_z[playerid]);
}
}
}
UpdateVehicleDamageStatus(gLastCar[playerid], panels, doors, lights, tires);
return 1;
}