10.02.2013, 15:20
My /fish command works when I'm driving the boat, but how do I make it so it works if you're on the boat but not driving it like in the photo below?
Fish command:
Fish command:
pawn Код:
CMD:fish(playerid, params[])
{
new string[128], query[500], pname[24];
GetPlayerName(playerid, pname, 24);
if(!IsPlayerLoggedIn(playerid))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You are not logged in.");
return 1;
}
if(!IsPlayerInRangeOfPoint(playerid, 2.0, 2103.9148, -103.5168, 2.2754) && !IsPlayerInVehicle(playerid, Reefer))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You are not at a fishing spot.");
return 1;
}
if(PlayerInfo[playerid][pFishPermit] < 1)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You do not have a fishing permit.");
return 1;
}
if(PlayerInfo[playerid][pFishingRod] < 1)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You do not have a fishing rod.");
return 1;
}
if(PlayerInfo[playerid][pBait] < 1)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You do not have any bait.");
return 1;
}
if(PlayerInfo[playerid][pFishes] == 5)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You cannot hold any more fish in your inventory.");
return 1;
}
if(PlayerInfo[playerid][pRodDurab] == 1)
{
format(string, sizeof(string), "* %s's rod has worn out and snapped into two pieces.", Name(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
PlayerInfo[playerid][pFishingRod] = 0;
PlayerInfo[playerid][pRodDurab] = 0;
format(query, sizeof(query), "UPDATE playerdata SET FishingRod=%d, RodDurab=%d WHERE Username='%s'",
PlayerInfo[playerid][pFishingRod],
PlayerInfo[playerid][pRodDurab],
pname);
mysql_query(query);
return 1;
}
TogglePlayerControllable(playerid, 0);
PlayerInfo[playerid][pRodDurab] -= 1;
PlayerInfo[playerid][pBait] -= 1;
format(query, sizeof(query), "UPDATE playerdata SET RodDurab=%d, Bait=%d WHERE Username='%s'",
PlayerInfo[playerid][pRodDurab],
PlayerInfo[playerid][pBait],
pname);
mysql_query(query);
format(string, sizeof(string), "* %s casts their rod out into the sea.", Name(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SetTimerEx("FishingTime", 15000, false, "i", playerid);
return 1;
}