17.01.2013, 03:45
Well the script was returning an error that tells you it was not reaching this code:
So obviously, the error would have to be above this line.
Basically with these few lines:
You are saying, if they don't have enough money, send "You don't have enough money to pay the toll ($1400)!". However, if they DO have enough money, send "You are not near a toll booth!".
It was just a simple misunderstanding of which function goes where. You have to really think about what you're coding while you're coding it.
And this bit was just weird, but whatever... 0_o
"Your vehicle's fuel tank is too low to pay the toll!"
EDIT:
NOTE: On these lines:
You are basically saying, if the gate is open, you have to pay $1400 to close it?
I would set a timer, or detect whether the player has gone through the gate, and then close it. Just a suggestion.
pawn Code:
if(IsPlayerInRangeOfPoint(playerid, 5, -1581.7371,-1609.9010,36.5233)) // Toll Barrier
Basically with these few lines:
pawn Code:
if(PlayerInfo[playerid][pMoney] < 1400) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to pay the toll ($1400)!");
{
SendClientMessage(playerid, COLOR_GREY, "You are not near a toll booth!");
return 1;
}
It was just a simple misunderstanding of which function goes where. You have to really think about what you're coding while you're coding it.
pawn Code:
CMD:paytoll(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle.");
if(PlayerInfo[playerid][pMoney] < 1400) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to pay the toll ($1400)!");
if(IsPlayerInRangeOfPoint(playerid, 5, -1581.7371,-1609.9010,36.5233)) // Toll Barrier
{
if(!TollGateStatus)
{
TollGateStatus = 1;
MoveDynamicObject(TollGate, -1577.1992188,-1606.6992188,36.7999992,0.0000000,270.0000000,97.9979248, 2);
}
else
{
TollGateStatus = 0;
MoveDynamicObject(TollGate, -1577.1999512,-1606.6999512,36.7999992,0.0000000,336.7500000,98.0000000, 2);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not near a toll booth!");
return 1;
}
GiveZaiatMoney(playerid, -1400);
if(Fuel[GetPlayerVehicleID(playerid)] <= 25) return SendClientMessage(playerid, COLOR_GREY, "Your vehicle's fuel tank is too low to pay the toll!");
format(string, sizeof(string), "* %s takes out $1400 from their wallet and hands it to the toll booth manager", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
"Your vehicle's fuel tank is too low to pay the toll!"
EDIT:
NOTE: On these lines:
pawn Code:
if(!TollGateStatus)
{
TollGateStatus = 1;
MoveDynamicObject(TollGate, -1577.1992188,-1606.6992188,36.7999992,0.0000000,270.0000000,97.9979248, 2);
}
else
{
TollGateStatus = 0;
MoveDynamicObject(TollGate, -1577.1999512,-1606.6999512,36.7999992,0.0000000,336.7500000,98.0000000, 2);
}
I would set a timer, or detect whether the player has gone through the gate, and then close it. Just a suggestion.