/buycar - 4 Annoying Errors
#1

Fixed.

Credits: mprofitt
Reply
#2

Error lines please
Reply
#3

Updated with error lines.
Reply
#4

Quote:
Originally Posted by ♂ Antonio [G-RP
]
I lowered it from 9 to 4, but I can't seem to fix these.

Code:

pawn Код:
dcmd_buycar(playerid, params[])
{
    new field[3][3];
    new mod;
    new col1;
    new col2;
    new tag[64];
    new stringsize[128];
    new getprice[128];
    new Query[128];
    new getname[128];
    new carname[64];
    if(IsPlayerInRangeOfPoint(playerid, 15, 540.1616,-1289.9795,17.2422))
    {
      if(sscanf(params, "ddd", mod, col1, col1)) return SendClientMessage(playerid, color_white, "[Info] Usage: /buycar [model] [color1] [color2]");
        format(stringsize, sizeof(stringsize), "SELECT * FROM `Vehicle_Prices` WHERE model = '%d'",mod);
        mysql_query(stringsize);
        mysql_store_result();
    if(mysql_num_rows() < 0)
        {
            SendClientMessage(playerid,color_red,"[Error]: Sorry, we do not have this vehicle model available yet. Try another one.");
            return 1;
        }
        if((IsCarColorValid(col1)) && (IsCarColorValid(col2))
        {
        format(getprice, sizeof(getprice), "SELECT `price` FROM `Vehicle_Prices` WHERE model = '%d'", mod);
            mysql_query(getprice);
            mysql_store_result();
            new price = strval(field[0]);
            if(PlayerInfo[playerid][pCash] > price)
            {
                AddVehicle(mod, 562.8253,-1289.3542,16.9182,0.6401, col1, col2, 5000, 1, PlayerInfo[playerid][pSQLid], 0, 0, 100, GetRandomLicensePlate(tag));
                GivePlayerMoney(playerid, -price);
                PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash] - price;
                format(Query, sizeof(Query), "UPDATE Accounts SET Cash = %d WHERE SQLid = %d", PlayerInfo[playerid][pCash],PlayerInfo[playerid][pSQLid]);
                mysql_query(Query, -1, -1, con);
                format(getname, sizeof(getname), "SELECT `name` FROM `Vehicle_Prices` WHERE model = '%d'", mod);
                mysql_query(getname, -1, -1, con);
                format(carname, sizeof(carname), getname);
                SendFormattedMessage(playerid, color_green, "[Info]: You have successfully purchased a %s from Grotti Dealership for $%d", carname, price);
                SendClientMessage(playerid, color_white, "[Info]: Your new vehicle is located near the exit");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, color_red, "[Error]: You don't have enough money to purchase this vehicle. Try another one.");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, color_red, "[Error]: You have entered an invalid vehicle color! Try another one.");
            return 1;
        }
    }
    else
    {
      SendClientMessage(playerid, color_red, "[Error]: You aren't at the Grotti Car Dealership.");
      return 1;
    }
}
Errors:

Код:
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(829) : error 028: invalid subscript (not an array or too many subscripts): "IsCarColorValid"
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(831) : warning 217: loose indentation
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(860) : error 010: invalid function or declaration
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(863) : error 010: invalid function or declaration
Fix 1:
pawn Код:
if((IsCarColorValid(col1) && (IsCarColorValid(col2))
Then i'd need 860 and 863, the lose indentation error comes from the whitespace that is not set correctly.

Edit: I see, this should fix everything except the lose indentation-one, but i guess you know how to fix that one.

Reply
#5

Quote:
Originally Posted by DeathOnaStick
Then i'd need 860 and 863, the lose indentation error comes from the whitespace that is not set correctly.
pawn Код:
else //860
{
  SendClientMessage(playerid, color_red, "[Error]: You aren't at the Grotti Car Dealership.");
  return 1; //863
}
Reply
#6

Oh shit...

Код:
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(810) : warning 219: local variable "col2" shadows a variable at a preceding level
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(829) : error 028: invalid subscript (not an array or too many subscripts): "IsCarColorValid"
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(830) : warning 215: expression has no effect
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(830) : warning 215: expression has no effect
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(830) : warning 215: expression has no effect
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(830) : warning 215: expression has no effect
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(830) : error 001: expected token: ";", but found ")"
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(830) : warning 217: loose indentation
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(830) : error 029: invalid expression, assumed zero
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(830) : warning 215: expression has no effect
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(860) : error 010: invalid function or declaration
C:\Users\Lachlan\Desktop\0.3a DRP\pawno\BNS.pwn(863) : error 010: invalid function or declaration
Reply
#7

Code updated + current errors.
Reply
#8

Any ideas? I would love this to be fixed tonight.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)