Re: standartinis pinigu gavimas
Posted: 2011 Sep 16 15:30
Kas cia per modulis SetMoney(). Nerandu per google tokios funkcijos amxmodx.org irgi nieko nerasoma.
visa funkcija (stokas) yra parasytas poste... skaityt reiktu ismokt:kropto wrote:Kas cia per modulis SetMoney(). Nerandu per google tokios funkcijos amxmodx.org irgi nieko nerasoma.
hlev wrote:Code: Select all
SetMoney(iClient, const iMoney, const bool:bFlash = false){ g_iMoney[iClient] = iMoney; cs_set_user_money(iClient, iMoney, _:bFlash);}
Keista, kad Money iššaukiamas net žaidėjui nesant žaidime. Pataisiau kodą.kropto wrote:L 09/19/2011 - 21:21:35: [CSTRIKE] Invalid player 2
L 09/19/2011 - 21:21:35: [AMXX] Displaying debug trace (plugin "bank.amxx")
L 09/19/2011 - 21:21:35: [AMXX] Run time error 10: native error (native "cs_set_user_money")
L 09/19/2011 - 21:21:35: [AMXX] [0] bank.sma::OnMoney (line 53)
Code: Select all
public set_balance(id, balance){ new name[33] get_user_name(id, name, charsmax(name)); new index = -1 for (new i = 0; i < g_aNum; ++i) { strtolower(name) strtolower(g_aName[i]) if (containi(name, g_aName[i]) != -1) { index = i break } else if (equal(name, g_aName[i])) { index = i break } } if (index != -1) { new error[128], errno new Handle:info = SQL_MakeStdTuple() new Handle:sql = SQL_Connect(info, errno, error, 127) if (sql == Empty_Handle) { server_print("%L", LANG_SERVER, "SQL_CANT_CON", error) return PLUGIN_HANDLED; } new prefix[33] get_pcvar_string(amx_sql_prefix, prefix, charsmax(prefix)) new Handle:query = SQL_PrepareQuery(sql, "UPDATE a0f6Ej46D_pfields_content SET eco_points = '%d' WHERE member_id = '%s'", balance, g_aId[index]); if (!SQL_Execute(query)) SQL_QueryError(query, error, 127) if(!SQL_NumResults(query)) return -1 else return 1 SQL_FreeHandle(query) SQL_FreeHandle(sql) SQL_FreeHandle(info) } return -1 }