Script Related
#1

Hey guys i'm trying to add a command /accept backpack, so here is my code:

http://pastebin.com/Ymsa4JU6

Errors:

./includes/commands.pwn(12114) : warning 217: loose indentation
./includes/commands.pwn(12116) : warning 217: loose indentation
./includes/commands.pwn(12319) : error 010: invalid function or declaration
Reply
#2

1. You are a messy scripter...
2. Brackets everywhere.
3. Pointless returns.
4. INDENTATION... INDENTATION

pawn Код:
if(strcmp(params, "backpack", true) == 0)
{
    if(BackpackOffer[playerid] != INVALID_PLAYER_ID)
    {
        if(IsPlayerConnected(BackpackOffer[playerid]))
        {
            if(GetPlayerCash(playerid) > BackpackPrice[playerid])
            {
                if(!ProxDetectorS(8.0, BackpackOffer[playerid], playerid))
                    return SendClientMessageEx(playerid, COLOR_GREY, "You are not near the Backpack dealer");

                format(szMessage, sizeof(szMessage), "* You bought a Backpack for $%s, from %s. (Check /backpackhelp for more help)", number_format(BackpackPrice[playerid]), GetPlayerNameEx(BackpackOffer[playerid]));
                SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
                format(szMessage, sizeof(szMessage), "* You sold your Backpack to %s for $%s.", GetPlayerNameEx(playerid), number_format(BackpackPrice[playerid]));
                SendClientMessageEx(BackpackOffer[playerid], COLOR_LIGHTBLUE, szMessage);
                GivePlayerCashEx(BackpackOffer[playerid], TYPE_ONHAND, BackpackPrice[playerid]);
                GivePlayerCashEx(playerid, TYPE_ONHAND, -BackpackPrice[playerid]);

                new seller = BackpackOffer[playerid];

                PBInfo[playerid][HasBackpack] = 1;
                PBInfo[playerid][Type] = PBInfo[seller][Type];
                PBInfo[playerid][Weed] = PBInfo[seller][Weed];
                PBInfo[playerid][Materials] = PBInfo[seller][Materials];
                PBInfo[playerid][Crack] = PBInfo[seller][Crack];
                PBInfo[playerid][Gun1] = PBInfo[seller][Gun1];
                PBInfo[playerid][Gun2] = PBInfo[seller][Gun2];
                PBInfo[playerid][Gun3] = PBInfo[seller][Gun3];
                PBInfo[playerid][Gun4] = PBInfo[seller][Gun4];
                PBInfo[playerid][Gun5] = PBInfo[seller][Gun5];
                PBInfo[playerid][Gun6] = PBInfo[seller][Gun6];
                PBInfo[playerid][Gun7] = PBInfo[seller][Gun7];
                PBInfo[playerid][Gun8] = PBInfo[seller][Gun8];
                BackpackOffer[playerid] = INVALID_PLAYER_ID;
                BackpackPrice[playerid] = 0;
                PBInfo[seller][HasBackpack] = 0;
                PBInfo[seller][Type] = 0;
                PBInfo[seller][Weed] = 0;
                PBInfo[seller][Materials] = 0;
                PBInfo[seller][Crack] = 0;
                PBInfo[seller][Gun1] = 0;
                PBInfo[seller][Gun2] = 0;
                PBInfo[seller][Gun3] = 0;
                PBInfo[seller][Gun4] = 0;
                PBInfo[seller][Gun5] = 0;
                PBInfo[seller][Gun6] = 0;
                PBInfo[seller][Gun7] = 0;
                PBInfo[seller][Gun8] = 0;
                return 1;
            }
            else
                SendClientMessageEx(playerid, COLOR_GREY, "   You can't afford the backpack!");
        }
    }
    else
        SendClientMessageEx(playerid, COLOR_GREY, "   No-one offered you to buy backpack!");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)