ONE small Help
#1

Guys i am scripting a nightclub i want to know how to make a cmd thats will switch on the disco lights the music Ex : /on - which switch on the disco lights and music and /off which switch off the disco lights and music

I mapped the nightclub with MTA ( Sry for mentioning MTA)

pls help me guys
Reply
#2

just use a command that creates light objects,
Quote:

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

and destroys them when you use the off command

idk the first thing that popped into my mind
Reply
#3

Bro one thing i have mapped disco lights in that nightclub itself i want to how to switch on and switch off them with a cmd
Reply
#4

Pls help me Guys
Reply
#5

In the /on command you need to create the disco lights with CreateObject(...)
And in the /off command you destroy them with DestroyObject(...)

--- Example ---

You could create a toggle function
PHP код:
ToggleDiscoLights(toggle) {
    
enum eDiscoLight {
        
eDL_modelid,
        
FloateDL_X,
        
FloateDL_Y,
        
FloateDL_Z,
        
FloateDL_rX,
        
FloateDL_rY,
        
FloateDL_rZ,
        
eDL_objectid
    
};
    static 
sDiscoLight[][eDiscoLight] = {
        
// change / add here your disco lights
        
{186470.01.02.05.06.07.0},
        {
186470.01.02.05.06.07.0}
    };
    if(
toggle) {
        if(
sDiscoLight[0][eDL_objectid] != 0) {
            return 
false;
        }
        for(new 
isizeof 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 
isizeof sDiscoLight; ++i) {
            
DestroyObject(sDiscoLight[i][eDL_objectid]);
        }
        
sDiscoLight[0][eDL_objectid] = 0;
    }
    return 
true;

and use it in your commands (zcmd)
PHP код:
// OnGameModeInit - if you want them to be by default on
    
ToggleDiscoLights(true);
CMD:on(playeridparams[]) {
    if(!
ToggleDiscoLights(true)) {
        return 
SendClientMessage(playerid, -1"Disco lights are already on!");
    }
    return 
true;
}
CMD:off(playeridparams[]) {
    if(!
ToggleDiscoLights(false)) {
        return 
SendClientMessage(playerid, -1"Disco lights are already off!");
    }
    return 
true;

You need to remove the objects from the map itself otherwise they would be duplicated
Reply
#6

THx , But i cant understand it

Can u script for me pls
Reply
#7

If you don't understand it you are not experienced enough with pawno and sa-mp, go read wiki n stuff.
There is no magic light switch on and off, some objects have light, you should destroy them if you want lights to be "off".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)