Engine command
#1

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;
    }
Reply
#2

Anyone?
Reply
#3

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;
    }
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)