SA-MP Forums Archive
LoadTrailer command - 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: LoadTrailer command (/showthread.php?tid=482549)



LoadTrailer command - Blademaster680 - 21.12.2013

Hey guys,

I am trying to make a CDL job but I dont now how to get it to see if the trailer id is correct.
Here is my code:
Код:
CMD:loadtrailer(playerid, params[])
{	
	new vehicleid;
	if(IsPlayerInRangeOfPoint(playerid, 10, -168.2511, -286.3422, 2.3614))
	{
		if(GetVehicleTrailer(GetVehicleModel(playerid)) == 584)
		{
			ShowPlayerDialog(playerid, DIALOG_FUEL_TRAILER, DIALOG_STYLE_INPUT, "Fuel Stations", "Broadway  /n", "Deliver", "Cancel");
		}
		else return SendClientMessage(playerid, COLOR_RED, "You do not have a trailer attached!");
	}
	else return SendClientMessage(playerid, -1, "You are not at the loading point.");
	return 1;
}
It keeps missing everything except
Код:
SendClientMessage(playerid, -1, "You are not at the loading point.");
Please could you help me.
Thank you


Re: LoadTrailer command - SilentSoul - 21.12.2013

pawn Код:
CMD:loadtrailer(playerid, params[])
{  
    new vehicleid;
    if(!IsPlayerInRangeOfPoint(playerid, 10, -168.2511, -286.3422, 2.3614)) return SendClientMessage(playerid, -1, "You are not at the loading point.");
    {
        if(GetVehicleModel(vehicleid) == 584)
        {
            ShowPlayerDialog(playerid, DIALOG_FUEL_TRAILER, DIALOG_STYLE_INPUT, "Fuel Stations", "Broadway  /n", "Deliver", "Cancel");
        }
        else return SendClientMessage(playerid, COLOR_RED, "You do not have a trailer attached!");
    }
    return 1;
}
EDIT: Ops , sorry i didn't read the thread correctly , to check if the player inside trailer you can use GetVehicleModel


Re: LoadTrailer command - Blademaster680 - 21.12.2013

But that will try get the vehicle I am in. I need it to get the trailer that is attached to the vehicle.


Re: LoadTrailer command - SilentSoul - 21.12.2013

Quote:
Originally Posted by Blademaster680
Посмотреть сообщение
But that will try get the vehicle I am in. I need it to get the trailer that is attached to the vehicle.
I still didn't get your point , could you show me GetVehicleTrailer function ?


Re: LoadTrailer command - Blademaster680 - 21.12.2013

That is the problem I dont know how to get the script to see if the trailer is attached or not and if it is then what the model of the trailer is