02.02.2015, 22:46
I try to make an engine sistem...but doesn't work.... :
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new vehicleid = GetPlayerVehicleID(playerid);
//--------------------
if ((newkeys==KEY_LOOK_BEHIND))
{
if(Engine[vehicleid] == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, COLOR_YELLOW, "You have turned your engine >{FFFFFF} ON");
Engine[Vehicle] = 1, SetVehicleParamsEx(Vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
}
}
}
else
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, COLOR_YELLOW, "You have turned your engine >{FFFFFF} OFF");
Engine[Vehicle] = 0, SetVehicleParamsEx(Vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
}
}
if ((newkeys==KEY_NO))
{
if(Lights[vehicleid] == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, COLOR_YELLOW, "You have turned your lights >{FFFFFF} ON");
Lights[Vehicle] = 1, SetVehicleParamsEx(Vehicle, engine, 1, alarm, doors, bonnet, boot, objective);
}
}
}
else
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Vehicle = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, COLOR_YELLOW, "You have turned your lights >{FFFFFF} OFF");
Lights[Vehicle] = 0, SetVehicleParamsEx(Vehicle, engine, 0, alarm, doors, bonnet, boot, objective);
}
}
return 0;
}