How to make when player press 2, to start the car engine ?
#6

(iOxide)You can't use his code directly.He just gave an idea and you were supposed to change the key.(Stefand Code)He assumes that you have a command engine already.And change the param to ""(I think so).You were supposed to fix youself because you know about your command better than us.If you still haven't done your code use this code...

A little change to I oxide's code, replace the existing callback in your script with this one.This code will turn off the engine if it was on and turn on if it was off.
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (GetPlayerVehicleSeat(playerid) == 0)
    {
        if (newkeys & KEY_SUBMISSION) 
        {
               return cmd_engine(playerid,"");
        }

    }
    return 1;
}
And paste this anywhere in the script.
Код:
CMD:engine(playerid,params[])
{
            new engine, lights, alarm, doors, bonnet, boot, objective;
            new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(i))
{
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, !engine, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle's engine is now turned [ON].");
}
else
{
        //Send a message telling he is not in a vehicle to manipulate an engine
}
return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)