23.10.2011, 09:02
pawn Код:
if(strcmp(cmd, "/vipsellfish", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsPlayerInRangeOfPoint(playerid, 3.0, 2581.3191, 53.2449, 27.0078))
{
SendClientMessage(playerid, COLOR_RED, " You are not at the VIP fishing store!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /vipsellfish [number]");
return 1;
}
new price;
new fishid = strvalEx(tmp);
if(fishid < 1 || fishid > 5) { SendClientMessage(playerid, COLOR_GREY, " Fish can't be below 1 or above 5!"); return 1; }
else if(fishid == 1 && Fishes[playerid][pWeight1] < 1) { SendClientMessage(playerid, COLOR_GREY, " You don't have a fish in that slot!"); return 1; }
else if(fishid == 2 && Fishes[playerid][pWeight2] < 1) { SendClientMessage(playerid, COLOR_GREY, " You don't have a fish in that slot!"); return 1; }
else if(fishid == 3 && Fishes[playerid][pWeight3] < 1) { SendClientMessage(playerid, COLOR_GREY, " You don't have a fish in that slot!"); return 1; }
else if(fishid == 4 && Fishes[playerid][pWeight4] < 1) { SendClientMessage(playerid, COLOR_GREY, " You don't have a fish in that slot!"); return 1; }
else if(fishid == 5 && Fishes[playerid][pWeight5] < 1) { SendClientMessage(playerid, COLOR_GREY, " You don't have a fish in that slot!"); return 1; }
switch (fishid)
{
case 1:
{
if(Fishes[playerid][pWeight1] < 20)
{
SendClientMessage(playerid, COLOR_WHITE, "We are only interested in Fish weighting 20 LBS or more.");
return 1;
}
price = FishCost(playerid, Fishes[playerid][pFid1]);
price = price * Fishes[playerid][pWeight1];
format(string, sizeof(string), "* You have sold your %s that weighs %d, for $%d.", Fishes[playerid][pFish1],Fishes[playerid][pWeight1],price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+price;
GivePlayerMoney(playerid, price);
ClearFishID(playerid, 1);
}
case 2:
{
if(Fishes[playerid][pWeight2] < 20)
{
SendClientMessage(playerid, COLOR_WHITE, "We are only interested in Fish weighing 20 LBS or more.");
return 1;
}
price = FishCost(playerid, Fishes[playerid][pFid2]);
price = price * Fishes[playerid][pWeight2];
format(string, sizeof(string), "* You have sold your %s that weighs %d, for $%d.", Fishes[playerid][pFish2],Fishes[playerid][pWeight2],price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+price;
GivePlayerMoney(playerid, price);
ClearFishID(playerid, 2);
}
case 3:
{
if(Fishes[playerid][pWeight3] < 20)
{
SendClientMessage(playerid, COLOR_WHITE, "We are only interested in Fish weighing 20 LBS or more.");
return 1;
}
price = FishCost(playerid, Fishes[playerid][pFid3]);
price = price * Fishes[playerid][pWeight3];
format(string, sizeof(string), "* You have sold your %s that weighs %d, for $%d.", Fishes[playerid][pFish3],Fishes[playerid][pWeight3],price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+price;
GivePlayerMoney(playerid, price);
ClearFishID(playerid, 3);
}
case 4:
{
if(Fishes[playerid][pWeight4] < 20)
{
SendClientMessage(playerid, COLOR_WHITE, "We are only interested in Fish weighing 20 LBS or more.");
return 1;
}
price = FishCost(playerid, Fishes[playerid][pFid4]);
price = price * Fishes[playerid][pWeight4];
format(string, sizeof(string), "* You have sold your %s that weighs %d, for $%d.", Fishes[playerid][pFish4],Fishes[playerid][pWeight4],price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+price;
GivePlayerMoney(playerid, price);
ClearFishID(playerid, 4);
}
case 5:
{
if(Fishes[playerid][pWeight5] < 20)
{
SendClientMessage(playerid, COLOR_WHITE, "We are only interested in Fish weighing 20 LBS or more.");
return 1;
}
price = FishCost(playerid, Fishes[playerid][pFid5]);
price = price * Fishes[playerid][pWeight5];
format(string, sizeof(string), "* You have sold your %s that weighs %d, for $%d.", Fishes[playerid][pFish5],Fishes[playerid][pWeight5],price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+price;
GivePlayerMoney(playerid, price);
ClearFishID(playerid, 5);
}
}
Fishes[playerid][pLastFish] = 0;
Fishes[playerid][pFishID] = 0;
return 1;
}
return 1;
}
I am using [pDonateRank]. It should only allow Donators sell their fish here. could anyone rearrange or modify the code for it to work? Thanks