28.01.2015, 06:50
Hello , i have a dialog option . When player stand on pickup a dialog appears . And he can set any vehicle in his house . But i want to have a function that player can only save the vehicle in which he is . Following is the code of setting any vehicle to house . How to convert it to a function that he can save only that vehicle in which he is by /park.
PHP Code:
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, HOUSE_DIAG+18, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - {"#G>"}House Vehicles", "{"#R>"}ERROR: You must enter a vehicle name or model id!\n\n{"#W>"}Enter a vehicle name or model id to continue", "Set", "Cancel");
new vehid = GetVehicleModel2(inputtext);
if(!IsValidVehicle(vehid) || !IsAllowedVehicle(vehid)) return ShowPlayerDialog(playerid, HOUSE_DIAG+18, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - {"#G>"}House Vehicles", "{"#R>"}ERROR: This vehicle is either not allowed or does not exist!\n\n{"#W>"}Enter a vehicle name or model id to continue", "Set", "Cancel");
new key[20];
new houseid = HOUSEID(playerid);
new vehslot = GetPVarInt(playerid, "HVehSlot");
format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
format(key, sizeof(key), "VSlot%dModel", vehslot);
dini_IntSet(hfile, key, vehid);
hVeh[houseid][vehslot][ModelID] = vehid;
NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}House Vehicles", "House vehicle model was successfully changed!");