Server: Unknown Command.
#4

I've optimized the command for you:
pawn Код:
CMD:tow(playerid, params[])
{
    new Float:pX, Float:pY, Float:pZ, Float:vX,Float:vY,Float:vZ, Found, vid;
    if(!IsPlayerConnected(playerid)) return 0;
    if(APlayerData[playerid][LoggedIn] == false) return SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa te loghezi inainte de a face asta.");
    if(PlayerInfo[playerid][pJob] != 8) return SendClientMessage(playerid, COLOR_GREY, "You need to be a mechanic to use this command.");
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You need to be the driver to use this command.");
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 525) return SendClientMessage(playerid, COLOR_GREY, "You need to be in a tow truck to use this command.");
    GetPlayerPos(playerid, pX, pY, pZ);
    while((vid<MAX_VEHICLES)&&(!Found))
    {
        vid++;
        GetVehiclePos(vid,vX,vY,vZ);
        if ((floatabs(pX-vX)<7.0)&&(floatabs(pY-vY)<7.0)&&(floatabs(pZ-vZ)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
        {
            if(IsABike(vid) || GetVehicleModel(vid) == 448 || GetVehicleModel(vid) == 461 || GetVehicleModel(vid) == 462 || GetVehicleModel(vid) == 463 || GetVehicleModel(vid) == 468 || GetVehicleModel(vid) == 471 || GetVehicleModel(vid) == 521 || GetVehicleModel(vid) == 522 || GetVehicleModel(vid) == 523) return 1;
            if(IsAnOwnableCar(vid)) return SendClientMessage(playerid, -1, "Nu ai voie sa tractezi masini personale.");
            if(TowAcc[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "Nu poti tracta atat de repede o masina, trebuie sa astepti 2 minute.");
            Found = 1;
            if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
            {
                DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
                DisablePlayerCheckpoint(playerid);
                gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
            }
            else
            {
                AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
                new rand = random(sizeof(TowCarCk));
                SetPlayerCheckpoint(playerid, TowCarCk[rand][0],TowCarCk[rand][1],TowCarCk[rand][2], 6);
                CP[playerid] = 34;
            }
        }
    }
    if(!Found) return SendClientMessage(playerid, COLOR_GREY, "There is no car near to you.");
    return 1;
}
Reply


Messages In This Thread
Server: Unknown Command. - by Longover - 01.03.2019, 10:31
Re: Server: Unknown Command. - by Kaliber - 01.03.2019, 10:41
Re: Server: Unknown Command. - by Longover - 01.03.2019, 10:53
Re: Server: Unknown Command. - by PPC23 - 01.03.2019, 17:37
Re: Server: Unknown Command. - by Longover - 02.03.2019, 08:07

Forum Jump:


Users browsing this thread: 1 Guest(s)