SA-MP Forums Archive
Tow with tractor - 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)
+--- Thread: Tow with tractor (/showthread.php?tid=463006)



Tow with tractor - lider1241 - 09.09.2013

How do i can make that?

[ame]http://www.youtube.com/watch?v=coPvyUeBMws[/ame]

what funcitions i should use? or just make it for me? :P


Re: Tow with tractor - Konstantinos - 09.09.2013

I think: AttachTrailerToVehicle


Re: Tow with tractor - FuznesS - 09.09.2013

Код:
CMD:tow(playerid, params[])
{
    new vehicle, trailerid;
    if(sscanf(params,"i", trailerid)) return SendClientMessage(playerid,-1,"USAGE: /tow [trailerid]");
	vehicle = GetPlayerVehicleID(playerid);
	if(!IsTrailerAttachedToVehicle(vehicle))
	{
	    AttachTrailerToVehicle(trailerid, vehicle);
	    SendClientMessage(playerid, -1, "You have successfully attached your trailer to your vehicle");
	}
	return 1;
}
I'm using here sscanf and zcmd, you can change it, but Enjoy.

EDIT: if you don't want with sscanf
Код:
CMD:tow(playerid, params[])
{
    new vehicle;
    if(isnull(params))
        return SendClientMessage(playerid, -1, "USAGE: /tow [trailerid]");
	vehicle = GetPlayerVehicleID(playerid);
	if(!IsTrailerAttachedToVehicle(vehicle))
	{
	    AttachTrailerToVehicle(strval(params), vehicle);
	    SendClientMessage(playerid, -1, "You have successfully attached your trailer to your vehicle");
	}
	return 1;
}