Only owner can start vehicle
#2

pawn Код:
if(newkeys & KEY_SUBMISSION) // New Engine HotKey
    {
        if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
        if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle.");
        new vehicleid = GetPlayerVehicleID(playerid);
        switch(GetVehicleModel(vehicleid))
        {
            case 509, 481, 510: return SendClientMessage(playerid, COLOR_GREY, "Bicycles have no engine.");
            default:
            {
                new engine, lights, alarm, doors, bonnet, boot, objective;
                GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
                if(vehicleid == PlayerInfo[playerid][pVeh]) doors = PlayerInfo[playerid][vLocked];
                else if(vehicleid == PlayerInfo[playerid][pVVeh]) doors = PlayerInfo[playerid][vVLocked];
                else if(vehicleid == PlayerInfo[playerid][pBVeh]) doors = PlayerInfo[playerid][vBLocked];
                else return SendClientMessage(playerid, COLOR_GREY, "This is not your car!");
                new string[60];
                if(PlayerInfo[playerid][pMaskOn]) string = (engine) ? ("* keeras sььte vдlja.") : ("* kдivitas mootori.");
                else format(string, sizeof(string), (engine) ? ("* %s keeras sььte vдlja.") : ("* %s sisestas vхtme ja keeras sььdet"), RPN(playerid));
                SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                SetVehicleParamsEx(vehicleid, (engine) ? (0) : (1), lights, alarm, doors, bonnet, boot, objective);
            }
        }
    }
I have just made the code a bit shorter for you. Also, you will need to translate this line to your own language:
pawn Код:
else return SendClientMessage(playerid, COLOR_GREY, "This is not your car!");
Reply


Messages In This Thread
Only owner can start vehicle - by b00m112 - 24.12.2014, 11:12
Re: Only owner can start vehicle - by Threshold - 24.12.2014, 12:38
Re: Only owner can start vehicle - by b00m112 - 24.12.2014, 22:09

Forum Jump:


Users browsing this thread: 2 Guest(s)