[Help] One truck
#1

Hello everybody, I got a prob with truckers job. I made it so the trucker must be in a truck(Linerunner) in order to pick up the fuel but its not required carring petrol trailer behind him, and its a lot non-rp. Do u know how to make it so the trucker have to pick up petrol trailer while /buyfuel and /sellfuel?
Reply
#2

You just need to make your commands only work if the trailer is attached, like this:
pawn Код:
if(GetVehicleTrailer(GetPlayerVehicleID(playerid) == <id of your trailer>)
{
  // if trailer is attached
  } else {
  // if trailer is NOT attached
}
If you need more help, just post your current command and I'll try to make it work.
Reply
#3

thxxxxxxxxxxx man u awsomeeee do I need to make any new variable in order to make this thing work or its on the pwn its self?
Reply
#4

when u say trailer id u mean on the server or on the samp client?
Reply
#5

thats the code It doesnt work
Код:
if(strcmp(cmd, "/buyfuel", true) == 0)
{
	if(PlayerInfo[playerid][pJob] != 16)
	{
		SendClientMessage(playerid, COLOR_GREY, "You are not a trucker.");
		return 1;
 	}
  else if(PlayerToPoint(25.0, playerid, 999.6520,-897.9469,42.2462))
  {
  	new oil;
  	oil = strval(tmp);
     if	(PlayerInfo[playerid][pOil] >= 100)
     {
     SendClientMessage(playerid, COLOR_GREY, "Your truck is filled up.");
     return 1;
     }
     else
     {
       if(GetPlayerMoney(playerid) < 499)
 		   {
       SendClientMessage(playerid, COLOR_GREY, "You dont have enought money ($500).");
       return 1;
       }
		 }
     new tmpcar = GetPlayerVehicleID(playerid);
       if(!IsATruck(tmpcar))
 		   {
       SendClientMessage(playerid, COLOR_GREY, "You are not in a Truck.");
       return 1;
       }
      else
      {
      if(GetVehicleTrailer(GetPlayerVehicleID(playerid) == 584))
        {
        SafeGivePlayerMoney(playerid, - 500);
	      PlayerInfo[playerid][pOil] = 100;
        format(string, sizeof(string), "You have filled your truck with fuel!", oil, oil * 150);
	      SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
 	  	  SaveOilSystem();
        return 1;
        }
	      else
	      {
        SendClientMessage(playerid, COLOR_GREY, "You are not carring a trailer.");
        return 1;
        }
				}
	 }
	 return 1;
	 }
Reply
#6

any advice guys?
Reply
#7

wtf cant u give an answer?!?! anyone of u
Reply
#8

What the fuck maybe some patience? This isn't a chatroom... I can't help you, because I don't understand your code. Also I'm not that "good" in pawno coding, so yeah.
Reply
#9

Yeah this code is messed up X/ (Godfather, eh?)
Change this:
pawn Код:
if(GetVehicleTrailer(GetPlayerVehicleID(playerid) == 584))
to:
pawn Код:
if(GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid))) == 584)
It should work, ain't checked it yet, but I'm working on that in my gamemode, so I'll have working solution soon.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)