enter with car and towed car inside interiors
#1

hi gus, i have a problem with this system, towed cars donґt enter.

thanks for any help.

Quote:

CMD:enterc(playerid)
{
new str[128], bID = InRangeOfBiz(playerid), id = InRangeOfHouse(playerid), vID = GetPlayerVehicleID(playerid), vtID;
GetVehicleTrailer(vtID);
if(GetPlayerVehicleID(playerid))
{
if(Business[bID][Type] == 11)
{
if(Business[bID][Locked] == 0)
{
if(IsTrailerAttachedToVehicle(vtID))
{
SetVehicleVirtualWorld(vtID, Business[bID][World]);
LinkVehicleToInterior(vtID, Business[bID][Interior]);
SetVehiclePos(vtID, Business[bID][InteriorX], Business[bID][InteriorY], Business[bID][InteriorZ]);
SetVehicleVirtualWorld(vID, Business[bID][World]);
LinkVehicleToInterior(vID, Business[bID][Interior]);
SetVehiclePos(vID, Business[bID][InteriorX], Business[bID][InteriorY], Business[bID][InteriorZ]);
SetPlayerPosEx(playerid, Business[bID][PosX], Business[bID][PosY], Business[bID][PosZ], 0, 0);
Character[playerid][bEntered] = 0;
}
else
{
if(Business[bID][Owned] == 1)
{

if(Business[bID][EntranceFee] <= Character[playerid][Cash])
{

AddBusinessMoney(bID, Business[bID][EntranceFee]);
GivePlayerMoneyEx(playerid, -Business[bID][EntranceFee]);

format(str, sizeof(str), "Welcome to the %s.", Business[bID][Name]);
if(Business[bID][Owned] != 3) SendClientMessage(playerid, COLOR_WHITE, str);
{
SetPlayerPosEx(playerid, Business[bID][InteriorX], Business[bID][InteriorY], Business[bID][InteriorZ], Business[bID][Interior], Business[bID][World]);
SetVehicleVirtualWorld(vID, Business[bID][World]);
LinkVehicleToInterior(vID, Business[bID][Interior]);
SetVehiclePos(vID, Business[bID][InteriorX], Business[bID][InteriorY], Business[bID][InteriorZ]);
}

if(bID == Character[playerid][Business_1] || bID == Character[playerid][Business_2])
{
SendClientMessage(playerid, COLOR_YELLOW, "You appear to own this business, for a list of commands use /bhelp!");
}
Character[playerid][bEntered] = bID;
}
else
{
SendErrorMessage(playerid, ERROR_MONEY);
}
}
else
{

SetPlayerPosEx(playerid, Business[bID][InteriorX], Business[bID][InteriorY], Business[bID][InteriorZ], Business[bID][Interior], Business[bID][World]);
SetVehicleVirtualWorld(vID, Business[bID][World]);
LinkVehicleToInterior(vID, Business[bID][Interior]);
SetVehiclePos(vID, Business[bID][InteriorX], Business[bID][InteriorY], Business[bID][InteriorZ]);
Character[playerid][bEntered] = bID;
format(str, sizeof(str), "Welcome to the %s.", Business[bID][Name]);
SendClientMessage(playerid, COLOR_WHITE, str);
}
}
}
else
{
format(str, sizeof(str), "* %s attempts to open the door of the business.*", GetRoleplayName(playerid));
SendLocalMessage(playerid, str, Range_Short, COLOR_RP, COLOR_RP);

format(str, sizeof(str), "* As the door is locked, it doesn't open. ((%s))",GetRoleplayName(playerid));
SendLocalMessage(playerid, str, Range_Short, COLOR_RP, COLOR_RP);
}

}
}
if(id > 0)
{
if(Houses[id][Locked] == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, Houses[id][PosX], Houses[id][PosY], Houses[id][PosZ]))
{
SetPlayerPosEx(playerid, Houses[id][IntX], Houses[id][IntY], Houses[id][IntZ], Houses[id][Interior], Houses[id][World]);
Character[playerid][hEntered] = id;
}
}
else
{
format(str, sizeof(str), "* %s attempts to open the house door.*", GetRoleplayName(playerid));
SendLocalMessage(playerid, str, Range_Short, COLOR_RP, COLOR_RP);

format(str, sizeof(str), "* As the door is locked, it doesn't open. ((%s))",GetRoleplayName(playerid));
SendLocalMessage(playerid, str, Range_Short, COLOR_RP, COLOR_RP);
}
}
return 1;
}

Reply
#2

GetVehicleTrailer(vtID);
You're using this function wrong

Код:
vtID = GetVehicleTrailer(vID);
https://sampwiki.blast.hk/wiki/GetVehicleTrailer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)