08.07.2016, 11:08
Quote:
No, you can fish only with water. Initiated the Mapandreas ?
MapAndreas_Init(MAP_ANDREAS_MODE_FULL); //ongamemodeinit |
pawn Код:
MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
pawn Код:
stock IsWaterInFrontOfPlayer(playerid, Float: range = 5.0)
{
new Float:fPX, Float:fPY, Float:fPZ,
Float:fVX, Float:fVY, Float:fVZ,
Float:object_x, Float:object_y, Float:object_z;
GetPlayerCameraPos(playerid, fPX, fPY, fPZ);
GetPlayerCameraFrontVector(playerid, fVX, fVY, fVZ);
object_x = fPX + floatmul(fVX, range);
object_y = fPY + floatmul(fVY, range);
MapAndreas_FindZ_For2DCoord(object_x, object_y, object_z);
if(object_z <= 0.0) return true;
return false;
}
pawn Код:
if (strcmp("/fish", cmdtext, true, 10) == 0)
{
if(IsPlayerConnected(playerid)){
if(IsWaterInFrontOfPlayer(playerid,5.0)) //<--- detection range
{
if(Fishes[playerid][pWeight1] > 0 && Fishes[playerid][pWeight2] > 0 && Fishes[playerid][pWeight3] > 0 && Fishes[playerid][pWeight4] > 0 && Fishes[playerid][pWeight5] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " You've already caught five fish, sell / eat / release them before catching more!");
return 1;
}
if(Fishing[playerid] == 0)
{
//Fishing[playerid] = 1;
SetTimerEx("FishTimer", 5000, false, "i", playerid);
SendClientMessage(playerid,0xFFFFFFFF, "You threw the line in the water.");
}
else
{
SendClientMessage(playerid,COLOR_GREY, "You already Fishing !");
}
return 1;
} else {
return SendClientMessage(playerid,COLOR_GREY, "You aren't at the water!");
}
}
return 1;
}