command not working fully please help +rep given
#1

Code:
CMD:els(playerid, params[])
{
		
  		if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
        {
            return SendClientMessage(playerid, -1, "* You are not the driver!");
        }
        new pveh = GetPlayerVehicleID(playerid);
        if (!GetVehicleModel(pveh)) return SendClientMessage(playerid, -1, "* You are not in a vehicle!");
        if (VObject(obj[pveh]))  return SendClientMessage(playerid, -1, "* You switched off the lights."), DObject(obj[pveh]), DObject2(obj[pveh]), DObject3(obj[pveh]), DObject4(obj[pveh]), DObject5(obj[pveh]), DObject6(obj[pveh]);
        switch (GetVehicleModel(pveh))
        {
			//19419 - Lightbar, 18646 - Dash, 19292 - blue flash, 19294 - yellow flash, 19290 red flash
		case 420:
            {
                obj[pveh] = CObject2(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, -0.500000, -1.534498, 0.5, 0.000000, 0.000000, 0.000000);
            }
			case 421:
            {
                obj[pveh] = CObject2(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, -0.500000, -1.534498, 0.5, 0.000000, 0.000000, 0.000000);
            }
			case 560:
            {
                obj[pveh] = CObject2(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, -0.500000, -1.534498, 0.5, 0.000000, 0.000000, 0.000000);
            }
			case 426:
            {
                obj[pveh] = CObject2(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, -0.500000, -1.534498, 0.5, 0.000000, 0.000000, 0.000000);
            }
			case 457:
            {
                obj[pveh] = CObject2(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, 0.000000, 0.049999, 1.4, 0.000000, 0.000000, 0.000000);
            }
			case 482:
            {
                obj[pveh] = CObject2(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, 0.000000, 0.6, 1.05, 0.000000, 0.000000, 0.000000);
            }
			case 490:
            {
                obj[pveh] = CObject2(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, 0.000000, 0.039999, 1.0, 0.000000, 0.000000, 0.000000);
            }
			 case 497:
            {
                obj[pveh] = CObject2(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				AObject2(obj[pveh], pveh, 0.000000,1, -0.65, 0.000000, 0.000000, 0.000000);
	         }
			case 494:
            {
                obj[pveh] = CObject2(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, -0.500000, -0.2, 0.81, 0.000000, 0.000000, 0.000000);
            }
			case 503:
            {
                obj[pveh] = CObject2(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, -0.500000, -0.2, 0.81, 0.000000, 0.000000, 0.000000);
            }
			case 504:
            {
                obj[pveh] = CObject2(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, -0.500000, -0.2, 0.81, 0.000000, 0.000000, 0.000000);
            }
			case 505:
            {
                obj[pveh] = CObject2(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, 0.000000, -0.19999, 1.1, 0.000000, 0.000000, 0.000000);
            }
			case 523:
            {
                obj[pveh] = CObject2(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				AObject2(obj[pveh], pveh, 0.000000, 0.734498, 0.27, 0.000000, 0.000000, 0.000000);
	         }
			case 528:
            {
                obj[pveh] = CObject2(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, 0.000000, 0.049999, 1.05, 0.000000, 0.000000, 0.000000);
            }
			 case 544:
            {
                obj[pveh] = CObject2(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				AObject2(obj[pveh], pveh, 0.000000,4.35, 1.35,0.00000, 0.000000, 0.000000);
	         }
			  case 535:
            {
                obj[pveh] = CObject2(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				AObject2(obj[pveh], pveh, 0.000000,0.52, 0.5,0.00000, 0.000000, 0.000000);
	         }
			  case 545:
            {
                obj[pveh] = CObject2(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				AObject2(obj[pveh], pveh, 0.000000,-0.4, 0.85,0.00000, 0.000000, 0.000000);
	         }
			 case 554:
            {
                obj[pveh] = CObject2(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				AObject2(obj[pveh], pveh, 0.000000,0.52, 0.85,0.00000, 0.000000, 0.000000);
	         }
			 case 556:
            {
                obj[pveh] = CObject2(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				AObject2(obj[pveh], pveh, 0.000000,-0.1, 1.70,0.00000, 0.000000, 0.000000);
	         }
             case 566:
            {
                obj[pveh] = CObject2(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, -0.500000, -1.534498, 0.5, 0.000000, 0.000000, 0.000000);
            }
			 case 583:
            {
                obj[pveh] = CObject2(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				AObject2(obj[pveh], pveh, 0.5,-0.4, 1.72,0.00000, 0.000000, 0.000000);
			}
			case 585:
            {
                obj[pveh] = CObject2(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, -0.500000, -1.534498, 0.5, 0.000000, 0.000000, 0.000000);
            }
			 case 596:
            {
            	obj[pveh] = CObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj2[pveh] = CObject2(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj3[pveh] = CObject3(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj4[pveh] = CObject4(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj5[pveh] = CObject5(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj6[pveh] = CObject6(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        		AObject(obj[pveh], pveh, 0.523999, -0.2999999, 0.899999, 0.000000, 0.000000, 0.000000);
				AObject2(obj2[pveh], pveh, -0.523999, -0.2999999, 0.899999, 0.000000, 0.000000, 0.000000);
				AObject3(obj3[pveh], pveh, 0.523999,-2.43,-0.22,0.000000,0.000000,0.000000);
				AObject4(obj4[pveh], pveh, -0.523999,-2.43,-0.22,0.000000,0.000000,0.000000);
				AObject5(obj5[pveh], pveh, 0.523999,2.43,-0.22,0.000000,0.000000,0.000000);
				AObject6(obj6[pveh], pveh, -0.523999,2.43,-0.22,0.000000,0.000000,0.000000);
            }
             case 597:
            {
            	obj[pveh] = CObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj2[pveh] = CObject2(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj3[pveh] = CObject3(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj4[pveh] = CObject4(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj5[pveh] = CObject5(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj6[pveh] = CObject6(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    			AObject(obj[pveh], pveh, 0.523999, -0.2999999, 0.899999, 0.000000, 0.000000, 0.000000);
				AObject2(obj2[pveh], pveh, -0.523999, -0.2999999, 0.899999, 0.000000, 0.000000, 0.000000);
				AObject3(obj3[pveh], pveh, 0.523999,-2.43,-0.22,0.000000,0.000000,0.000000);
				AObject4(obj4[pveh], pveh, -0.523999,-2.43,-0.22,0.000000,0.000000,0.000000);
				AObject5(obj5[pveh], pveh, 0.523999,2.43,-0.22,0.000000,0.000000,0.000000);
				AObject6(obj6[pveh], pveh, -0.523999,2.43,-0.22,0.000000,0.000000,0.000000);
            }
             case 598:
            {
            	obj[pveh] = CObject(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj2[pveh] = CObject2(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj3[pveh] = CObject3(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj4[pveh] = CObject4(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj5[pveh] = CObject5(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
				obj6[pveh] = CObject6(19292, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject(obj[pveh], pveh, 0.523999, -0.2999999, 0.899999, 0.000000, 0.000000, 0.000000);
				AObject2(obj2[pveh], pveh, -0.523999, -0.2999999, 0.899999, 0.000000, 0.000000, 0.000000);
				AObject3(obj3[pveh], pveh, 0.523999,-2.43,-0.22,0.000000,0.000000,0.000000);
				AObject4(obj4[pveh], pveh, -0.523999,-2.43,-0.22,0.000000,0.000000,0.000000);
				AObject5(obj5[pveh], pveh, 0.523999,2.43,-0.22,0.000000,0.000000,0.000000);
				AObject6(obj6[pveh], pveh, -0.523999,2.43,-0.22,0.000000,0.000000,0.000000);
            }
            case 599:
            {
                obj1[pveh] = CObject1(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, 0.000000, -0.19999, 1.0, 0.000000, 0.000000, 0.000000);
            }
		    case 601:
            {
                obj1[pveh] = CObject1(19419, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                AObject2(obj[pveh], pveh, 0.000000, 2.49999, 1.1, 0.000000, 0.000000, 0.000000);
            }
			default:
            {
                return SendClientMessage(playerid, -1, "* You are not in a CODE 2 compatible emergency vehicle!");
            }
        }
        return SendClientMessage(playerid, -1, "**Emergency Lights Activated.**");
}
im trying to make a command that has attached lights to a spawned vehicle that flash, aka strobes, however i can get them to show up, via the command, however when i put the command in again they dont despawn aka destroy the objects in needs to, therefor they stay flashing, ugh what do i have wrong in this command that is causing this issue?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)