ONE small Help
#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


Messages In This Thread
ONE small Help - by RaajParker - 26.12.2015, 00:40
Re: ONE small Help - by chrism11 - 26.12.2015, 00:56
Re: ONE small Help - by RaajParker - 26.12.2015, 01:00
Re: ONE small Help - by RaajParker - 26.12.2015, 01:20
Re: ONE small Help - by Nero_3D - 26.12.2015, 02:40
Re: ONE small Help - by RaajParker - 26.12.2015, 02:47
Re: ONE small Help - by PrO.GameR - 26.12.2015, 10:03

Forum Jump:


Users browsing this thread: 2 Guest(s)