Neon command doesnt destroy old ones
#1

pawn Код:
CMD:neon(playerid, params[])
    {
     if(pInfo[playerid][Admin] > 1){
     
        if(IsPlayerInAnyVehicle(playerid)){
       
            new
                color[128],
                carid;
       
            if(!sscanf(params, "s[128]", color)){
           
                if(!strcmp(color, "red", true, 10)){
                    SetPVarInt(playerid, "neon", CreateObject(18647,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon2", CreateObject(18647,0,0,0,0,0,0));
                }
                if(!strcmp(color, "blue", true, 10)){
                    SetPVarInt(playerid, "neon", CreateObject(18648,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon2", CreateObject(18648,0,0,0,0,0,0));
                }
                if(!strcmp(color, "green", true, 10)){
                    SetPVarInt(playerid, "neon", CreateObject(18649,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon2", CreateObject(18649,0,0,0,0,0,0));
                }
                if(!strcmp(color, "yellow", true, 10)){
                    SetPVarInt(playerid, "neon", CreateObject(18650,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon2", CreateObject(18650,0,0,0,0,0,0));
                }
                if(!strcmp(color, "pink", true, 10)){
                    SetPVarInt(playerid, "neon", CreateObject(18651,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon2", CreateObject(18651,0,0,0,0,0,0));
                }
                if(!strcmp(color, "white", true, 10)){
                    SetPVarInt(playerid, "neon", CreateObject(18652,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon2", CreateObject(18652,0,0,0,0,0,0));
                }
                if(!strcmp(color, "police", true, 10)){
                    SetPVarInt(playerid, "neon", CreateObject(18646,0,0,0,0,0,0));
                    SetPVarInt(playerid, "neon2", CreateObject(18646,0,0,0,0,0,0));
                }
               
                carid = GetPlayerVehicleID(playerid);
               
                DestroyObject(vneons[carid][neon1]);
                DestroyObject(vneons[carid][neon2]);
               
                vneons[carid][neon1] = AttachObjectToVehicle(GetPVarInt(playerid, "neon"), carid, -0.8, 0.0, -0.60, 0.0, 0.0, 0.0);
                vneons[carid][neon2] = AttachObjectToVehicle(GetPVarInt(playerid, "neon2"), carid, 0.8, 0.0, -0.60, 0.0, 0.0, 0.0);
                 
               
                SetPlayerTime(playerid, 0, 0);
           
            } else {
                SendClientMessage(playerid, -1, "USAGE: /neon [color]");
                SendClientMessage(playerid, -1, "Colors: red, white, blue, green, yellow, police");
            }
       
        } else {
            SendClientMessage(playerid, COLOR_LIGHTPINK, "Your must be in a car to use neon");
        }
     
     } else {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You don't have access to this command");
     }
     return 1;
    }
It doesn't delete the old ones. anyone know why?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)