Help with my script.
#1

I made this script based on a tut and i get 6 errors that i dont know how to fix.

Can someone help me fiz this?

Script:
pawn Код:
#include <a_samp>
#include <streamer>
#include <a_mysql>
#include <sscanf2>
#include <zcmd>

#define SCRIPT_CARS 100
#define DEFAULT_VEHICLE_OWNER "Dealership"
#define DEFAULT_SELL_PRICE

#define MYSQL_IP                        "127.0.0.1"
#define MYSQL_USER                      "root"
#define MYSQL_PASSWORD                  "sports1651"
#define MYSQL_DB                        "rlts"
#define MYSQL_TABLE_NAME                "carsystem"

#define CREATE_TABLE_QUERY  \
  "CREATE TABLE IF NOT EXISTS `vehicles` (
  `id` int(5) NOT NULL AUTO_INCREMENT,
  `owner` varchar(25) NOT NULL,
  `model` int(5) NOT NULL,
  `price` int(11) NOT NULL,
  `x` float NOT NULL,
  `y` float NOT NULL,
  `z` float NOT NULL,
  `a` float NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


public OnFilterScriptInit()
{
   
    mysql_debug(1);
   
    mysql_connection = mysql_connect(MYSQL_IP, MYSQL_USER, MYSQL_DB, MYSQL_PASSWORD);
   
    QUERY(CREATE_TABLE_QUERY);
   
    return 1;
}

enum vInfo
{
    Id,
    Owner[25],
    Model,
    Price,
    Float:POS[4],
}
new VehicleInfo[SCRIPT_CARS][vInfo];

stock LoadVehicles()
{
    new Query[255];
    for(new id; id < SCRIPT_CARS; id++) // Makes an loop so all vehicles get loaded.
    {
        format(Query, sizeof(Query), "
SELECT * FROM vehicles WHERE id= %d", id);
        mysql_query(Query); // Querys the "
Query" Variable.
        mysql_store_result(); // Stores the result from Query
        if(mysql_num_rows()) // Checks if theres anyrow.
        if(mysql_fetch_row(Query,"
|")) // Splits the row
        {
            sscanf(Query, "
p<|>e<is[25]iiffff>", VehicleInfo[id]); // Pretty neat ehh? [ ID, OWNER, MODEL, PRICE, POS X, POS Y, POS Z, POS A ]
            new Color1 = random(126); new Color2 = random(126);
            CreateVehicle(VehicleInfo[id][Model],VehicleInfo[id][POS][0],VehicleInfo[id][POS][1],VehicleInfo[id][POS][2],VehicleInfo[id][POS][3],Color1,Color2, 60*10000);
        }
    }
}

command(createveh, playerid, params[])
{
    new vID, Query[200];
    if(sscanf(params, "
i", vID)) return SendClientMessage(playerid, COLOR_ADMIN, "Usage: /createveh [ ModelID ]");
    new Float:pPOS[4];
    GetPlayerPos(playerid, pPOS[0], pPOS[1], pPOS[2]);
    GetPlayerFacingAngle(playerid , pPOS[3]);
    format(Query, sizeof(Query), "
INSERT INTO vehicles (id, owner, model, price, x, y, z, a) VALUES (NULL, '%s', %d, %d, %f, %f, %f, %f);",DEFAULT_VEHICLE_OWNER,vID, DEFAULT_VEHICLE_PRICE, pPOS[0], pPOS[1], pPOS[2], pPOS[3]);
    mysql_query(Query);
    format(Query, sizeof(Query), "
Created an %d at x: %f y: %f z: %f a: %f);",vID,pPOS[0], pPOS[1], pPOS[2], pPOS[3]);
    SendClientMessage(playerid, COLOR_ADMIN, Query);
    return 1;
}
command(reloadvehicles, playerid, params[])
{
    for(new i; i < SCRIPT_CARS; i++)
    {
        if(IsVehicleConnected(i)) DestroyVehicle(i);
    }
    LoadVehicles();
    SendClientMessage(playerid, COLOR_ADMIN, "
Vehicle's reloaded");
}
Errors
Код:
C:\Users\ET183105\Desktop\New folder\ServerFinal\filterscripts\houses.pwn(19) : error 010: invalid function or declaration
C:\Users\ET183105\Desktop\New folder\ServerFinal\filterscripts\houses.pwn(36) : error 017: undefined symbol "mysql_connection"
C:\Users\ET183105\Desktop\New folder\ServerFinal\filterscripts\houses.pwn(38) : error 017: undefined symbol "QUERY"
C:\Users\ET183105\Desktop\New folder\ServerFinal\filterscripts\houses.pwn(38) : error 017: undefined symbol "CREATE"
C:\Users\ET183105\Desktop\New folder\ServerFinal\filterscripts\houses.pwn(38) : error 017: undefined symbol "TABLE"
C:\Users\ET183105\Desktop\New folder\ServerFinal\filterscripts\houses.pwn(38) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#2

Anyone?
Reply
#3

we are not an 24/7 support server. We have an life. So do I.
Whatever. I think something's wrong with the CREATE_TABLE_QUERY.
Don't define it in such a big "string". Just use QUERY("That code");
Good luck
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)