08.06.2013, 22:21
Hello all mates in samp forum who is looking at this post maybe someone could help me out...
So basically if you type sellfish -99999999999 and you get back 9999999999999.. I know I need to make a checker who doesnt let you sell - fishes but the question is how it could check it....
So basically if you type sellfish -99999999999 and you get back 9999999999999.. I know I need to make a checker who doesnt let you sell - fishes but the question is how it could check it....
pawn Код:
CMD:sellfish(playerid, params[])
{
if (!IsAt247(playerid))
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a 24-7!");
return 1;
}
new string[128], fishid;
if(sscanf(params, "d", fishid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /sellfish [fish]");
new price;
if(fishid < 1 || fishid > 5) { SendClientMessageEx(playerid, COLOR_GREY, " Fish number cant be below 1 or above 5!"); return 1; }
else if(fishid == 1 && Fishes[playerid][pWeight1] < 1) { SendClientMessageEx(playerid, COLOR_GREY, " You didnt even catch a Fish at that number(1)!"); return 1; }
else if(fishid == 2 && Fishes[playerid][pWeight2] < 1) { SendClientMessageEx(playerid, COLOR_GREY, " You didnt even catch a Fish at that number(2)!"); return 1; }
else if(fishid == 3 && Fishes[playerid][pWeight3] < 1) { SendClientMessageEx(playerid, COLOR_GREY, " You didnt even catch a Fish at that number(3)!"); return 1; }
else if(fishid == 4 && Fishes[playerid][pWeight4] < 1) { SendClientMessageEx(playerid, COLOR_GREY, " You didnt even catch a Fish at that number(4)!"); return 1; }
else if(fishid == 5 && Fishes[playerid][pWeight5] < 1) { SendClientMessageEx(playerid, COLOR_GREY, " You didnt even catch a Fish at that number(5)!"); return 1; }
switch (fishid)
{
case 1:
{
if(Fishes[playerid][pWeight1] < 20)
{
SendClientMessageEx(playerid, COLOR_WHITE, "We are only interested in Fishes weighting 20 LBS or more.");
return 1;
}
price = FishCost(playerid, Fishes[playerid][pFid1]);
price = price * Fishes[playerid][pWeight1];
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = price / 100;
new payout = (skill)*(5);
price += payout;
}
GameTextForPlayer(playerid, "~g~Fish~n~~r~Sold", 3000, 1);
format(string, sizeof(string), "* You have sold your %s that weights %d, for $%d.", Fishes[playerid][pFish1],Fishes[playerid][pWeight1],price);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
GivePlayerCash(playerid, price);
ClearFishID(playerid, 1);
}
case 2:
{
if(Fishes[playerid][pWeight2] < 20)
{
SendClientMessageEx(playerid, COLOR_WHITE, "We are only interested in Fishes weighting 20 LBS or more.");
return 1;
}
price = FishCost(playerid, Fishes[playerid][pFid2]);
price = price * Fishes[playerid][pWeight2];
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = price / 100;
new payout = (skill)*(5);
price += payout;
}
GameTextForPlayer(playerid, "~g~Fish~n~~r~Sold", 3000, 1);
format(string, sizeof(string), "* You have sold your %s that weights %d, for $%d.", Fishes[playerid][pFish2],Fishes[playerid][pWeight2],price);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
GivePlayerCash(playerid, price);
ClearFishID(playerid, 2);
}
case 3:
{
if(Fishes[playerid][pWeight3] < 20)
{
SendClientMessageEx(playerid, COLOR_WHITE, "We are only interested in Fishes weighting 20 LBS or more.");
return 1;
}
price = FishCost(playerid, Fishes[playerid][pFid3]);
price = price * Fishes[playerid][pWeight3];
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = price / 100;
new payout = (skill)*(5);
price += payout;
}
GameTextForPlayer(playerid, "~g~Fish~n~~r~Sold", 3000, 1);
format(string, sizeof(string), "* You have sold your %s that weights %d, for $%d.", Fishes[playerid][pFish3],Fishes[playerid][pWeight3],price);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
GivePlayerCash(playerid, price);
ClearFishID(playerid, 3);
}
case 4:
{
if(Fishes[playerid][pWeight4] < 20)
{
SendClientMessageEx(playerid, COLOR_WHITE, "We are only interested in Fishes weighting 20 LBS or more.");
return 1;
}
price = FishCost(playerid, Fishes[playerid][pFid4]);
price = price * Fishes[playerid][pWeight4];
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = price / 100;
new payout = (skill)*(5);
price += payout;
}
GameTextForPlayer(playerid, "~g~Fish~n~~r~Sold", 3000, 1);
format(string, sizeof(string), "* You have sold your %s that weights %d, for $%d.", Fishes[playerid][pFish4],Fishes[playerid][pWeight4],price);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
GivePlayerCash(playerid, price);
ClearFishID(playerid, 4);
}
case 5:
{
if(Fishes[playerid][pWeight5] < 20)
{
SendClientMessageEx(playerid, COLOR_WHITE, "We are only interested in Fishes weighting 20 LBS or more.");
return 1;
}
price = FishCost(playerid, Fishes[playerid][pFid5]);
price = price * Fishes[playerid][pWeight5];
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = price / 100;
new payout = (skill)*(5);
price += payout;
}
GameTextForPlayer(playerid, "~g~Fish~n~~r~Sold", 3000, 1);
format(string, sizeof(string), "* You have sold your %s that weights %d, for $%d.", Fishes[playerid][pFish5],Fishes[playerid][pWeight5],price);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
GivePlayerCash(playerid, price);
ClearFishID(playerid, 5);
}
}
Fishes[playerid][pLastFish] = 0;
Fishes[playerid][pFishID] = 0;
return 1;
}