Tag Mismatch
#1

Hey guys, i am trying to create a simple server vehicle system that loads from a mysql database, however i have some minor issues.

Code:
function Vehicle_Load()
{
        new rows = cache_get_row_count(VDatabase); //<-- warning 213: tag mismatch
        if(rows != 0)
        {
            forex(row,rows)
            {
                new vehicleid = cache_get_value_int(row, 0, VDatabase); //<-- warning 213: tag mismatch
                new ORM:ormid = ServerVehicle[vehicleid][ORM_ID] = orm_create("server_vehicles");
But i basically get 2x tag mismatch errors here.
I have created a new MySQL:VDatabase;
however im getting an error on this line "new rows = cache_get_row_count(VDatabase);"
I've seen somewhere that there has been an update and i need to alter it to new rows; and work from there.
But i also seem to have the exact same error on a different line.
"new vehicleid = cache_get_value_int(row, 0, VDatabase);"
I'm not really sure what to do in this case as i have been out of the scene for a while now.

Also have an argument type mismatch (Argument 2)
"orm_delete(ServerVehicle[vehicleid][ORM_ID],true);"
Code:
case 2:
                    {
                    if(IsNull(string)) return SEM(playerid,"<USAGE>: /vehicle delete [vehicleid]");
                    new vehicleid = strval(string);
                    if(Iter_Contains(Vehicles,vehicleid))
                    {
                    format(string,sizeof(string),"<VEHICLEINFO>: {ffffff}(Server) Vehicle with {ffff00}id %d {ffffff}has been deleted!",vehicleid);
                    SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
                    DestroyVehicle(VehicleID[vehicleid]);
                    orm_delete(ServerVehicle[vehicleid][ORM_ID],true); //<-- error 035: argument type mismatch (argument 2)                    
                    Iter_Remove(Vehicles,vehicleid);
                    }
                    else SEM(playerid,"<ERROR>: Invalid vehicleid !");
                    }
I did create an enum where this information is being stored And a function to load it.
I would really like to get some help/feedback from u guys.

I've changed from mysql 39-3 to mysql 41-2.
Reply
#2

try this

Code:
function Vehicle_Load()
{
        new rows = cache_get_row_count(VDatabase); //<-- warning 213: tag mismatch
        if(rows != 0)
        {
            forex(row,rows)
            {
                new vehicleid = cache_get_value_int(rows, VDatabase); //<-- warning 213: tag mismatch
                new ORM:ormid = ServerVehicle[vehicleid][ORM_ID] = orm_create("server_vehicles");
Code:
case 2:
                    {
                    if(IsNull(string)) return SEM(playerid,"<USAGE>: /vehicle delete [vehicleid]");
                    new vehicleid = strval(string);
                    if(Iter_Contains(Vehicles,vehicleid))
                    {
                    format(string,sizeof(string),"<VEHICLEINFO>: {ffffff}(Server) Vehicle with {ffff00}id %d {ffffff}has been deleted!",vehicleid);
                    SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
                    DestroyVehicle(VehicleID[vehicleid]);
                    orm_delete(ServerVehicle[vehicleid][ORM_ID]); //<-- error 035: argument type mismatch (argument 2)                    
                    Iter_Remove(Vehicles,vehicleid);
                    }
                    else SEM(playerid,"<ERROR>: Invalid vehicleid !");
                    }
Reply
#3

Change VDatabase as "static VDatabase;".
Reply
#4

https://sampwiki.blast.hk/wiki/MySQL#cache_get_row_count
The destination variable to store and not the connection handle or use cache_num_rows()



https://sampwiki.blast.hk/wiki/MySQL#cac...alue_index_int
Functions does not longer return the integer value but it is passed by reference.



For more details: https://sampforum.blast.hk/showthread.php?tid=616103
https://sampwiki.blast.hk/wiki/MySQL#orm_delete

Remove 2nd parameter completely.
Reply
#5

Quote:
Originally Posted by Konstantinos
View Post
https://sampwiki.blast.hk/wiki/MySQL#cache_get_row_count
The destination variable to store and not the connection handle or use cache_num_rows()



https://sampwiki.blast.hk/wiki/MySQL#cac...alue_index_int
Functions does not longer return the integer value but it is passed by reference.



For more details: https://sampforum.blast.hk/showthread.php?tid=616103
https://sampwiki.blast.hk/wiki/MySQL#orm_delete

Remove 2nd parameter completely.
what do you mean exactly by remove the 2nd parameter completely?
Reply
#6

Look at the Wiki:
pawn Code:
orm_delete(ORM:id, const callback[] = "", const format[] = "", {Float, _}:...)
and now take a look at your code:
pawn Code:
orm_delete(ServerVehicle[vehicleid][ORM_ID],true);
2nd parameter is a string (optional) and you used a boolean instead which gives type mismatch. Just:
pawn Code:
orm_delete(ServerVehicle[vehicleid][ORM_ID]);
There is no use_cache parameter or whatever, if that is the reason you used it in the first place.
Reply
#7

Oh i have already removed that i've noticed it on the wiki indeed, thank you konstantinos for the additional information i appreciate it, however i changed a few things here and there and it brought me a new error!

Code:
new mySql:VDatabase;
VDatabase = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DATABASE_WORLD, option_id); <--mismatch.
mysql_pquery(VDatabase,"SELECT * FROM `server_vehicles` ORDER BY `veh_id` ASC","Vehicle_Load",""); <-- mismatch.
Reply
#8

Bump.

--canned----started----message--
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)