*/
#define VEHICLE_PARAMS_UNSET -1
#define VEHICLE_PARAMS_OFF 0
#define VEHICLE_PARAMS_ON 1
#define FILTERSCRIPT
#include <a_samp>
#define TEXT 0xFF9900AA
#if defined FILTERSCRIPT
#define CAR1 1337
#define CAR2 1338
#define CAR3 1339
#define CAR4 1400
#define CAR5 1401
#define CAR6 1402
#define CAR7 1403
new engine,lights,alarm,doors,bonnet,boot,objective;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Vehicle Control By ColdIce");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/car", cmdtext, true, 10) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid, TEXT, " You are not the driver");
return 1;
}
ShowPlayerDialog(playerid, CAR1, DIALOG_STYLE_LIST, "Vehicle Control - By ColdIce","Engine\nLights\nTrunk\nHood\nAlarm\nLock ","Choose","Close");
}
else
{
SendClientMessage(playerid, TEXT, "You are not in a vehicle");
return 1;
}
return 1;
}
return 0;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid, TEXT, "Type /car to control your vehicle");
return 1;
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == CAR5)
{
if(response)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,V EHICLE_PARAMS_ON,boot,objective);
SendClientMessage(playerid, TEXT, "Your hood is open");
}
if(!response)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,V EHICLE_PARAMS_OFF,boot,objective);
SendClientMessage(playerid, TEXT, "Your hood is closed");
}
}
if(dialogid == CAR6)
{
if(response)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,VEHICLE_PARAM S_ON,doors,bonnet,boot,objective);
SendClientMessage(playerid, TEXT, "Your alarm is on");
}
if(!response)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,VEHICLE_PARAM S_OFF,doors,bonnet,boot,objective);
SendClientMessage(playerid, TEXT, "Your alarm is off");
}
}
if(dialogid == CAR7)
{
if(response)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE _PARAMS_OFF,bonnet,boot,objective);
SendClientMessage(playerid, TEXT, "Your doors are now locked");
}
if(!response)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE _PARAMS_ON,bonnet,boot,objective);
SendClientMessage(playerid, TEXT, "Your doors are now unlocked");
}
}
if(dialogid == CAR2)
{
if(response)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,al arm,doors,bonnet,boot,objective);
SendClientMessage(playerid, TEXT, "Your engine is on");
}
if(!response)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,a larm,doors,bonnet,boot,objective);
SendClientMessage(playerid, TEXT, "Your engine is off");
}
}
if(dialogid == CAR3)
{
if(response)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,al arm,doors,bonnet,boot,objective);
SendClientMessage(playerid, TEXT, "Your lights are on");
}
if(!response)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,a larm,doors,bonnet,boot,objective);
SendClientMessage(playerid, TEXT, "Your lights are off");
}
}
if(dialogid == CAR4)
{
if(response)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,VEHICLE_PARAMS_ON,objective);
SendClientMessage(playerid, TEXT, "Your trunk is open");
}
if(!response)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,VEHICLE_PARAMS_OFF,objective);
SendClientMessage(playerid, TEXT, "Your trunk is closed");
}
}
if(dialogid == CAR1)
{
if(response)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid, CAR2, DIALOG_STYLE_MSGBOX, "Engine","Do you wanna turn on/off your engine","On","Off");
}
if(listitem == 1)
{
ShowPlayerDialog(playerid, CAR3, DIALOG_STYLE_MSGBOX, "Lights","Do you wanna turn on/off your lights","On","Off");
}
if(listitem == 2)
{
ShowPlayerDialog(playerid, CAR4, DIALOG_STYLE_MSGBOX, "Trunk","Do you wanna open/close your trunk","Open","Close");
}
if(listitem == 3)
{
ShowPlayerDialog(playerid, CAR5, DIALOG_STYLE_MSGBOX, "Hood","Do you wanna open/close your hood","Open","Close");
}
if(listitem == 4)
{
ShowPlayerDialog(playerid, CAR6, DIALOG_STYLE_MSGBOX, "Alarm","Do you wanna turn on/off your alarm","On","Off");
}
if(listitem == 5)
{
ShowPlayerDialog(playerid, CAR7, DIALOG_STYLE_MSGBOX, "Lock","Do you wanna lock/unlock your doors","Lock","Unlock");
}
}
}
return 1;
}
|