SA-MP Forums Archive
Engine command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Engine command (/showthread.php?tid=360434)



Engine command - Qur - 17.07.2012

Hey.. I've made a command for /engine .. when you enter a car you must type /engine else you cant drive..
it working.. but... the only problem that after typing /engine again to stop the engine it reapet the first line again..



here's the script
pawn Код:
if(strcmp(cmd, "/engine", true) == 0)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            if(IsABike(vehicleid))
            {
                SendClientMessage(playerid, COLOR_GRAD5, "   You riding a bicycles!");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s puts the keys and turn on the engine.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            if(engine == 1)
            {
                SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* %s Turn off the engine and take the keys.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else
            {
                SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
            }
            return 1;
        }
        return 1;
    }



Re: Engine command - Qur - 18.07.2012

Anyone?


Re: Engine command - newbienoob - 18.07.2012

pawn Код:
if(strcmp(cmd, "/engine", true) == 0)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            if(IsABike(vehicleid))
            {
                SendClientMessage(playerid, COLOR_GRAD5, "   You riding a bicycles!");
                return 1;
            }
            if(engine == 1)
            {
                SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* %s Turn off the engine and take the keys.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* %s puts the keys and turn on the engine.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
            }
            return 1;
        }
        return 1;
    }



Re: Engine command - Qur - 18.07.2012

Okay thanks, I understand what you've done..
Thanks