help with tow command please
#1

hello was wondering if anyone could add this
if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pJob2] == 7)
to these two tow commands
http://pastebin.com/FrMbnCpR
will +REP
Reply
#2

pawn Код:
CMD:tow(playerid, params[])
{
    if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pJob2] == 7 || IsACop(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
                        new carid = GetPlayerVehicleID(playerid);
                        if(IsATowTruck(carid))
                        {
                                new closestcar = GetClosestCar(playerid, carid);

                                foreach(Player, i) {
                                        if(arr_Towing[i] == closestcar || (GetPlayerVehicleID(i) == closestcar && GetPlayerState(i) == 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't tow a vehicle which is occupied, or in tow.");
                                }

                        if(GetDistanceToCar(playerid,closestcar) <= 8 && !IsTrailerAttachedToVehicle(carid)) {
                                        foreach(Player, i) {
                                                if(GetPlayerVehicle(i, closestcar) != -1) {

                                                        new
                                                                hKey;

                                                        if(((hKey = PlayerInfo[i][pHouse]) != INVALID_HOUSE_ID) && IsPlayerInRangeOfPoint(playerid, 50.0, HouseInfo[hKey][hExteriorX], HouseInfo[hKey][hExteriorY], HouseInfo[hKey][hExteriorZ])
                                                        ||((hKey = PlayerInfo[i][pHouse2]) != INVALID_HOUSE_ID) && IsPlayerInRangeOfPoint(playerid, 50.0, HouseInfo[hKey][hExteriorX], HouseInfo[hKey][hExteriorY], HouseInfo[hKey][hExteriorZ])) {
                                                                return SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't need to be towed.");
                                                        }


                                                    if(ProxDetectorS(30.0,playerid,i))
                                                                SendClientMessage(i, COLOR_LIGHTBLUE, "Someone is attempting to tow your vehicle away!");

                                                        arr_Towing[playerid] = closestcar;
                                                    SendClientMessage(playerid, COLOR_GRAD2, "This player owned vehicle is available for impounding.");
                                                return AttachTrailerToVehicle(closestcar,carid);
                                                }
                                        }
                                        SendClientMessage(playerid, COLOR_GRAD2, "This vehicle has no registration, it is available for impounding.");
                                        AttachTrailerToVehicle(closestcar,carid);
                                        arr_Towing[playerid] = closestcar;
                                        return 1;
                        }
                        }
                        else SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to tow with this vehicle.");
                }
    }
        else SendClientMessage(playerid, COLOR_GRAD2, "You need to be inside a vehicle to use this command!");
        }
        else SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command.");
        return 1;
}

CMD:untow(playerid, params[])
{
    if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pJob2] == 7)
    {
        if(IsACop(playerid))
        {
                if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
        {
                SendClientMessage(playerid, COLOR_GRAD1,"You have unhooked the vehicle that you were towing.");
                        arr_Towing[playerid] = INVALID_VEHICLE_ID;
                        DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
        }
        else
        {
                SendClientMessage(playerid, COLOR_GRAD1,"You're currently not towing anything.");
        }
        }
        else
        {
                SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command.");
        }
    }
        return 1;
}
Is that what you mean?
Reply
#3

pawn Код:
CMD:lukka(playerid,params[])
{
   if(PlayerInfo[playerid][pJob] == 7)
      {
      // ........
      return 1;
    }
   if( PlayerInfo[playerid][pJob2] == 7)
      {
        //...
        return 1;  
      }
}
Reply
#4

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
pawn Код:
CMD:tow(playerid, params[])
{
    if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pJob2] == 7 || IsACop(playerid))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
                        new carid = GetPlayerVehicleID(playerid);
                        if(IsATowTruck(carid))
                        {
                                new closestcar = GetClosestCar(playerid, carid);

                                foreach(Player, i) {
                                        if(arr_Towing[i] == closestcar || (GetPlayerVehicleID(i) == closestcar && GetPlayerState(i) == 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't tow a vehicle which is occupied, or in tow.");
                                }

                        if(GetDistanceToCar(playerid,closestcar) <= 8 && !IsTrailerAttachedToVehicle(carid)) {
                                        foreach(Player, i) {
                                                if(GetPlayerVehicle(i, closestcar) != -1) {

                                                        new
                                                                hKey;

                                                        if(((hKey = PlayerInfo[i][pHouse]) != INVALID_HOUSE_ID) && IsPlayerInRangeOfPoint(playerid, 50.0, HouseInfo[hKey][hExteriorX], HouseInfo[hKey][hExteriorY], HouseInfo[hKey][hExteriorZ])
                                                        ||((hKey = PlayerInfo[i][pHouse2]) != INVALID_HOUSE_ID) && IsPlayerInRangeOfPoint(playerid, 50.0, HouseInfo[hKey][hExteriorX], HouseInfo[hKey][hExteriorY], HouseInfo[hKey][hExteriorZ])) {
                                                                return SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't need to be towed.");
                                                        }


                                                    if(ProxDetectorS(30.0,playerid,i))
                                                                SendClientMessage(i, COLOR_LIGHTBLUE, "Someone is attempting to tow your vehicle away!");

                                                        arr_Towing[playerid] = closestcar;
                                                    SendClientMessage(playerid, COLOR_GRAD2, "This player owned vehicle is available for impounding.");
                                                return AttachTrailerToVehicle(closestcar,carid);
                                                }
                                        }
                                        SendClientMessage(playerid, COLOR_GRAD2, "This vehicle has no registration, it is available for impounding.");
                                        AttachTrailerToVehicle(closestcar,carid);
                                        arr_Towing[playerid] = closestcar;
                                        return 1;
                        }
                        }
                        else SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to tow with this vehicle.");
                }
    }
        else SendClientMessage(playerid, COLOR_GRAD2, "You need to be inside a vehicle to use this command!");
        }
        else SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command.");
        return 1;
}

CMD:untow(playerid, params[])
{
    if(PlayerInfo[playerid][pJob] == 7 || PlayerInfo[playerid][pJob2] == 7)
    {
        if(IsACop(playerid))
        {
                if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
        {
                SendClientMessage(playerid, COLOR_GRAD1,"You have unhooked the vehicle that you were towing.");
                        arr_Towing[playerid] = INVALID_VEHICLE_ID;
                        DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
        }
        else
        {
                SendClientMessage(playerid, COLOR_GRAD1,"You're currently not towing anything.");
        }
        }
        else
        {
                SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command.");
        }
    }
        return 1;
}
Is that what you mean?
that was it mate thank you very much, sorry would of done it last night but was sat was out on the piss lol
+rep'd for the help bud cheers lol i couldnt figure out a { pmsl and i take it || means like the if, so thats a brilliant thing to remember cheers.. see this why i love the forums im not great at scripting but when people help with codes i dont get i start to learn whats what
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)