Offline |
|
Csatlakozott: 2016.01.17. 07:11 Hozzászólások: 296
Megköszönt másnak: 60 alkalommal Megköszönték neki: 11 alkalommal
|
Hali! Valaki tudná javítani? Előre is köszönöm /* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #include <colorchat> #include <fakemeta> #include <csstats> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "" new amx_gamename new const SQL_INFO[][] = { "127.0.0.1", "username", "password", "database" } new Handle:g_SqlTuple; new g_iVIP[33] new name[33][32] public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /rs", "Score") register_clcmd("say", "handlesay") amx_gamename = register_cvar("amx_gamename", "fb.com/royalstorersT") register_forward(FM_GetGameDescription, "GameDesc") } public plugin_cfg() { new Query[512]; g_SqlTuple = SQL_MakeDbTuple(SQL_INFO[0],SQL_INFO[1],SQL_INFO[2],SQL_INFO[3]) formatex(Query, charsmax(Query), "CREATE TABLE IF NOT EXISTS `tabla_neve` (`username` varchar(32) NOT NULL,`valami_ertek` int(11) NOT NULL,`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY)") SQL_ThreadQuery(g_SqlTuple,"createTableThread", Query) } public createTableThread(FailState, Handle:Query, Error[], Errcode, Data[], DataSize, Float:Queuetime) { if(FailState == TQUERY_CONNECT_FAILED) set_fail_state("Nem tudtam csatlakozni az adatbazishoz."); else if(FailState == TQUERY_QUERY_FAILED) set_fail_state("Query Error"); if(Errcode) log_amx("Hibat dobtam: %s",Error); } public load(id) { new Query[512], Data[1] Data[0] = id formatex(Query, charsmax(Query), "SELECT * FROM `tabla_neve` WHERE username = ^"%s^";", name[id]) SQL_ThreadQuery(g_SqlTuple, "QuerySelectData", Query, Data, 1) } public QuerySelectData(FailState, Handle:Query, Error[], Errcode, Data[], DataSize, Float:Queuetime) { if(FailState == TQUERY_CONNECT_FAILED || FailState == TQUERY_QUERY_FAILED) { log_amx("%s", Error) return } else { new id = Data[0]; if(SQL_NumRows(Query) > 0) { valtozo[id] = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "valami_ertek")) } else { save(id) } } } public save(id) { new text[512] formatex(text, charsmax(text), "INSERT INTO `tabla_neve` (`username`, `valami_ertek`) VALUES (^"%s^", ^"0^");", name[id]) SQL_ThreadQuery(g_SqlTuple, "QuerySetData", text) } public QuerySetData(FailState, Handle:Query, Error[], Errcode, Data[], DataSize, Float:Queuetime) { if(FailState == TQUERY_CONNECT_FAILED || FailState == TQUERY_QUERY_FAILED) { log_amx("%s", Error) return } } public update(id) { new text[512]; formatex(text, charsmax(text), "UPDATE `tabla_neve` SET valami_ertek = ^"%i^" WHERE username = ^"%s^";", g_iVIP[id], name[id]) SQL_ThreadQuery(g_SqlTuple, "QuerySetData", text) } public plugin_end() { SQL_FreeHandle(g_SqlTuple) } public GameDesc() { static gamename[32]; get_pcvar_string(amx_gamename, gamename, 31) forward_return(FMV_STRING, gamename) return FMRES_SUPERCEDE } public Score(id) { set_user_frags(id, 0) cs_set_user_deaths(id, 0) print_color(id, "!g*!y Statisztikád nullázva.") } public handlesay(id) { new message[192], Name[32], chat[192], none[2][32] read_args(message, 191) remove_quotes(message) if(message[0] == '/') return PLUGIN_HANDLED; if(!equali(message, none[0]) && !equali(message, none[1])) { get_user_name(id, Name, 31); if(get_user_flags(id) & ADMIN_BAN) formatex(chat, 191, "^4[ADMIN]^3%s^1 :^4 %s", Name, message) else formatex(chat, 191, "^3%s^1 :^1 %s", Name, message) switch(cs_get_user_team(id)) { case 1: ColorChat(0, RED, chat) case 2: ColorChat(0, BLUE, chat) } if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) ColorChat(0, GREY, chat) return PLUGIN_HANDLED } return PLUGIN_CONTINUE } public client_putinserver(id) { if(!is_user_bot(id)) { get_user_name(id, name[id], charsmax(name)) load(id) } set_task(1.5, "Csatlakozik", id) } public client_disconnect(id) { if(!is_user_bot(id)) { update(id) } g_iVIP[id] = 0 copy(name[id], charsmax(name[]), "") set_task(1.0, "Lecsatlakozik", id) } public Csatlakozik(id) { new name[32], izStats[8], izBody[8], iRankPos get_user_name(id, name, 32) iRankPos = get_user_stats(id, izStats, izBody) print_color(id, "!g*!t %s!y Csatlakozott a szerverre!g Rank:!t %i", name, iRankPos) } public Lecsatlakozik(id) { new name[32] get_user_name(id, name, 32) print_color(id, "!g*!t %s!y Lecsatlakozott a szerveről", name) } stock print_color(const id, const input[], any:...) { new count = 1, players[32] static msg[191] vformat(msg, 190, input, 3) replace_all(msg, 190, "!g", "^4") replace_all(msg, 190, "!y", "^1") replace_all(msg, 190, "!t", "^3") replace_all(msg, 190, "á", "á") replace_all(msg, 190, "é", "Ă©") replace_all(msg, 190, "í", "Ă") replace_all(msg, 190, "ó", "Ăł") replace_all(msg, 190, "ö", "ö") replace_all(msg, 190, "ő", "Ĺ‘") replace_all(msg, 190, "ú", "Ăş") replace_all(msg, 190, "ü", "ĂĽ") replace_all(msg, 190, "ű", "ű") replace_all(msg, 190, "Á", "Ă") replace_all(msg, 190, "É", "É") replace_all(msg, 190, "Í", "ĂŤ") replace_all(msg, 190, "Ó", "Ă“") replace_all(msg, 190, "Ö", "Ă–") replace_all(msg, 190, "Ő", "Ĺ") replace_all(msg, 190, "Ú", "Ăš") replace_all(msg, 190, "Ü", "Ăś") replace_all(msg, 190, "Ű", "Ĺ°") if(id)players[0] = id; else get_players(players, count, "ch") { for (new i = 0; i < count; i++) { if (is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]) write_byte(players[i]) write_string(msg) message_end() } } } return PLUGIN_HANDLED }
_________________ Global Offensive: (50%)
|
|