SA-MP Forums Archive
Sellfish Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Sellfish Help (/showthread.php?tid=292232)



Sellfish Help - Medardo4Life - 23.10.2011

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;
    }
So what I would like to do is make the certain location of sellfish only be available for Donator ranks.

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


Re: Sellfish Help - Medardo4Life - 23.10.2011

bump


Re: Sellfish Help - =WoR=Varth - 23.10.2011

pawn Код:
if(pDonateRank[playerid] == 0) return SendClientMessage(playerid,-1,"Gimme money and you can sell fish here");



Re: Sellfish Help - Medardo4Life - 23.10.2011

Quote:
Originally Posted by =WoR=Varth
Посмотреть сообщение
pawn Код:
if(pDonateRank[playerid] == 0) return SendClientMessage(playerid,-1,"Gimme money and you can sell fish here");
So where would i add this? could you repost the pawn with the changes?


Re: Sellfish Help - =WoR=Varth - 23.10.2011

pawn Код:
if(strcmp(cmd, "/vipsellfish", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
    if(pDonateRank[playerid] == 0) return SendClientMessage(playerid,-1,"Gimme money and you can sell fish here");
            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;
    }



Re: Sellfish Help - Medardo4Life - 23.10.2011

pwn(43921) : error 028: invalid subscript (not an array or too many subscripts): "pDonateRank"
pwn(43921) : warning 215: expression has no effect
pwn(43921) : error 001: expected token: ";", but found "]"
pwn(43921) : error 029: invalid expression, assumed zero
pwn(43921) : fatal error 107: too many error messages on one line


Re: Sellfish Help - =WoR=Varth - 23.10.2011

Show us your pDonateRank variable.


Re: Sellfish Help - Medardo4Life - 24.10.2011

Got it Thanks Varth