[HELP] Input line long.
#1

Im trying to make the line smaller like i need this function to add and if someone use that cmd and its not in some of this vehicle IDS it wont work for him like now its:


pawn Код:
if(vehmd == 445 || vehmd == 401 || vehmd == 518 || vehmd == 527 || vehmd == 542 || vehmd == 507 || vehmd == 585 || vehmd == 419 || vehmd == 526 || vehmd == 466 || vehmd == 580 || vehmd == 550 || vehmd == 529 || vehmd == 421 ||
            vehmd == 492 || vehmd == 549 || vehmd == 540 || vehmd == 491 || vehmd == 474 || vehmd == 546 || vehmd == 517 || vehmd == 410 || vehmd == 551 || vehmd == 516 || vehmd == 467 || vehmd == 426 || vehmd == 436 || vehmd == 547)
            new componentid = 1000;
            new vehicleid = GetPlayerVehicleID(playerid);
            new id = GetVehicleID(vehicleid);
            AddVehicleComponent(VehicleID[id], componentid);
            VehicleMods[id][GetVehicleComponentType(componentid)] = componentid;
            SaveVehicle(id);
But there are problems...
Reply
#2

Add a new stock which specifies all the vehicles which can be modified:
Код:
stock ModifiableVehicle(vehicleid) {
	switch (vehicleid)
	{
    		case 445, 401, 518, 527, 542, 507, 585, 419, 526, 466, 580, 550, 529, 421,
 		492, 549, 540, 491, 474, 546, 517, 410, 551, 516, 467, 426, 436, 547: 
 		return 0;
	}
	return 1;
}
and change your code to this:

Код:
new vehicleid = GetPlayerVehicleID(playerid);

if(ModifiableVehicle(GetVehicleModel(vehicleid))) {
            new componentid = 1000;
            new id = GetVehicleID(vehicleid);
            AddVehicleComponent(VehicleID[id], componentid);
            VehicleMods[id][GetVehicleComponentType(componentid)] = componentid;
            SaveVehicle(id);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)