Can someone tell me what's wrong with this ?
#1

pawn Код:
stock AddVehicle(Carid, Carmodel, Carcolor1, Carcolor2, Float:Carx, Float:Cary, Float:Carz, Float:Cara, CarCost, CarSell)
{
    new data[256], query[400];
    format(query, sizeof(query), "SELECT * FROM `vehicles` WHERE CarID = '%d';", Carid);
    mysql_query(query);
    mysql_store_result();

    if(mysql_num_rows() > 0)
    {
        mysql_fetch_field("CarID", data);
        VehicleSystem[Carid][CarID] = strval(data);
       
        mysql_fetch_field("Model", data);
        VehicleSystem[Carid][Model] = strval(data);
       
        mysql_fetch_field("Locked", data);
        VehicleSystem[Carid][Locked] = strval(data);
       
        mysql_fetch_field("CarX", data);
        VehicleSystem[Carid][CarX] = strval(data);
       
        mysql_fetch_field("CarY", data);
        VehicleSystem[Carid][CarY] = strval(data);
       
        mysql_fetch_field("CarZ",data);
        VehicleSystem[Carid][CarZ]=strval(data);
       
        mysql_fetch_field("CarA",data);
        VehicleSystem[Carid][CarA]=strval(data);
       
        mysql_fetch_field("Color1",data);
        VehicleSystem[Carid][Color1]=strval(data);
       
        mysql_fetch_field("Color2",data);
        VehicleSystem[Carid][Color2]=strval(data);
       
        mysql_fetch_field("Price",data);
        VehicleSystem[Carid][Price]=strval(data);
       
        mysql_fetch_field("Sell",data);
        VehicleSystem[Carid][Sell]=strval(data);
       
        mysql_fetch_field("Owner",data);
        strmid(VehicleSystem[Carid][Owner],data,0,20,20);

        new carr = CreateVehicle(VehicleSystem[Carid][Model],VehicleSystem[Carid][Carx],VehicleSystem[Carid][Cary],VehicleSystem[Carid][Carz]+5,VehicleSystem[Carid][Cara],VehicleSystem[Carid][Color1],VehicleSystem[Carid][Color2],600000);
        IsBuyableCar[carr]=Carid;
    }

    else
    {
        printf("");
        printf(" ::::::::::::::::::::::: Car Created :::::::::::::::::::::::");
        printf("");

        VehicleSystem[Carid][CarID] = Carid;
        VehicleSystem[Carid][Model] = Carmodel;
        VehicleSystem[Carid][Locked] = 0;
        VehicleSystem[Carid][CarX] = CarX;
        VehicleSystem[Carid][CarY] = CarY;
        VehicleSystem[Carid][CarZ] = CarZ;
        VehicleSystem[Carid][CarA] = CarA;
        VehicleSystem[Carid][Color1] = Carcolor1;
        VehicleSystem[Carid][Color2] = Carcolor2;
        VehicleSystem[Carid][Price] = CarCost;
        VehicleSystem[Carid][Sell] = CarSell;
        strmid(VehicleSystem[Carid][Owner], "Unbought", 0, 20, 20);

        format(query, sizeof(query),"INSERT INTO `vehicles` (`CarID` ,`Model` ,`Locked` ,`CarX` ,`CarY` ,`CarZ` ,`CarA` ,`Color1` ,`Color2` ,`Price` ,`Sell` ,`Owner`) VALUES ('%d',  '%d',  '0',  '%f',  '%f',  '%f',  '%f',  '%d',  '%d',  '%d', '%d', 'Unbought');",Carid, Carmodel, Carx, Cary, Carz, Cara, Carcolor1, Carcolor2, CarCost, CarSell);
        mysql_query(query);

        new Carr = CreateVehicle(VehicleSystem[Carid][Model], VehicleSystem[Carid][CarX], VehicleSystem[Carid][CarY], VehicleSystem[Carid][CarZ] + 5, VehicleSystem[Carid][CarA], VehicleSystem[Carid][Color1], VehicleSystem[Carid][Color2], 600000);
        IsBuyableCar[Carr] = Carid;

    }
    mysql_free_result();
    return 1;
}
It just gives me a bunch of errors just check if there's something incorrect so i can fix it, otherwise i will post the errors.
Reply
#2

Quote:

otherwise i will post the errors.

can i see the errors?
Reply
#3

Код:
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1758) : error 035: argument type mismatch (argument 1)
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1761) : error 035: argument type mismatch (argument 1)
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1764) : error 035: argument type mismatch (argument 1)
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1767) : error 035: argument type mismatch (argument 1)
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1770) : error 035: argument type mismatch (argument 1)
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1773) : error 035: argument type mismatch (argument 1)
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1776) : error 035: argument type mismatch (argument 1)
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1779) : error 035: argument type mismatch (argument 1)
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1782) : error 035: argument type mismatch (argument 1)
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1785) : error 035: argument type mismatch (argument 1)
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1788) : error 035: argument type mismatch (argument 1)
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1791) : error 035: argument type mismatch (argument 1)
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1794) : warning 213: tag mismatch
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1794) : warning 213: tag mismatch
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1794) : warning 213: tag mismatch
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1794) : warning 213: tag mismatch
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1807) : warning 213: tag mismatch
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1808) : warning 213: tag mismatch
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1809) : warning 213: tag mismatch
C:\Users\Saad\Desktop\Destiny Deathmatch\gamemodes\N-RPG.pwn(1810) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


12 Errors.
Reply
#4

One question, I'm not sure how this works but:
pawn Код:
format(query, sizeof(query), "SELECT * FROM `vehicles` WHERE CarID = '%d';", Carid);
'WHERE CarID = '%d';" .. Is ";" needed there?

And..:

Код:
mysql_fetch_field(number, dest[], connectionHandle)

number	Index of the field.
dest[]	The string where fetched data will be stored in.
connectionHandle	The connection handle this will be processed on.
Again, I do not work with MySQL, but this is what I think is wrong.
Reply
#5

Quote:
Originally Posted by zombieking
Посмотреть сообщение
One question, I'm not sure how this works but:
pawn Код:
format(query, sizeof(query), "SELECT * FROM `vehicles` WHERE CarID = '%d';", Carid);
'WHERE CarID = '%d';" .. Is ";" needed there?

And..:

Код:
mysql_fetch_field(number, dest[], connectionHandle)

number	Index of the field.
dest[]	The string where fetched data will be stored in.
connectionHandle	The connection handle this will be processed on.
Again, I do not work with MySQL, but this is what I think is wrong.
I am much more worse in MySQL then you :P.
But the third parameter the connectionHandle i don't think it is needed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)