Help with a 0.3d barrier -
thimo - 06.12.2011
Hey i wanted to know if since 0.3d its possible to rotate the barriers smoothly and i mean this barrier:
Is it possible?
Thanks
Re: Help with a 0.3d barrier -
Laronic - 06.12.2011
Yes, its possible.
Tut:
https://sampforum.blast.hk/showthread.php?tid=295590
Re: Help with a 0.3d barrier -
thimo - 06.12.2011
Yes i used that but it doesnt turn at all i got this:
pawn Код:
// Close the gate
MoveObject(ATollGates[TollGate][GateID], ATollGates[TollGate][CloseX], ATollGates[TollGate][CloseY], ATollGates[TollGate][CloseZ]- 0.0001, 3.0, 90.0, -1000.0, -1000.0);
^For closed gate
pawn Код:
MoveObject(ATollGates[TollGate][GateID], ATollGates[TollGate][OpenX], ATollGates[TollGate][OpenY], ATollGates[TollGate][OpenZ]+ 0.0001, 3.0, 0.0, -1000.0, -1000.0);
For open gate
But it does turn... :S just keeps there like a rock.
How to fix that?
Re: Help with a 0.3d barrier -
Laronic - 06.12.2011
What is: OpenX, Y, Z & CloseX, Y, Z coords?
Re: Help with a 0.3d barrier -
thimo - 06.12.2011
These are the open coordinates and closed if you need the array:
pawn Код:
// This function is used to add toll-gates to the map
AddTollGate(GateModel, Float:OX, Float:OY, Float:OZ, Float:CX, Float:CY, Float:CZ, Float:RX, Float:RY, Float:RZ, TollMoney)
{
// Loop through all tollgates
for (new TollGate; TollGate < MAX_TOLLGATES; TollGate++)
{
// Check if this is an empty entry
if (ATollGates[TollGate][GateID] == 0)
{
// Create a new object for the toll-gate in it's closed status
ATollGates[TollGate][GateID] = CreateObject(GateModel, CX, CY, CZ, RX, RY, RZ);
// Set data
ATollGates[TollGate][TollPrice] = TollMoney; // Set the price to pay for passing the toll-gate
ATollGates[TollGate][GateStatus] = 0; // Set the status to CLOSED
ATollGates[TollGate][OpenX] = OX; // Save the OpenX coordinates
ATollGates[TollGate][OpenY] = OY; // Save the OpenY coordinates
ATollGates[TollGate][OpenZ] = OZ; // Save the OpenZ coordinates
ATollGates[TollGate][CloseX] = CX; // Save the CloseX coordinates
ATollGates[TollGate][CloseY] = CY; // Save the CloseY coordinates
ATollGates[TollGate][CloseZ] = CZ; // Save the CloseZ coordinates
break; // Stop the for-loop
}
}
}
Re: Help with a 0.3d barrier -
Laronic - 06.12.2011
pawn Код:
// This function is used to add toll-gates to the map
AddTollGate(GateModel, Float:OX, Float:OY, Float:OZ, Float:CX, Float:CY, Float:CZ, Float:RX, Float:RY, Float:RZ, TollMoney)
{
// Loop through all tollgates
for (new TollGate; TollGate < MAX_TOLLGATES; TollGate++)
{
// Check if this is an empty entry
if (ATollGates[TollGate][GateID] == 0)
{
// Create a new object for the toll-gate in it's closed status
ATollGates[TollGate][GateID] = CreateObject(GateModel, CX, CY, CZ, RX, RY, RZ);
// Set data
ATollGates[TollGate][TollPrice] = TollMoney; // Set the price to pay for passing the toll-gate
ATollGates[TollGate][GateStatus] = 0; // Set the status to CLOSED
ATollGates[TollGate][OpenX] = OX; // Save the OpenX coordinates
ATollGates[TollGate][OpenY] = OY + 0.0001; // Save the OpenY coordinates
ATollGates[TollGate][OpenZ] = OZ; // Save the OpenZ coordinates
ATollGates[TollGate][CloseX] = CX; // Save the CloseX coordinates
ATollGates[TollGate][CloseY] = CY - 0.0001; // Save the CloseY coordinates
ATollGates[TollGate][CloseZ] = CZ; // Save the CloseZ coordinates
break; // Stop the for-loop
}
}
}
//Close
MoveObject(ATollGates[TollGate][GateID], ATollGates[TollGate][CloseX], ATollGates[TollGate][CloseY], ATollGates[TollGate][CloseZ], 0.0001, 90.0, -1000.0, -1000.0);
//Open
MoveObject(ATollGates[TollGate][GateID], ATollGates[TollGate][OpenX], ATollGates[TollGate][OpenY], ATollGates[TollGate][OpenZ], 0.0001, 0.0, -1000.0, -1000.0);
Re: Help with a 0.3d barrier -
thimo - 06.12.2011
Its still not working this is what i've got:
pawn Код:
forward Toll();
public Toll()
{
// Loop through all players
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
// If the player isn't connected, skip to the next player
if(APlayerData[playerid][LoggedIn] == false) continue;
// Check if the player is the driver of a vehicle
if (GetPlayerVehicleSeat(playerid) == 0)
{
// Loop through all toll-gates
for (new TollGate; TollGate < MAX_TOLLGATES; TollGate++)
{
// Check if this toll-gate exists
if (ATollGates[TollGate][GateID] != 0)
{
// Check if the player is in range of the tollgate
if(IsPlayerInRangeOfPoint(playerid, 7.5, ATollGates[TollGate][CloseX], ATollGates[TollGate][CloseY], ATollGates[TollGate][CloseZ]))
{
// Check if the toll-gate is closed
if(ATollGates[TollGate][GateStatus] == 0)
{
// Open the gate
MoveObject(ATollGates[TollGate][GateID], ATollGates[TollGate][OpenX], ATollGates[TollGate][OpenY], ATollGates[TollGate][OpenZ], 0.0001, -1000.0, 0.0, -1000.0);
// Set status to OPEN
ATollGates[TollGate][GateStatus] = 1;
// Let the player pay the toll
RewardPlayer(playerid, -ATollGates[TollGate][TollPrice], 0);
new string[50];
format(string, sizeof(string), TXT_PlayerPaysToll, ATollGates[TollGate][TollPrice]);
GameTextForPlayer(playerid, string, 3000, 4);
// Start a timer that closes the gate after 5 seconds
SetTimerEx("CloseGate", 5000, false, "i", TollGate);
}
}
}
}
}
}
}
forward CloseGate(TollGate);
public CloseGate(TollGate)
{
// Close the gate
MoveObject(ATollGates[TollGate][GateID], ATollGates[TollGate][CloseX], ATollGates[TollGate][CloseY], ATollGates[TollGate][CloseZ], 0.0001, -1000.0, 90.0, -1000.0);
// Set status to CLOSED
ATollGates[TollGate][GateStatus] = 0;
}
The function:
pawn Код:
// This function is used to add toll-gates to the map
AddTollGate(GateModel, Float:OX, Float:OY, Float:OZ, Float:CX, Float:CY, Float:CZ, Float:RX, Float:RY, Float:RZ, TollMoney)
{
// Loop through all tollgates
for (new TollGate; TollGate < MAX_TOLLGATES; TollGate++)
{
// Check if this is an empty entry
if (ATollGates[TollGate][GateID] == 0)
{
// Create a new object for the toll-gate in it's closed status
ATollGates[TollGate][GateID] = CreateObject(GateModel, CX, CY, CZ, RX, RY, RZ);
// Set data
ATollGates[TollGate][TollPrice] = TollMoney; // Set the price to pay for passing the toll-gate
ATollGates[TollGate][GateStatus] = 0; // Set the status to CLOSED
ATollGates[TollGate][OpenX] = OX; // Save the OpenX coordinates
ATollGates[TollGate][OpenY] = OY + 0.0001; // Save the OpenY coordinates
ATollGates[TollGate][OpenZ] = OZ; // Save the OpenZ coordinates
ATollGates[TollGate][CloseX] = CX; // Save the CloseX coordinates
ATollGates[TollGate][CloseY] = CY + 0.0001; // Save the CloseY coordinates
ATollGates[TollGate][CloseZ] = CZ; // Save the CloseZ coordinates
break; // Stop the for-loop
}
}
}
Help!
Edit:
Adding lines:
pawn Код:
AddTollGate(968, -2668.25, 1274.50, 55.0, -2668.25, 1274.50, 55.0, 0.0, 0.0, 0.0, 30);
AddTollGate(968, -2677.75, 1274.50, 55.0, -2677.75, 1274.50, 55.0, 0.0, 0.0, 0.0, 30);
AddTollGate(968, -2686.25, 1274.50, 55.0, -2686.25, 1274.50, 55.0, 0.0, 0.0, 0.0, 30);
AddTollGate(968, -2694.75, 1274.50, 55.0, -2694.75, 1274.50, 55.0, 0.0, 0.0, 0.0, 30);
Re: Help with a 0.3d barrier -
thimo - 07.12.2011
Help please