17.02.2011, 18:44
pawn Код:
stock UpdateVehicleParamsEx(vehicleid, bool: status, { _, Float }: ...)
{
new
vehicleParams[7],
vehicleParamsData[7][10] =
{
{ "Engine" },
{ "Lights" },
{ "Alarm" },
{ "Doors" },
{ "Bonnet" },
{ "Boot" },
{ "Objective" }
},
totalArgs = numargs()
;
if(totalArgs < 3)
{
return 0;
}
GetVehicleParamsEx(vehicleid, vehicleParams[0], vehicleParams[1], vehicleParams[2], vehicleParams[3], vehicleParams[4], vehicleParams[5], vehicleParams[6]);
for(new i = 2, j = 0, ch = '\0'; i != totalArgs; ++i)
{
new
tempString[10]
;
for(j = 0; (ch = getarg(i, j)) != EOS; ++j)
{
tempString[j] = ch;
}
for(j = 0; j != sizeof(vehicleParamsData); ++j)
{
if(!strcmp(vehicleParamsData[j], tempString, true))
{
vehicleParams[j] = status;
}
}
}
SetVehicleParamsEx(vehicleid, vehicleParams[0], vehicleParams[1], vehicleParams[2], vehicleParams[3], vehicleParams[4], vehicleParams[5], vehicleParams[6]);
return 1;
}
pawn Код:
UpdateVehicleParamsEx(vehicleid, true, "Engine", "Boot", "Doors");
or
pawn Код:
UpdateVehicleParamsEx(vehicleid, true, "Alarm", "Bonnet", "Doors", "Boot", "Engine");
Notice: true is for ON and false is for OFF.