- | Afiseaza codul
[code] #include <amxmodx> #include <sqlx> #define PLUGIN "Tutorial" #define VERSION "1.0" #define AUTHOR "Grim" // Ur Mysql Information new Host[] = "127.0.0.1" new User[] = "root" new Pass[] = "" new Db[] = "amx" new Handle:g_SqlTuple new g_Error[512] public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) set_task(1.0, "MySql_Init") // set a task to activate the mysql_init } public MySql_Init() { g_SqlTuple = SQL_MakeDbTuple(Host,User,Pass,Db) new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,charsmax(g_Error)) if(SqlConnection == Empty_Handle) set_fail_state(g_Error) // you free everything with SQL_FreeHandle SQL_FreeHandle(SqlConnection) } public plugin_end() { // free the tuple - note that this does not close the connection, // since it wasn't connected in the first place SQL_FreeHandle(g_SqlTuple) } public Load_MySql(id) { new szName[32], szTemp[512] get_user_authid(id, szName, charsmax(szName)) // Here we will update the user hes information in the database where the steamid matches. format(szTemp,charsmax(szTemp),"UPDATE `amx_users` SET `is_online` = '1' WHERE `amx_users`.`auth` = '%s';", szName) SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp) } public Save_MySql(id) { new szName[32], szTemp[512] get_user_authid(id, szName, charsmax(szName)) // Here we will update the user hes information in the database where the steamid matches. format(szTemp,charsmax(szTemp),"UPDATE `amx_users` SET `is_online` = '0' WHERE `amx_users`.`auth` = '%s';", szName) SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp) } public IgnoreHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize) { SQL_FreeHandle(Query) return PLUGIN_HANDLED } public client_putinserver(id) { Load_MySql(id) } public client_disconnect(id) { Save_MySql(id) } [/code]
Eroare plugin, nu face update in baza de date.[rezolvat!]
Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com
- Xeno985
- Membru, skill +1
- Posts: 206
- Joined: 05 Jul 2017, 22:07
- Detinator Steam: Da
- CS Status: Disponibil, doar cand sunt acasa.
- Detinator server CS: Nu
- SteamID: 512916512916
- Reputatie: Membru Club eXtreamCS (28 Jan - 28 Feb)
- Fond eXtream: 0
- Location: 127.0.0.1
- Discord: nvF4B8A
- Has thanked: 12 times
- Been thanked: 4 times
- Contact:
Salut, am luat un plugin de pe net SQL si l-am modificat pentru necesitatea mea, insa nu functioneaza. Ce nu functioneaza? Ei bine, acesta s-a compilat cu succes, fara erori, si ruleaza corect pe server, insa cand un jucator intra pe server, nu se face update in baza de date.
Ma poate ajuta cineva?
- Xeno985
- Membru, skill +1
- Posts: 206
- Joined: 05 Jul 2017, 22:07
- Detinator Steam: Da
- CS Status: Disponibil, doar cand sunt acasa.
- Detinator server CS: Nu
- SteamID: 512916512916
- Reputatie: Membru Club eXtreamCS (28 Jan - 28 Feb)
- Fond eXtream: 0
- Location: 127.0.0.1
- Discord: nvF4B8A
- Has thanked: 12 times
- Been thanked: 4 times
- Contact:
- Laurentiu P.
- Fost moderator
- Posts: 2549
- Joined: 10 Jul 2013, 21:26
- Detinator Steam: Da
- Reputatie: Fost super moderator
- Fond eXtream: 100
- Has thanked: 26 times
- Been thanked: 62 times
- Contact:
Lasa te rog si rezolvarea, poate mai intampina vreun utilizator aceeasi problema(sau asemanatoare).
Topic marcat ca rezolvat.
Topic marcat ca rezolvat.
no...
- Xeno985
- Membru, skill +1
- Posts: 206
- Joined: 05 Jul 2017, 22:07
- Detinator Steam: Da
- CS Status: Disponibil, doar cand sunt acasa.
- Detinator server CS: Nu
- SteamID: 512916512916
- Reputatie: Membru Club eXtreamCS (28 Jan - 28 Feb)
- Fond eXtream: 0
- Location: 127.0.0.1
- Discord: nvF4B8A
- Has thanked: 12 times
- Been thanked: 4 times
- Contact:
Mi-a dat Original un plugin facut de el.Do[N]e ;3 wrote:Lasa te rog si rezolvarea, poate mai intampina vreun utilizator aceeasi problema(sau asemanatoare).
Topic marcat ca rezolvat.
- Afiseaza | Afiseaza codul