03.03.2014, 13:52
Hy there. I'm new in SAMP scripting and I need a little help with a command that I've made. It's a /engine command that starts/stops the engine of a vehicle. The problem is that the engine only starts, and I'm not able to stop it anymore. Here's the code to the command. Thanks in advance for your help!
Код:
if(strcmp(cmd, "/engine", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(IsPlayerConnected(playerid))
{
new engine,lights,alarm,doors,bonnet,boot,objective;
new carid = GetPlayerVehicleID(playerid);
if(engine == 0)
{
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(carid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid, 0xFFFFFFAA, "Ai pornit motorul vehiculului. {2F991A}Engine on");
}
else if(engine == 1)
{
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(carid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid, 0xFFFFFFAA, "Ai oprit motorul vehiculului. {2F991A}Engine off");
}
}
}
return 1;
}
