31.03.2011, 19:30
Hey there.
I've been messing about with SA:MP servers recently, and I've stumbled upon this problem.
I'm trying to assign the secondary key (2), to turn the engine up and running. The 'starting' part works fine, but when I'm trying to make it shut down, it just starts it -again-
This is what I've got so far:
Anyone interested in helping me?
I've been messing about with SA:MP servers recently, and I've stumbled upon this problem.
I'm trying to assign the secondary key (2), to turn the engine up and running. The 'starting' part works fine, but when I'm trying to make it shut down, it just starts it -again-
This is what I've got so far:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid))
{
new engine, lights, alarm, doors, bonnet, boot, objective;
new vid = GetPlayerVehicleID(playerid);
if(vid != INVALID_VEHICLE_ID)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
GameTextForPlayer(playerid, "~w~Engine: ~g~Started", 3000, 3);
PlayerPlaySound(playerid, 1053, 0.0, 0.0, 10.0);
}
else if (engine == 1)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
GameTextForPlayer(playerid, "~w~Engine: ~r~Stopped", 3000, 3);
PlayerPlaySound(playerid, 1046, 0.0, 0.0, 10.0);
}
}
return 1;
}