[Ayuda] Guardar informacion MySQL
#1

Ok, al momento de colocar el comando no me crea ninguna fila en la base de datos, no tengo idea porque...

Comando:

pawn Код:
CMD:crearmaletin(playerid, params[])
    {
        if(!EsDueno(playerid)) return Error(playerid,"ЎEste comando lo utilizan solo dueсos!");
        Loop(i,MAX_MALETIN,1)
        {
            if(MaletaInfo[i][mID] == 0)
            {
                new Float:fX, Float:fY, Float:fZ;
                GetPlayerPos(playerid, fX, fY, fZ);
                Loop(k,10,0)
                {
                    MaletaInfo[i][mObjetos][k] = 0;
                }
                MaletaInfo[i][mID] = CreateDynamicObject(Maletin, fX+2, fY, fZ-1, 0, 0, 0);
                GetDynamicObjectPos(MaletaInfo[i][mID],MaletaInfo[i][mPos][0],MaletaInfo[i][mPos][1],MaletaInfo[i][mPos][2]);
                GetDynamicObjectRot(MaletaInfo[i][mID],MaletaInfo[i][mRot][0],MaletaInfo[i][mRot][1],MaletaInfo[i][mRot][2]);
                new string2[256];
                A_Format(string2,"Caja de objetos | ID %d",i);
                MaletinTexto[i] = CreateDynamic3DTextLabel(string2,C_BLANCO,MaletaInfo[i][mPos][0],MaletaInfo[i][mPos][1],MaletaInfo[i][mPos][2]+1.6,10);
                new Str[128];
                A_Format(Str,"Maletin creado correctamente [ID %d]",i);
                Mensaje(playerid,-1,Str);
                new query[1000];
                mysql_format(sql_handle, query, sizeof query, "INSERT INTO `maletin` (`Interior`, `VirtualWorld`, `Objeto0`, `Objeto1`, `Objeto2`, `Objeto2`, `Objeto4`, `Objeto5`, `Objeto6`, `Objeto7`, `Objeto8`, `Objeto9`, `PosX`, `PosY`, `PosZ`, `RotX`, `RotY`, `RotZ`) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%f', '%f', '%f', '%f', '%f', '%f')",
                MaletaInfo[playerid][mINT], MaletaInfo[playerid][mVW],
                MaletaInfo[playerid][mObjetos][0],
                MaletaInfo[playerid][mObjetos][1],
                MaletaInfo[playerid][mObjetos][2],
                MaletaInfo[playerid][mObjetos][3],
                MaletaInfo[playerid][mObjetos][4],
                MaletaInfo[playerid][mObjetos][5],
                MaletaInfo[playerid][mObjetos][6],
                MaletaInfo[playerid][mObjetos][7],
                MaletaInfo[playerid][mObjetos][8],
                MaletaInfo[playerid][mObjetos][9],
                MaletaInfo[playerid][mPos][0],
                MaletaInfo[playerid][mPos][1],
                MaletaInfo[playerid][mPos][2],
                MaletaInfo[playerid][mRot][0],
                MaletaInfo[playerid][mRot][1],
                MaletaInfo[playerid][mRot][2]);
                ActualizarMaletas(i);
                break;
            }
        }
        return 1;
    }
Y otra cosa es que me lanza un warning con este stock:

pawn Код:
warning 202: number of arguments does not match definition


pawn Код:
stock CargarMaletin(playerid)
{
    cache_get_value_int(0, "ID", MaletaInfo[playerid][mID]);

    cache_get_value_int(0, "Interior", MaletaInfo[playerid][mINT]);
    cache_get_value_int(0, "VirtualWorld", MaletaInfo[playerid][mVW]);
   
    cache_get_value_int(0, "Objeto0",MaletaInfo[playerid][mObjetos][0]);
    cache_get_value_int(0, "Objeto1",MaletaInfo[playerid][mObjetos][1]);
    cache_get_value_int(0, "Objeto2",MaletaInfo[playerid][mObjetos][2]);
    cache_get_value_int(0, "Objeto3",MaletaInfo[playerid][mObjetos][3]);
    cache_get_value_int(0, "Objeto4",MaletaInfo[playerid][mObjetos][4]);
    cache_get_value_int(0, "Objeto5",MaletaInfo[playerid][mObjetos][5]);
    cache_get_value_int(0, "Objeto6",MaletaInfo[playerid][mObjetos][6]);
    cache_get_value_int(0, "Objeto7",MaletaInfo[playerid][mObjetos][7]);
    cache_get_value_int(0, "Objeto8",MaletaInfo[playerid][mObjetos][8]);
    cache_get_value_int(0, "Objeto9",MaletaInfo[playerid][mObjetos][9]);
       
    cache_get_value_float(0, "PosX", MaletaInfo[playerid][mPos][0]);
    cache_get_value_float(0, "PosY", MaletaInfo[playerid][mPos][1]);
    cache_get_value_float(0, "PosZ", MaletaInfo[playerid][mPos][2]);
    cache_get_value_float(0, "RotX", MaletaInfo[playerid][mRot][0]);
    cache_get_value_float(0, "RotY", MaletaInfo[playerid][mRot][1]);
    cache_get_value_float(0, "RotZ", MaletaInfo[playerid][mRot][2]);

    print("*- Sistema de cajas cargado.(MySQL)");
    return 1;
}
Y aqui las otras funciones, que creo que estan bien.

pawn Код:
stock ActualizarMaletas(i)
{
    new query[1000];
    mysql_format(sql_handle, query, sizeof(query), "UPDATE `maletin` SET `Interior` = %d, `VirtualWorld` = %d, `Objeto0` = %d, `Objeto1` = %d, `Objeto2` = %d, `Objeto3` = %d, `Objeto4` = %d, `Objeto5` = %d, `Objeto6` = %d, `Objeto7` = %d, `Objeto8` = %d, `Objeto9` = %d, `PosX` = %f, `PosY` = %f, `PosZ` = %f, `RotX` = %f, `RotY` = %f, `RotZ` = %f WHERE `ID` = %d LIMIT 1",
    MaletaInfo[i][mINT],
    MaletaInfo[i][mVW],
    MaletaInfo[i][mObjetos][0],
    MaletaInfo[i][mObjetos][1],
    MaletaInfo[i][mObjetos][2],
    MaletaInfo[i][mObjetos][3],
    MaletaInfo[i][mObjetos][4],
    MaletaInfo[i][mObjetos][5],
    MaletaInfo[i][mObjetos][6],
    MaletaInfo[i][mObjetos][7],
    MaletaInfo[i][mObjetos][8],
    MaletaInfo[i][mObjetos][9],
    MaletaInfo[i][mPos][0],
    MaletaInfo[i][mPos][1],
    MaletaInfo[i][mPos][2],
    MaletaInfo[i][mRot][0],
    MaletaInfo[i][mRot][1],
    MaletaInfo[i][mRot][2],
    MaletaInfo[i][mID]);
    mysql_tquery(sql_handle, query);
    return 1;
}
pawn Код:
enum mInfo
{
    mID,
    mINT,
    mVW,
    mObjetos[10],
    Float:mPos[3],
    Float:mRot[3]
};
Que rayos estoy haciendo mal ademas de haber nacido?
Reply
#2

Veo que te faltу la consulta (mysql_tquery) luego del mysql_format en crearmaletin...

ademas:

pawn Код:
`Objeto0`, `Objeto1`, `Objeto2`, `Objeto2`...
Porque colocas ActualizarMaletas luego de hacer la consulta de insertar la fila dentro de la tabla?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)