SA-MP Forums Archive
Invalid expression - 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: Invalid expression (/showthread.php?tid=398592)



Invalid expression - RenSoprano - 10.12.2012

If somebody can help me with this will be very good for me
thanks


pawn Код:
forward Fishing(playerid);
public Fishing(playerid)
{
    new string[1024];
    if(IsPlayerConnected(playerid))
    {
        new weight = randomEx(1000,1800);
        new money = randomEx(100, 300);
        new rand = randomEx(1, 7);
        new fish = random(FishNames);
       
        if(rand == 1)
        {
            SendClientMessage(playerid,0x2641FEAA,"You just caught some trash in your net and throwed it back in sea");
            IsFishing[playerid] = 0;
            TogglePlayerControllable(playerid,true);
            return 1;
        }
        else if(rand == 2)
        {
            format(string, sizeof(string),"You just caught in your net a %s, %s, %s.", randfish(fish), randfish(fish), randfish(fish)); // Here
            SendClientMessage(playerid, 0x2641FEAA, string);
            Fishes[playerid] += 3;
            IsFishing[playerid] = 0;
            FishWeight[playerid] += weight;
            TogglePlayerControllable(playerid,true);
            return 1;
        }
        else if(rand == 3)
        {
            format(string, sizeof(string), "You just caught in your net a %s, %s, %s, %s.", randfish(fish), randfish(fish), randfish(fish), randfish(fish));
            SendClientMessage(playerid, 0x2641FEAA, string);
            Fishes[playerid] += 4;
            IsFishing[playerid] = 0;
            FishWeight[playerid] += weight;
            TogglePlayerControllable(playerid,true);
            return 1;
        }
        else if(rand == 4)
        {
            format(string, sizeof(string), "You just caught in your net a %s, %s, %s, %s, %s.", randfish(fish), randfish(fish), randfish(fish), randfish(fish), randfish(fish));
            SendClientMessage(playerid, 0x2641FEAA, string);
            Fishes[playerid] += 5;
            IsFishing[playerid] = 0;
            FishWeight[playerid] += weight;
            TogglePlayerControllable(playerid,true);
            return 1;
        }
        else if(rand == 5)
        {
            format(string, sizeof(string), "You just caught in your net a %s, %s, %s, %s, %s, s%.", randfish(fish), randfish(fish), randfish(fish), randfish(fish), randfish(fish), randfish(fish));
            SendClientMessage(playerid, 0x2641FEAA, string);
            Fishes[playerid] += 6;
            IsFishing[playerid] = 0;
            FishWeight[playerid] += weight;
            TogglePlayerControllable(playerid,true);
            return 1;
        }
        else if(rand == 6)
        {
            format(string, sizeof(string), "You just caught in your net a %s, %s, %s, %s, %s, s%, %s.", randfish(fish), randfish(fish), randfish(fish), randfish(fish), randfish(fish), randfish(fish), randfish(fish));
            SendClientMessage(playerid, 0x2641FEAA, string);
            Fishes[playerid] += 7;
            IsFishing[playerid] = 0;
            FishWeight[playerid] += weight;
            TogglePlayerControllable(playerid,true);
            return 1;
        }
        else if(rand == 7)
        {
            format(string, sizeof(string), "You just caught in your net a money backpack with $%d in it.", money);
            SendClientMessage(playerid, 0x2641FEAA, string);
            GivePlayerMoney(playerid, money);
            IsFishing[playerid] = 0;
            TogglePlayerControllable(playerid,true);
            return 1;
        }
    }
    return 0;
}



Re: Invalid expression - gtakillerIV - 10.12.2012

Show us the line(S), and use 128 cells.

pawn Код:
new string[1024];



Re: Invalid expression - RenSoprano - 10.12.2012

Okay,

Here is the line

Код:
format(string, sizeof(string),"You just caught in your net a %s, %s, %s.", randfish(fish), randfish(fish), randfish(fish)); // Here



Re: Invalid expression - gtakillerIV - 10.12.2012

You added two commas,
pawn Код:
net a %s, %s, %s.", , randfish(fish), randfish(fish), randfish(fish)); // Here
Remove one.

It should be:

pawn Код:
format(string, sizeof(string),"You just caught in your net a %s, %s, %s.", randfish(fish), randfish(fish), randfish(fish));



Re: Invalid expression - RenSoprano - 10.12.2012

I solved it.
I have problem here randfish(fish), it must be randfish[fish]