06.02.2013, 01:35
Hmm, but then how would this work:
pawn Код:
CMD:fish(playerid, params[])
{
new string[128], done, fish;
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))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You are not at a fishing spot.");
return 1;
}
if(PlayerInfo[playerid][pFish][0] < 1 && PlayerInfo[playerid][pFish][1] < 1 && PlayerInfo[playerid][pFish][2] < 1 && PlayerInfo[playerid][pFish][3] < 1 && PlayerInfo[playerid][pFish][4] < 1)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You cannot hold any more fish in your inventory.");
return 1;
}
PlayerInfo[playerid][pFish][done] = fish;
format(string, sizeof(string), "* %s attempts to fish off the jetty.", Name(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SetTimerEx("FishingTime", 20000, false, "i", playerid);
return 1;
}
pawn Код:
forward FishingTime(playerid);
public FishingTime(playerid)
{
new done, fish, string[256], query[300], pname[24];
GetPlayerName(playerid, pname, 24);
for(new i=0; i<5; i++) // Fish
{
if(!done)
{
if(!PlayerInfo[playerid][pFish][i]) done = i+1;
}
}
done = done-1;
fish = random(31)+10;
PlayerInfo[playerid][pFish][done] = fish;
format(query, sizeof(query), "UPDATE playerdata SET FishA=%d, FishB=%d, FishC=%d, FishD=%d, FishE=%d WHERE Username='%s'",
PlayerInfo[playerid][pFish][0],
PlayerInfo[playerid][pFish][1],
PlayerInfo[playerid][pFish][2],
PlayerInfo[playerid][pFish][3],
PlayerInfo[playerid][pFish][4],
pname);
mysql_query(query);
format(string, sizeof(string), "* %s has caught a %d lbs fish.", fish);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}