19.09.2011, 17:57
Hello scripters!
I have a problem with my car control script.
I think you will understand what this script does by looking at it.
If not, it basically just turns engine on/off, or lights on/off and so on.
Here is the script that calls the Dialog:
And here is the script at 'OnDialogResponse':
Problem is that when i type '/car', the dialog pops up, and when i try turning my engine for example off, it just closes the dialog....
I have a problem with my car control script.
I think you will understand what this script does by looking at it.
If not, it basically just turns engine on/off, or lights on/off and so on.
Here is the script that calls the Dialog:
Код:
dcmd_car(playerid,params[]) { ShowPlayerDialog(playerid,DIALOG_CAR,DIALOG_STYLE_LIST, "Car control", "Engine\r\nLights\r\nAlarm\r\nBonnet\r\nBoot", "Ok", "Close"); return 1; }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_CAR) { if(!response) { return 1; } new Vehicle[MAX_PLAYERS], Engine[MAX_PLAYERS], Lights[MAX_PLAYERS], Alarm[MAX_PLAYERS], Doors[MAX_PLAYERS], Bonnet[MAX_PLAYERS], Boot[MAX_PLAYERS], Objective[MAX_PLAYERS]; Vehicle[playerid] = GetPlayerVehicleID(playerid); GetVehicleParamsEx(Vehicle[playerid], Engine[playerid], Lights[playerid], Alarm[playerid], Doors[playerid], Bonnet[playerid], Boot[playerid], Objective[playerid]); if(listitem == 0) { if(Engine[playerid] == 1) return SetVehicleParamsEx(Vehicle[playerid], 0, Lights[playerid], Alarm[playerid], Doors[playerid], Bonnet[playerid], Boot[playerid], Objective[playerid]); if(Engine[playerid] == 0) return SetVehicleParamsEx(Vehicle[playerid], 1, Lights[playerid], Alarm[playerid], Doors[playerid], Bonnet[playerid], Boot[playerid], Objective[playerid]); } if(listitem == 1) { if(Lights[playerid] == 1) return Lights[playerid] = 0, SetVehicleParamsEx(Vehicle[playerid], Engine[playerid], Lights[playerid], Alarm[playerid], Doors[playerid], Bonnet[playerid], Boot[playerid], Objective[playerid]); if(Lights[playerid] == 0) return Lights[playerid] = 1, SetVehicleParamsEx(Vehicle[playerid], Engine[playerid], Lights[playerid], Alarm[playerid], Doors[playerid], Bonnet[playerid], Boot[playerid], Objective[playerid]); } if(listitem == 2) { if(Alarm[playerid] == 1) return Alarm[playerid] = 0, SetVehicleParamsEx(Vehicle[playerid], Engine[playerid], Lights[playerid], Alarm[playerid], Doors[playerid], Bonnet[playerid], Boot[playerid], Objective[playerid]); if(Alarm[playerid] == 0) return Alarm[playerid] = 1, SetVehicleParamsEx(Vehicle[playerid], Engine[playerid], Lights[playerid], Alarm[playerid], Doors[playerid], Bonnet[playerid], Boot[playerid], Objective[playerid]); } if(listitem == 3) { if(Bonnet[playerid] == 1) return Bonnet[playerid] = 0, SetVehicleParamsEx(Vehicle[playerid], Engine[playerid], Lights[playerid], Alarm[playerid], Doors[playerid], Bonnet[playerid], Boot[playerid], Objective[playerid]); if(Bonnet[playerid] == 0) return Bonnet[playerid] = 1, SetVehicleParamsEx(Vehicle[playerid], Engine[playerid], Lights[playerid], Alarm[playerid], Doors[playerid], Bonnet[playerid], Boot[playerid], Objective[playerid]); } if(listitem == 4) { if(Boot[playerid] == 1) return Boot[playerid] = 0, SetVehicleParamsEx(Vehicle[playerid], Engine[playerid], Lights[playerid], Alarm[playerid], Doors[playerid], Bonnet[playerid], Boot[playerid], Objective[playerid]); if(Boot[playerid] == 0) return Boot[playerid] = 1, SetVehicleParamsEx(Vehicle[playerid], Engine[playerid], Lights[playerid], Alarm[playerid], Doors[playerid], Bonnet[playerid], Boot[playerid], Objective[playerid]); } } return 0; }