open.mp forum
[Pawn] Help with tables - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] Help with tables (/showthread.php?tid=2148)



Help with tables - Pedxz - 2021-07-01

Well, I downloaded a GM and it didn't come with the SQL import file, so it can be uploaded to phpmyadmin! I would like to know if you can help me with some tables, some I created myself, but others, I'm having difficulties, because they are created, but they don't save anything!?



Sample code from a table that is occurring what I said:

Code:
stock CarregarFileMySQL(playerid)

[/font][/size][/color]

{



new TmpInt;







format(gStr, sizeof(gStr), "SELECT * FROM `"TABLE_CONTAS"` WHERE `Nick` = BINARY '%s'", pNome(playerid));



mysql_query(IDConexao, gStr);







if(cache_num_rows() == 0)



{



format(gstring, sizeof(gstring), "INSERT INTO `"TABLE_CONTAS"` (`Nick`, `?ltimoLogin`, `Data Registro`, `IP`) VALUES ('%s', '%d', '%d', '%s')", pNome(playerid), gettime(), gettime(), GetPlayerIP(playerid));



mysql_query(IDConexao, gstring, false);







format(gStr, sizeof(gStr), "SELECT * FROM `"TABLE_CONTAS"` WHERE `Nick` = BINARY '%s'", pNome(playerid));



mysql_query(IDConexao, gStr);



}







cache_get_value_name(0, "CorBarraStatus", pInfo[playerid][BarraCor]);



cache_get_value_name_int(0, "ID", pInfo[playerid][PlayerID]);



cache_get_value_name_int(0, "Cargo", aInfo[playerid][Cargo]);



cache_get_value_name_int(0, "Espi?o", aInfo[playerid][Espiao]);



cache_get_value_name_int(0, "?ltimoLogin", pInfo[playerid][UltimoLogin]);



cache_get_value_name_int(0, "TipoVIP", pInfo[playerid][TipoVIP]);



cache_get_value_name_int(0, "TempoVIP", pInfo[playerid][TempoVIP]);



cache_get_value_name_int(0, "Fome", pInfo[playerid][Fome]);



cache_get_value_name_int(0, "Sede", pInfo[playerid][Sede]);



cache_get_value_name_int(0, "SegundosUP", pInfo[playerid][SegundosUP]);



cache_get_value_name_int(0, "Exp", pInfo[playerid][Exp]);



cache_get_value_name_int(0, "Saldo", pInfo[playerid][Saldo]);







// ----- //







cache_get_value_name_int(0, "RUP_Possui", pInfo[playerid][RUP_Possui]);



cache_get_value_name_int(0, "RUP_Ligado", pInfo[playerid][RUP_Ligado]);



cache_get_value_name(0, "RUP_Cor", pInfo[playerid][RUP_Cor]);



cache_get_value_name_int(0, "LCL_Possui", pInfo[playerid][LCL_Possui]);



cache_get_value_name_int(0, "VFC_Possui", pInfo[playerid][VFC_Possui]);



cache_get_value_name_int(0, "SGR_Possui", pInfo[playerid][SGR_Possui]);



cache_get_value_name_int(0, "CPT_Possui", pInfo[playerid][CPT_Possui]);



cache_get_value_name_int(0, "CPT_Modelo", pInfo[playerid][CPT_Modelo]);



cache_get_value_name_int(0, "CVN_Possui", pInfo[playerid][CVN_Possui]);



cache_get_value_name_int(0, "CTB_Possui", pInfo[playerid][CTB_Possui]);



cache_get_value_name_int(0, "CEL_Possui", pInfo[playerid][CEL_Possui]);



cache_get_value_name_int(0, "CEL_SMS", pInfo[playerid][CEL_SMS]);



cache_get_value_name_int(0, "YTP_Possui", pInfo[playerid][YTP_Possui]);



cache_get_value_name_int(0, "GPSC_Possui", pInfo[playerid][GPSC_Possui]);



cache_get_value_name_int(0, "GPSC_Status", pInfo[playerid][GPSC_Status]);



cache_get_value_name_int(0, "GPSL_Possui", pInfo[playerid][GPSL_Possui]);



cache_get_value_name_int(0, "GPSL_Status", pInfo[playerid][GPSL_Status]);



cache_get_value_name_int(0, "KIT_Possui", pInfo[playerid][KIT_Possui]);



cache_get_value_name_int(0, "KITF_Possui", pInfo[playerid][KITF_Possui]);







// ----- //







cache_get_value_name_int(0, "Moedas", TmpInt);



GivePlayerMoedas(playerid, TmpInt);







cache_get_value_name_int(0, "pLevel", TmpInt);



SetPlayerScore(playerid, TmpInt);







cache_get_value_name_int(0, "Dinheiro", TmpInt);



GivePlayerCash(playerid, TmpInt);







cache_get_value_name_int(0, "Procurado", TmpInt);



SetPlayerWantedLevel(playerid, TmpInt);







// --------------------- //







if(GetPlayerCargo(playerid) >= C_MODERADOR) aInfo[playerid][BloqueadoR] = true;



if(pInfo[playerid][TipoVIP] != -1 || GetPlayerCargo(playerid) >= C_MODERADOR) ChatVIP[playerid] = true;







SetPVarInt(playerid, "pID", pInfo[playerid][PlayerID]);



SetPVarInt(playerid, "pCargo", aInfo[playerid][Cargo]);







// ------------------------------------------ //







format(gstring, sizeof(gstring), "UPDATE `"TABLE_CONTAS"` SET `?ltimoLogin` = %d, `IP` = '%s' WHERE `ID` = %d", gettime(), GetPlayerIP(playerid), pInfo[playerid][PlayerID]);



mysql_query(IDConexao, gstring, false);







// ------------------------------------------ //







// blogins



format(gStr, sizeof(gStr), "INSERT INTO `"TABLE_LOGINS"` (`Jogador_ID`, `TS_Logou`) VALUES (%d, %d)", pInfo[playerid][PlayerID], gettime());



mysql_query(IDConexao, gStr);







pInfo[playerid][SessaoID] = cache_insert_id();



pInfo[playerid][TimeLogou] = gettime();



pInfo[playerid][LevelLogou] = pInfo[playerid][Level];







// ------------------------------------------ //







pInfo[playerid][Logado] = true;







// ------------------------------------------ //







format(gstring, sizeof(gstring), "[ %s - %s ] %s logou no servidor. [ IP: %s | Level: %d | Saldo: %d | Grana: %d | Moedas: %d | Frag: %d / %d ]",



Gdata(), Ghora(), pNome(playerid), GetPlayerIP(playerid), pInfo[playerid][Level], pInfo[playerid][Saldo], GetPlayerCash(playerid), GetPlayerMoedas(playerid), pInfo[playerid][fMatou], pInfo[playerid][fMorreu]);







LogLogins(gstring);

[color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif]}