Attach command
#1

How i can make command when one vehicle is near to other and the drive write /attach to attach the vehicle behind him
Reply
#2

first vehicle to attach the second vehicle and when the first vehicle run the second vehicle go after first vehicle
Reply
#3

pawn Код:
CMD:attach(playerid,params[])
{

    new Float:pX,Float:pY,Float:pZ;
    GetPlayerPos(playerid,pX,pY,pZ);
    new Float:vXx,Float:vYx,Float:vZx;
    new Found=0;
    new vid=0;
    while((vid<MAX_VEHICLES)&&(!Found))
    {
        vid++;
        GetVehiclePos(vid,vXx,vYx,vZx);
        if  ((floatabs(pX-vXx)<7.0)&&(floatabs(pY-vYx)<7.0)&&(floatabs(pZ-vZx)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
        {
            Found=1;
            if  (IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
            {
                DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
            }
            AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
        }
    }
    if (!Found)
    {
        SendClientMessage(playerid,red,"Can't Attach!Any Vehicle Found!");
    }
    return 1;
}
Reply
#4

Same code, But the changes in your code are: It's STRCMP and there are much spaces, Bad code lolz, But anyway good work, You converted into STCMP.
Reply
#5

thank you
Reply
#6

but when in vehicle have a player a can't attach the vehicle
Reply
#7

Can make even a man can still be attached
Reply
#8

no you can't
vehicles with players inside can't be towed... sorry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)