if(IsTrailerAttachedToVehicle(vehicleid) == 403)
#1

Hi there, I've been trying to add "if(IsTrailerAttachedToVehicle(vehicleid) == 403)" into this command, but I'm not having much luck. To state the obvious, I want the command to only work if the player is inside vehicle id 403 pulling a trailer.

Thanks in advance to anyone able to help.

Код:
CMD:tduty(playerid, params[])//Trucker-duty dialog
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicleid) == 403)
    {
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Choose a route.", "Blueberry Packaging.\nMainstreet Ammunation.\nFlint Food Factory.\nOff-duty (Removes the CP)", "Confirm", "Close list");
    }
    else return SendClientMessage(playerid, 0xE64D51FF, "[*]Message: You need to be in a truck with a trailer to use this command!");
    return 1;
}
Reply
#2

And what does it do for now, if I may ask?

Try This.

Код:
CMD:tduty(playerid, params[])//Trucker-duty dialog
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid == 403)
    {
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Choose a route.", "Blueberry Packaging.\nMainstreet Ammunation.\nFlint Food Factory.\nOff-duty (Removes the CP)", "Confirm", "Close list");
    }
    else return SendClientMessage(playerid, 0xE64D51FF, "[*]Message: You need to be in a truck with a trailer to use this command!");
    return 1;
}
You were trying to get the vehicle's model ID, not Vehicle's ID.
Reply
#3

Quote:
Originally Posted by Ahrim
Посмотреть сообщение
And what does it do for now, if I may ask?

Try This.

Код:
CMD:tduty(playerid, params[])//Trucker-duty dialog
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid == 403)
    {
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Choose a route.", "Blueberry Packaging.\nMainstreet Ammunation.\nFlint Food Factory.\nOff-duty (Removes the CP)", "Confirm", "Close list");
    }
    else return SendClientMessage(playerid, 0xE64D51FF, "[*]Message: You need to be in a truck with a trailer to use this command!");
    return 1;
}
You were trying to get the vehicle's model ID, not Vehicle's ID.
The command works, at the moment it only allows me to use the command whilst being in the truck. But, I need it to be pulling a trailer too. If the truck isn't pulling a trailer, I don't want the command to work basically.

EDIT: That code is no good for be by the way, the one I currently have works fine. It has to be the vehicle mode ID for it to work on all vehicle id's "403", if I did it with your code, it would only work on the 403rd spawned car I beleive.
Reply
#4

What is the trailer's vehicle id?

Nevermind, try this

pawn Код:
CMD:tduty(playerid, params[])//Trucker-duty dialog
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicleid) == 403 && IsTrailerAttachedToVehicle(vehicleid))
    {
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Choose a route.", "Blueberry Packaging.\nMainstreet Ammunation.\nFlint Food Factory.\nOff-duty (Removes the CP)", "Confirm", "Close list");
    }
    else return SendClientMessage(playerid, 0xE64D51FF, "[*]Message: You need to be in a truck with a trailer to use this command!");
    return 1;
}
Reply
#5

Check for vehicle model not vehicle ID:
pawn Код:
CMD:tduty(playerid, params[])//Trucker-duty dialog
{
    new vehicleid = GetVehicleModelID(GetPlayerVehicleID(playerid));
    if(vehicleid == 403 && IsTrailerAttachedToVehicle(vehicleid))
    {
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Choose a route.", "Blueberry Packaging.\nMainstreet Ammunation.\nFlint Food Factory.\nOff-duty (Removes the CP)", "Confirm", "Close list");
    }
    else return SendClientMessage(playerid, 0xE64D51FF, "[*]Message: You need to be in a truck with a trailer to use this command!");
    return 1;
}
Reply
#6

Quote:
Originally Posted by Dragonsaurus
Посмотреть сообщение
Check for vehicle model not vehicle ID:
pawn Код:
CMD:tduty(playerid, params[])//Trucker-duty dialog
{
    new vehicleid = GetVehicleModelID(GetPlayerVehicleID(playerid));
    if(vehicleid == 403 && IsTrailerAttachedToVehicle(vehicleid))
    {
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Choose a route.", "Blueberry Packaging.\nMainstreet Ammunation.\nFlint Food Factory.\nOff-duty (Removes the CP)", "Confirm", "Close list");
    }
    else return SendClientMessage(playerid, 0xE64D51FF, "[*]Message: You need to be in a truck with a trailer to use this command!");
    return 1;
}
Hmmph, you're right. Oh well, he said he's trying to get it to Vehicle ID 403, not the model. But I think that's what he was trying to say.

EDIT:He edited. nvm.
Reply
#7

Quote:
Originally Posted by Dragonsaurus
Посмотреть сообщение
Check for vehicle model not vehicle ID:
pawn Код:
CMD:tduty(playerid, params[])//Trucker-duty dialog
{
    new vehicleid = GetVehicleModelID(GetPlayerVehicleID(playerid));
    if(vehicleid == 403 && IsTrailerAttachedToVehicle(vehicleid))
    {
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Choose a route.", "Blueberry Packaging.\nMainstreet Ammunation.\nFlint Food Factory.\nOff-duty (Removes the CP)", "Confirm", "Close list");
    }
    else return SendClientMessage(playerid, 0xE64D51FF, "[*]Message: You need to be in a truck with a trailer to use this command!");
    return 1;
}
Compiled that and received this:

Код:
C:\Users\Lee\Desktop\SAMP coding\gamemodes\truckerjob.pwn(387) : error 017: undefined symbol "GetVehicleModelID"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#8

try this

pawn Код:
CMD:tduty(playerid, params[])//Trucker-duty dialog
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicleid) == 403 && IsTrailerAttachedToVehicle(vehicleid))
    {
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Choose a route.", "Blueberry Packaging.\nMainstreet Ammunation.\nFlint Food Factory.\nOff-duty (Removes the CP)", "Confirm", "Close list");
    }
    else return SendClientMessage(playerid, 0xE64D51FF, "[*]Message: You need to be in a truck with a trailer to use this command!");
    return 1;
}
Reply
#9

Oops it is
pawn Код:
GetVehicleModel(GetPlayerVehicleID(playerid))
Edit: Ahrim's code is fine, I did some mistakes at mine xD
Reply
#10

Quote:
Originally Posted by Ahrim
Посмотреть сообщение
try this

pawn Код:
CMD:tduty(playerid, params[])//Trucker-duty dialog
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicleid) == 403 && IsTrailerAttachedToVehicle(vehicleid))
    {
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Choose a route.", "Blueberry Packaging.\nMainstreet Ammunation.\nFlint Food Factory.\nOff-duty (Removes the CP)", "Confirm", "Close list");
    }
    else return SendClientMessage(playerid, 0xE64D51FF, "[*]Message: You need to be in a truck with a trailer to use this command!");
    return 1;
}
Works, thank you and everyone else who tried to help. Much appreciated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)