Ex: 18646 PoliceLight1 18647 RedNeonTube1 18648 BlueNeonTube1 18649 GreenNeonTube1 18650 YellowNeonTube1 18651 PinkNeonTube1 18652 WhiteNeonTube1 18653 DiscoLightRed 18654 DiscoLightGreen 18655 DiscoLightBlue 18656 LightBeamWhite 18657 LightBeamRed 18658 LightBeamBlue |
ToggleDiscoLights(toggle) {
enum eDiscoLight {
eDL_modelid,
Float: eDL_X,
Float: eDL_Y,
Float: eDL_Z,
Float: eDL_rX,
Float: eDL_rY,
Float: eDL_rZ,
eDL_objectid
};
static sDiscoLight[][eDiscoLight] = {
// change / add here your disco lights
{18647, 0.0, 1.0, 2.0, 5.0, 6.0, 7.0},
{18647, 0.0, 1.0, 2.0, 5.0, 6.0, 7.0}
};
if(toggle) {
if(sDiscoLight[0][eDL_objectid] != 0) {
return false;
}
for(new i; i < sizeof sDiscoLight; ++i) {
sDiscoLight[i][eDL_objectid] = CreateObject(sDiscoLight[i][eDL_modelid], sDiscoLight[i][eDL_X], sDiscoLight[i][eDL_Y], sDiscoLight[i][eDL_Z], sDiscoLight[i][eDL_rX], sDiscoLight[i][eDL_rY], sDiscoLight[i][eDL_rZ]);
}
} else {
if(sDiscoLight[0][eDL_objectid] == 0) {
return false;
}
for(new i; i < sizeof sDiscoLight; ++i) {
DestroyObject(sDiscoLight[i][eDL_objectid]);
}
sDiscoLight[0][eDL_objectid] = 0;
}
return true;
}
// OnGameModeInit - if you want them to be by default on
ToggleDiscoLights(true);
CMD:on(playerid, params[]) {
if(!ToggleDiscoLights(true)) {
return SendClientMessage(playerid, -1, "Disco lights are already on!");
}
return true;
}
CMD:off(playerid, params[]) {
if(!ToggleDiscoLights(false)) {
return SendClientMessage(playerid, -1, "Disco lights are already off!");
}
return true;
}