OnPlayerKeyStateChange
#6

I guess so..

pawn Код:
if(newkeys & KEY_FIRE) // tow command
{
    if(IsACop(playerid))
    {
        if(GetPlayerState(playerid, PLAYER_STATE_DRIVER)
        {
            new carid = GetPlayerVehicleID(playerid);
            if(!IsTrailerAttachedToVehicle(carid))
            {
                if(IsATowTruck(carid))
                {
                    new closestcar = GetClosestCar(playerid, carid);
                    if(GetDistanceToCar(playerid, closestcar) <= 8.0)
                    {
                        foreach(Player, i)
                        {
                            if(GetPlayerVehicle(i, closestcar) == -1) continue;
                            if(ProxDetectorS(30.0, playerid, i))
                            {
                                SendClientMessageEx(i, COLOR_LIGHTBLUE, "Someone is attempting to tow your vehicle away!");
                                arr_Towing[playerid] = closestcar;
                                SendClientMessageEx(playerid, COLOR_GRAD2, "This player owned vehicle is available for impounding.");
                                return AttachTrailerToVehicle(closestcar,carid);
                            }
                        }
                        SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle has no registration, it is available for impounding.");
                        AttachTrailerToVehicle(closestcar,carid);
                        arr_Towing[playerid] = closestcar;
                        return 1;
                    }
                }
                else SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to tow with this vehicle.");
            }
            else
            {
                SendClientMessageEx(playerid, COLOR_GRAD1,"You have unhooked the vehicle that you were towing.");
                arr_Towing[playerid] = INVALID_VEHICLE_ID;
                DetachTrailerFromVehicle(carid);
            }
        }
        else SendClientMessageEx(playerid, COLOR_GRAD2, "You need to be the driver of a vehicle to use this command!");
    }
    else SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
    return 1;
}
Reply


Messages In This Thread
OnPlayerKeyStateChange - by Lidor124 - 13.02.2014, 12:30
Re: OnPlayerKeyStateChange - by $Marco$ - 13.02.2014, 12:36
Re: OnPlayerKeyStateChange - by Threshold - 13.02.2014, 12:43
Re: OnPlayerKeyStateChange - by Lidor124 - 13.02.2014, 12:49
Re: OnPlayerKeyStateChange - by $Marco$ - 13.02.2014, 13:02
Re: OnPlayerKeyStateChange - by Threshold - 13.02.2014, 13:05

Forum Jump:


Users browsing this thread: 3 Guest(s)