پرش به مطلب اصلی

SetVehicleParamsEx

توضیحات

پارامترهای یه ماشین رو برای همه پلیرها تنظیم می‌کنه.

نامتوضیحات
vehicleidID ماشینی که می‌خوای پارامترهاش رو تنظیم کنی.
bool:engineوضعیت موتور. 0 - خاموش، 1 - روشن.
bool:lightsوضعیت چراغ. 0 - خاموش، 1 - روشن.
bool:alarmوضعیت آژیر ماشین. اگه روشن باشه، آژیر شروع می‌شه. 0 - خاموش، 1 - روشن.
bool:doorsوضعیت قفل در. 0 - باز، 1 - قفل.
bool:bonnetوضعیت کاپوت. 0 - بسته، 1 - باز.
bool:bootوضعیت صندوقعقب. 0 - بسته، 1 - باز.
bool:objectiveتغییر حالت فلش objective بالای ماشین. 0 - خاموش، 1 - روشن.

مقدار برگشتی

true - تابع با موفقیت اجرا شد.

false - تابع در اجرا ناکام بود. یعنی ماشین وجود نداره.

مثال‌ها

// balaaye script, yek global variable declare mikonim
new
gVehicleAlarmTimer[MAX_VEHICLES] = {0, ...};

// age yek parameter ro set mikoni, bayad parameteraaye felio begiri ta hame change nashe
new
bool:engine, bool:lights, bool:alarm, bool:doors, bool:bonnet, bool:boot, bool:objective;

// jayi ke vehicle ro create mikoni..
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective); // faghat engine param be VEHICLE_PARAMS_ON (1) taghir yaft

// tabe
SetVehicleParamsEx_Fixed(vehicleid, &bool:engine, &bool:lights, &bool:alarm, &bool:doors, &bool:bonnet, &bool:boot, &bool:objective)
{
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if (alarm)
{
// timer ro kill kon, identifier ro reset kon va age ghablan run mishe dobare start kon
KillTimer(gVehicleAlarmTimer[vehicleid]);
gVehicleAlarmTimer[vehicleid] = 0;
gVehicleAlarmTimer[vehicleid] = SetTimerEx("DisableVehicleAlarm", 20000, false, "d", vehicleid);
}
}

forward DisableVehicleAlarm(vehicleid);
public DisableVehicleAlarm(vehicleid)
{
new
bool:engine, bool:lights, bool:alarm, bool:doors, bool:bonnet, bool:boot, bool:objective;

GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if (alarm == VEHICLE_PARAMS_ON)
{
SetVehicleParamsEx(vehicleid, engine, lights, VEHICLE_PARAMS_OFF, doors, bonnet, boot, objective);
}

// timer identifier ro reset kon
gVehicleAlarmTimer[vehicleid] = 0;
}

تعاریف

  • VEHICLE_PARAMS_UNSET (-1)
  • VEHICLE_PARAMS_OFF (0)
  • VEHICLE_PARAMS_ON (1)

نکات

نکته
  • آژیر وقتی تموم شد خودش reset نمی‌شه، باید خودت با این تابع resetش کنی.
  • چراغ‌ها در روز هم کار می‌کنن (فقط وقتی ManualVehicleEngineAndLights فعال باشه).

توابع مرتبط