SA-MP Forums Archive
Attach problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Attach problem (/showthread.php?tid=168520)



Attach problem - Sascha - 16.08.2010

I... I did that:

Код:
dcmd_attach(playerid, params[])
{
	#pragma unused params
	new v = GetPlayerVehicleID(playerid);
	if(IsPlayerInAnyVehicle(playerid)){
	    if(!IsTrailerAttachedToVehicle(v)){
	        if(GetVehicleModel(v) == 531){
				for(new v2=0; v < MAX_VEHICLES; v++)
			    if(GetVehicleModel(v2) == 607){
			        new Float:x, Float:y, Float:z;
					GetVehiclePos(v2, x, y, z);
					if(IsPlayerInRangeOfPoint(playerid, 5.00, x, y, z)){
					    AttachTrailerToVehicle(v2, v);
					}
				}
   			}else{
			    SendClientMessage(playerid, GREY, "This command doesn't work for this vehicle");
			}
		}else{
		    SendClientMessage(playerid, GREY, "Use /detach first");
		}
	}else{
	    SendClientMessage(playerid, GREY, "Get in a Tractor");
	}
	return 1;
}
but... if I'm near the trailer with the tractor it doesn't do anything -.-


Re: Attach problem - Sascha - 16.08.2010

lalala...
so any ideas?


Re: Attach problem - Dark_Kostas - 16.08.2010

Try this one.
pawn Код:
dcmd_attach(playerid, params[])
{
    #pragma unused params
    if(IsPlayerInAnyVehicle(playerid))
    {
        new v = GetPlayerVehicleID(playerid);
        if(!IsTrailerAttachedToVehicle(v))
        {
            if(GetVehicleModel(v) == 531)
            {
                for(new v2=0; v2 < MAX_VEHICLES; v2++)
                {
                    if(GetVehicleModel(v2) == 607 && IsVehicleStreamedIn(v2, playerid))
                    {
                        new Float:x, Float:y, Float:z;
                        GetVehiclePos(v2, x, y, z);
                        if(IsPlayerInRangeOfPoint(playerid, 5.00, x, y, z))
                        {
                            AttachTrailerToVehicle(v2, v);
                        }
                    }
            }
            else SendClientMessage(playerid, GREY, "This command doesn't work for this vehicle");
        }
        else SendClientMessage(playerid, GREY, "Use /detach first");
    }
    else SendClientMessage(playerid, GREY, "Get in a Tractor");
    return 1;
}



Re: Attach problem - Sascha - 16.08.2010

still doesn't work..
I also tried to set the range up to 50
but doesn't work...


Re: Attach problem - Sascha - 17.08.2010

is it even possible to attach a baggage trailer to a tractor?