Sellfish is bugged, help please
#1

Hi a kind guy made me this awesome script in the script request topic, but i have a problem..
People are able to sell fish even if they have just 1 fish, it can be abused because that 1 fish would give them 1k or higher.

Could anybody tell me where the problem is? I want them to only be able to sell fish if they have 10 or higher

pawn Код:
if (!strcmp("/sellfish", cmd, true))
    {
  if(PlayerToPoint(45.0,playerid,2473.6179,-2708.7917,3.0000)) return SendClientMessage(playerid, COLOR_GREY,"[Error] You are not at the docks");
    if(PlayerInfo[playerid][pFish] <= 0) return SendClientMessage(playerid, COLOR_GREY,"[Error] You do not have any fishes");
    if(PlayerInfo[playerid][pFish] < 10)
    {
    PlayerInfo[playerid][pFish] --;
    }
    if(PlayerInfo[playerid][pFish] >= 10 && PlayerInfo[playerid][pFish] < 20)
    {
    new rand = random(500)+500;
    new str[256];//string
    format(str,sizeof(str),"You sold your fishes for %i.",rand);
    SendClientMessage(playerid,COLOR_WHITE,str);//send the string
    GivePlayerCash(playerid,rand);
    PlayerInfo[playerid][pFish]=0;
    } else {
    new rand = random(500)+1000;
    new str[256];//string
    format(str,sizeof(str),"You sold your fishes for %i.",rand);
    SendClientMessage(playerid,COLOR_WHITE,str);//send the string
    GivePlayerCash(playerid,rand);
    PlayerInfo[playerid][pFish]=0;
    }
    return 1;
    }
Reply
#2

Код:
if (!strcmp("/sellfish", cmd, true))
{
  if(PlayerToPoint(45.0,playerid,2473.6179,-2708.7917,3.0000)) return SendClientMessage(playerid, COLOR_GREY,"[Error] You are not at the docks");
if(PlayerInfo[playerid][pFish] <= 0) return SendClientMessage(playerid, COLOR_GREY,"[Error] You do not have any fishes");
if(PlayerInfo[playerid][pFish] < 10) return SendClientMessage(playerid, COLOR_GREY,"[Error] You do not have enough fishes to sell");
if(PlayerInfo[playerid][pFish] >= 10) 
{
PlayerInfo[playerid][pFish] --;
}
if(PlayerInfo[playerid][pFish] >= 10 && PlayerInfo[playerid][pFish] < 20)
{
new rand = random(500)+500;
new str[256];//string
format(str,sizeof(str),"You sold your fishes for %i.",rand);
SendClientMessage(playerid,COLOR_WHITE,str);//send the string
GivePlayerCash(playerid,rand);
PlayerInfo[playerid][pFish]=0;
} else {
new rand = random(500)+1000;
new str[256];//string
format(str,sizeof(str),"You sold your fishes for %i.",rand);
SendClientMessage(playerid,COLOR_WHITE,str);//send the string
GivePlayerCash(playerid,rand);
PlayerInfo[playerid][pFish]=0;
}
return 1;
}
Try this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)