/afine
#1

Okay a friend helped me to do /afine but i got an error can some one help me:


Код:
C:\Documents and Settings\Karl\Desktop\gm Versions\v3.3\VFCRPv3.3.pwn(32510) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Line 32510 :
Код:
else
Code:

Код:
//--------[afine]-------------------------------------------
if(strcmp(cmd, "/afine", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] == 0 || PlayerInfo[playerid][pAdmin] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "You are not a level 2 admin!");
                return 1;
            }
            else {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /afine [playerid/PartOfName] [price] [reason]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /afine [playerid/PartOfName] [price] [reason]");
                return 1;
            }
            moneys = strval(tmp);
            if(moneys < 1) { SendClientMessage(playerid, COLOR_GREY, "Fine Money can't be below 1!"); return 1; }
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /afine [playerid/PartOfName] [price] [reason]");
                            return 1;
                        }
                        format(string, sizeof(string), "* You gave %s a Fine for $%d and the reason of: %s", giveplayer, moneys, (result));
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        format(string, sizeof(string), "* Admin %s has Fined you for $%d. Reason: %s", sendername, moneys, (result));
                        SendClientMessage(giveplayerid, COLOR_WHITE, string);
                        GivePlayerMoney(giveplayerid, -moneys); //CHANGE THIS LINE IF YOUR USING AN ANTICHEAT
                        return 1;
                }
            }
			}
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "Invalid ID");
                return 1;
            }
        }
        return 1;
    }
Reply
#2

the line 32509 (the } above) needs to be removed. thats all i hope ^^
Reply
#3

nope tried it already
Reply
#4

pawn Код:
if(strcmp(cmd, "/afine", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] == 0 || PlayerInfo[playerid][pAdmin] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "You are not a level 2 admin!");
            } else {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /afine [playerid/PartOfName] [price] [reason]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /afine [playerid/PartOfName] [price] [reason]");
                return 1;
            }
            moneys = strval(tmp);
            if(moneys < 1) { SendClientMessage(playerid, COLOR_GREY, "Fine Money can't be below 1!"); return 1; }
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /afine [playerid/PartOfName] [price] [reason]");
                            return 1;
                        }
                        format(string, sizeof(string), "* You gave %s a Fine for $%d and the reason of: %s", giveplayer, moneys, (result));
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        format(string, sizeof(string), "* Admin %s has Fined you for $%d. Reason: %s", sendername, moneys, (result));
                        SendClientMessage(giveplayerid, COLOR_WHITE, string);
                        GivePlayerMoney(giveplayerid, -moneys); //CHANGE THIS LINE IF YOUR USING AN ANTICHEAT
                        return 1;
                }
            }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "Invalid ID");
                return 1;
            }
        }
        return 1;
    }
Reply
#5

Btw to avoid problems like these dont "include" but "exclude":

Код:
if (!IsPlayerConnected(playerid)) { SendClientMessage(playerid, COLOR_GREY, "Invalid ID"); return 1; }
You dont need an else because return 1; makes it impossible to proceed

(umm if playerid is not connected send playerid a message, thats senseless, you should remove / change it)
Reply
#6

C:\Documents and Settings\Karl\Desktop\gm Versions\v3.3\VFCRPv3.3.pwn(3250 : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Still 508 is else too
Reply
#7

@arrows can u make it for me pls?
Reply
#8

can any one help?
Reply
#9

This part is wrong;

pawn Код:
if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /afine [playerid/PartOfName] [price] [reason]");
                            return 1;
                        }
                        format(string, sizeof(string), "* You gave %s a Fine for $%d and the reason of: %s", giveplayer, moneys, (result));
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        format(string, sizeof(string), "* Admin %s has Fined you for $%d. Reason: %s", sendername, moneys, (result));
                        SendClientMessage(giveplayerid, COLOR_WHITE, string);
                        GivePlayerMoney(giveplayerid, -moneys); //CHANGE THIS LINE IF YOUR USING AN ANTICHEAT
                        return 1;
                }
            }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "Invalid ID");
                return 1;
            }
You should remove one '}' bracket, cause you opened 2 at the beginning, but closed with 3
Reply
#10

which one should i remove ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)