Bylo 100aa
i zeby nie bylo takiego takiego czegos ze Developer 0 musi byc bo zawsze na poacztku rundy tak jakby wymusza developer 0 a ja nie chce zeby to bylo .
Jak cos jeszcze trzeba bedzie dac jakis plik to pisac.
Dam ++
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <colorchat> #include <hamsandwich> #include <jumpstats_const> #include <jumpstats_stocks> #include <engine> new const g_team_names[][] = { "Terrorist", "Counter-Terrorist", "Spectator" }; #define ONOFF_SPEED (1<<0) #define ONOFF_COLORCHAT (1<<1) #define ONOFF_SOUNDS (1<<2) #define ONOFF_JUMPSTATS (1<<3) #define ONOFF_STRAFESTATS (1<<4) #define ONOFF_BEAM (1<<5) #define ONOFF_SPECSTATS (1<<6) #define ONOFF_PRESTRAFE (1<<7) new const g_onoff_names[][] = { "Speedometer", "Jump Chat Messages", "Jump Sounds", "Jump Stats", "Strafe Stats", "Jump Beam", "Spectator Stats", "Prestrafe Shower" }; new const g_onoff_verbs[sizeof(g_onoff_names)][] = { "has", "have", "have", "have", "have", "has", "have", "has" }; new const g_onoff_commands[sizeof(g_onoff_names)][] = { "say /speed", "say /colorchat", "say /ljsounds", "say /ljstats", "say /strafestats", "say /ljbeam", "say /specstats", "say /preshow" }; new const g_cvar_names[][] = { "edgefriction", "mp_footsteps", "sv_cheats", "sv_maxspeed", "sv_stepsize", "sv_maxvelocity" }; new const g_cvar_values[sizeof(g_cvar_names)] = { 2, // edgefriction 1, // mp_footsteps 0, // sv_cheats 320, // sv_maxspeed 18, // sv_stepsize 2000 // sv_maxvelocity }; new g_cvar_pointers[sizeof(g_cvar_names)]; new Float:g_speed_delay; new Float:g_beamtime[33]; new g_flags[33]; new cvar_allowteam; new cvar_connectflags; new cvar_developer; new cvar_servertype; new g_agree_menu; new bool:g_agreed[33]; new g_max_clients; new g_config_forward; new g_cvar_forward; new g_cache_entity; public plugin_precache() { precache_sound(SOUND_IMPRESSIVE); precache_sound(SOUND_PERFECT); precache_sound(SOUND_GODLIKE); precache_sound(SOUND_HOLYSHIT); precache_sound(SOUND_DOMINATING); precache_sound(SOUND_DOMINATING_GODLIKE); precache_sound(SOUND_RAMPAGE); new filename[64]; get_configsdir(filename, sizeof(filename) - 1); add(filename, sizeof(filename) - 1, "/jumpstats_reset.ini"); if( !file_exists(filename) ) { new const commands[][] = { "tele", "tp", "gocheck", "gc", "stuck", "unstuck", "start", "reset", "spawn", "restart" }; new const prefixes[][] = { "", ".", "/" }; new f = fopen(filename, "wt"); fputs(f, "; These commands are not allowed to be used during jumps^n; Place commands in here that allow players to move with the use of other plugins^n^n"); for( new s = 0; s < 2; s++ ) { for( new i = 0; i < sizeof(commands); i++ ) { for( new j = 0; j < sizeof(prefixes); j++ ) { fprintf(f, "%s%s%s^n", (s == 0) ? "" : "say ", prefixes[j], commands[i]); } } } fputs(f, "+hook^n-hook"); fclose(f); } get_datadir(filename, sizeof(filename) - 1); add(filename, sizeof(filename) - 1, "/jumpstats"); if( !dir_exists(filename) ) { mkdir(filename); } } public plugin_init() { register_plugin("JumpStats Main", PLUGIN_VERSION, PLUGIN_AUTHOR); register_cvar(PLUGIN_NAME, PLUGIN_VERSION, (FCVAR_SERVER|FCVAR_SPONLY)); if( !is_running("cstrike") ) return; register_clcmd("say /ljsmenu", "CmdMenu"); for( new i = 0; i < sizeof(g_onoff_commands); i++ ) { register_clcmd(g_onoff_commands[i], "CmdMenu"); } register_forward(FM_StartFrame, "FwdStartFrame"); RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawn", 1); for( new i = 0; i < sizeof(g_cvar_names); i++ ) { g_cvar_pointers[i] = get_cvar_pointer(g_cvar_names[i]); } cvar_allowteam = register_cvar("js_allowteam", "abc"); cvar_connectflags = register_cvar("js_connectflags", "abcdefg"); cvar_developer = register_cvar("js_developer", "1"); cvar_servertype = register_cvar("js_servertype", "1"); g_max_clients = get_maxplayers(); g_agree_menu = menu_create("This server requires ^"developer 0^"^nDo you accept this?", "MenuAgree"); menu_additem(g_agree_menu, "Yes", "1"); menu_additem(g_agree_menu, "No", "2"); menu_setprop(g_agree_menu, MPROP_EXIT, MEXIT_NEVER); g_config_forward = CreateMultiForward("js_config_executed", ET_IGNORE); g_cvar_forward = CreateMultiForward("js_update_cvars", ET_IGNORE); } public plugin_cfg() { set_task(CONFIG_EXEC_DELAY, "TaskDelayedConfig"); } public TaskDelayedConfig() { // addons/amxmodx/configs/jumpstats.cfg // 123456789012345678901234567890123456 new filename[40]; get_configsdir(filename, sizeof(filename) - 1); add(filename, sizeof(filename) - 1, "/jumpstats.cfg"); if( file_exists(filename) ) { server_cmd("exec %s", filename); //server_exec(); } new retval; ExecuteForward(g_config_forward, retval); ExecuteForward(g_cvar_forward, retval); new servertype = get_pcvar_num(cvar_servertype); if( servertype == 1 ) { register_event("HLTV", "EventCacheCvars", "a", "1=0", "2=0"); } else { g_cache_entity = create_entity("info_target"); if( !is_valid_ent(g_cache_entity) ) { // it's a last resort <img src='https://amxx.pl/public/style_emoticons/<#EMO_DIR#>/bored.gif' class='bbc_emoticon' alt=':|' /> set_task(CACHE_UPDATE_INERVAL, "EventCacheCvars", _, _, _, "b"); } else { entity_set_string(g_cache_entity, EV_SZ_classname, "js_cvar_cache"); register_think("js_cvar_cache", "FwdCacheCvars"); entity_set_float(g_cache_entity, EV_FL_nextthink, get_gametime()); } } } public plugin_natives() { register_library("jumpstats_main"); register_native("js_user_has_colorchat", "_colorchat"); register_native("js_user_has_sounds", "_sounds"); register_native("js_user_has_jumpstats", "_jumpstats"); register_native("js_user_has_strafestats", "_strafestats"); register_native("js_user_has_beam", "_beam"); register_native("js_user_has_specstats", "_specstats"); register_native("js_user_has_prestrafe", "_prestrafe"); register_native("js_set_user_beamtime", "_set_beamtime"); register_native("js_get_user_beamtime", "_get_beamtime"); } public bool:_colorchat(plugin, params) { return bool:(g_flags[get_param(1)] & ONOFF_COLORCHAT); } public bool:_sounds(plugin, params) { return bool:(g_flags[get_param(1)] & ONOFF_SOUNDS); } public bool:_jumpstats(plugin, params) { return bool:(g_flags[get_param(1)] & ONOFF_JUMPSTATS); } public bool:_strafestats(plugin, params) { return bool:(g_flags[get_param(1)] & ONOFF_STRAFESTATS); } public bool:_beam(plugin, params) { return bool:(g_flags[get_param(1)] & ONOFF_BEAM); } public bool:_specstats(plugin, params) { return bool:(g_flags[get_param(1)] & ONOFF_SPECSTATS); } public bool:_prestrafe(plugin, params) { return bool:(g_flags[get_param(1)] & ONOFF_PRESTRAFE); } public _set_beamtime(plugin, params) { g_beamtime[get_param(1)] = get_param_f(2); } public Float:_get_beamtime(plugin, params) { return g_beamtime[get_param(1)]; } public client_putinserver(client) { g_beamtime[client] = 0.0; if( get_pcvar_num(cvar_developer) ) { g_agreed[client] = false; g_flags[client] = 0; } else { g_agreed[client] = true; static flags[10]; get_pcvar_string(cvar_connectflags, flags, sizeof(flags) - 1); g_flags[client] = read_flags(flags); } } public client_disconnect(client) { remove_task(client); } public CmdMenu(client) { static command[20]; read_argv(1, command, sizeof(command) - 1); for( new i = 0; i < sizeof(g_onoff_commands); i++ ) { if( !strcmp(command, g_onoff_commands[i][4], 1) ) { SwitchOnOff(client, i); return; } } ShowMainMenu(client); } public FwdStartFrame() { for( new i = 0; i < sizeof(g_cvar_names); i++ ) { set_pcvar_num(g_cvar_pointers[i], g_cvar_values[i]); } new Float:gametime = get_gametime(); static is_alive, alive, Float:velocity[3], Float:length; for( new client = 1; client <= g_max_clients; client++ ) { if( !is_user_connected(client) ) continue; is_alive = is_user_alive(client); if( gametime > g_speed_delay && (g_flags[client] & ONOFF_SPEED) ) { if( is_alive || !(alive = GetSpectatedPlayer(client)) ) { alive = client; } if( !is_alive && !(g_flags[client] & ONOFF_SPECSTATS) ) continue; pev(alive, pev_velocity, velocity); length = vector_length(velocity); velocity[2] = 0.0; set_hudmessage(255, 255, 255, -1.0, 0.65, 0, 0.0, 0.2, 0.0, 0.0, 3); show_hudmessage(client, "%.3f units/second^n%.3f velocity", vector_length(velocity), length); } } if( gametime > g_speed_delay ) { g_speed_delay = gametime + 0.1; } } public FwdPlayerSpawn(client) { if( !g_agreed[client] && is_user_alive(client) ) { menu_display(client, g_agree_menu); } } public FwdCacheCvars(entity) { if( entity == g_cache_entity ) { EventCacheCvars(); entity_set_float(entity, EV_FL_nextthink, get_gametime() + CACHE_UPDATE_INERVAL); } } public EventCacheCvars() { static retval; ExecuteForward(g_cvar_forward, retval); } ShowMainMenu(client) { if( !g_agreed[client] ) { menu_display(client, g_agree_menu); return; } new menu = menu_create("JumpStats Menu", "MenuMain"); menu_additem(menu, "Top Jumps", "1"); if( access(client, ADMIN_RCON) ) { menu_additem(menu, "On/Off Menu^n^nrAdmin Menu", "2"); menu_additem(menu, "Reset Tops Menu", "3"); menu_additem(menu, "Connect Enabler Menu", "4"); menu_additem(menu, "Allow Team Menu", "5"); } else { menu_additem(menu, "On/Off Menu", "2"); } menu_display(client, menu); } public MenuMain(client, menu, item) { if( item == MENU_EXIT ) { menu_destroy(menu); return; } static _access, info[3], callback; menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback); menu_destroy(menu); switch( info[0] ) { case '1': { client_cmd(client, "main_top"); } case '2': { ShowOnOffMenu(client); } case '3': { client_cmd(client, "main_reset"); } case '4': { ShowCustomizeMenu(client); } case '5': { ShowAllowTeamMenu(client); } } } ShowOnOffMenu(client) { if( !g_agreed[client] ) { menu_display(client, g_agree_menu); return; } static item[32], info[3]; new menu = menu_create("JumpStats On/Off Menu", "MenuOnOff"); for( new i = 0; i < sizeof(g_onoff_names); i++ ) { formatex(item, sizeof(item) - 1, "%s: %s", g_onoff_names[i], (g_flags[client] & (1<<i)) ? "yOn" : "rOff"); num_to_str(i, info, sizeof(info) - 1); menu_additem(menu, item, info); } menu_display(client, menu); } public MenuOnOff(client, menu, item) { if( item == MENU_EXIT ) { menu_destroy(menu); ShowMainMenu(client); return; } static _access, info[3], callback; menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback); menu_destroy(menu); SwitchOnOff(client, str_to_num(info)); ShowOnOffMenu(client); } SwitchOnOff(client, num) { if( g_agreed[client] ) { new flag = (1<<num); g_flags[client] ^= flag; ColorChat(client, (g_flags[client] & flag) ? BLUE : RED, "^x04[JUMPSTATS]^x03 %s %s been %sabled!", g_onoff_names[num], g_onoff_verbs[num], (g_flags[client] & flag) ? "en" : "dis"); } else { ColorChat(client, RED, "^x04[JUMPSTATS]^x03 You must agree to accept legal jump settings!"); menu_display(client, g_agree_menu); } } ShowCustomizeMenu(client) { new menu = menu_create("Connect Enabler", "MenuCustomize"); static connect_flags[16]; get_pcvar_string(cvar_connectflags, connect_flags, sizeof(connect_flags) - 1); new flags = read_flags(connect_flags); new item[64], info[3]; for( new i = 0; i < sizeof(g_onoff_names); i++ ) { formatex(item, sizeof(item) - 1, "%s: %s", g_onoff_names[i], (flags & (1<<i)) ? "yOn" : "rOff"); num_to_str(i, info, sizeof(info) - 1); menu_additem(menu, item, info); } menu_display(client, menu); } public MenuCustomize(client, menu, item) { if( item == MENU_EXIT ) { menu_destroy(menu); ShowMainMenu(client); return; } static _access, info[3], callback; menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback); menu_destroy(menu); new num = str_to_num(info); new flag = (1<<num); new connect_flags[16]; get_pcvar_string(cvar_connectflags, connect_flags, sizeof(connect_flags) - 1); new flags = read_flags(connect_flags); flags ^= flag; get_flags(flags, connect_flags, sizeof(connect_flags) - 1); set_pcvar_string(cvar_connectflags, connect_flags); ColorChat(client, (flags & flag) ? BLUE : RED, "^x04[JUMPSTATS]^x03 %s %s been %sabled!", g_onoff_names[num], g_onoff_verbs[num], (flags & flag) ? "en" : "dis"); ShowCustomizeMenu(client); } ShowAllowTeamMenu(client) { new menu = menu_create("Allow Teams", "MenuAllowTeam"); new team_flags[5]; get_pcvar_string(cvar_allowteam, team_flags, sizeof(team_flags) - 1); new flags = read_flags(team_flags); new item[64], info[3]; for( new i = 0; i < sizeof(g_team_names); i++ ) { formatex(item, sizeof(item) - 1, "%s: %s", g_team_names[i], (flags & (1<<i)) ? "yOn" : "rOff"); num_to_str(i, info, sizeof(info) - 1); menu_additem(menu, item, info); } menu_display(client, menu); } public MenuAllowTeam(client, menu, item) { if( item == MENU_EXIT ) { menu_destroy(menu); ShowMainMenu(client); return; } static _access, info[3], callback; menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback); menu_destroy(menu); new num = str_to_num(info); new flag = (1<<num); new team_flags[16]; get_pcvar_string(cvar_allowteam, team_flags, sizeof(team_flags) - 1); new flags = read_flags(team_flags); flags ^= flag; get_flags(flags, team_flags, sizeof(team_flags) - 1); set_pcvar_string(cvar_allowteam, team_flags); ColorChat(0, (flags & flag) ? BLUE : RED, "^x04[JUMPSTATS]^x03 JumpStats for %ss have been %sabled!", g_team_names[num], (flags & flag) ? "en" : "dis"); ShowAllowTeamMenu(client); } public MenuAgree(client, menu, item) { if( item == MENU_EXIT ) return; static _access, info[3], callback; menu_item_getinfo(menu, item, _access, info, sizeof(info) - 1, _, _, callback); if( info[0] == '1' ) { g_agreed[client] = true; static params[2]; params[0] = 0; set_task(10.0, "TaskCheckDeveloper", client, params, sizeof(params)); static flags[10]; get_pcvar_string(cvar_connectflags, flags, sizeof(flags) - 1); g_flags[client] = read_flags(flags); } } public TaskCheckDeveloper(params[], client) { query_client_cvar(client, "developer", "DeveloperResult", 2, params); } public DeveloperResult(client, const cvar_name[], const cvar_value[], const params[]) { if( equali(cvar_value, "Bad CVAR request") ) return; new secondtime = params[0]; if( !IsStringNumeric(cvar_value) || str_to_num(cvar_value) != 0 ) { if( !secondtime ) { ColorChat(client, RED, "^x04[JUMPSTATS]^x03 Your developer was set to 0."); static params2[2]; params2[0] = 1; set_task(5.0, "TaskCheckDeveloper", client, params2, sizeof(params2)); } else { client_cmd(client, "echo ^"^""); client_cmd(client, "echo ^"You have set your developer to an illegal value and then aliased the cvar.^""); client_cmd(client, "echo ^"If you wish to play in this server, then you must restart your CS and make sure the cvar isn't aliased.^"") message_begin(MSG_ONE_UNRELIABLE, SVC_DISCONNECT, _, client); write_string("Check your console."); message_end(); } } if( !secondtime ) { client_cmd(client, "developer 0;alias developer"); } } bool:IsStringNumeric(const string[]) { new len = strlen(string); for( new i = 0; i < len; i++ ) { if( !('0' <= string[i] <= '9') ) { return false; } } return true; } /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{ rtf1 ansi deff0{ fonttbl{ f0 fnil Tahoma;}}n viewkind4 uc1 pard lang1033 f0 fs16 n par } */
[ Dodano: 13-05-2009, 08:07 ]
Umie ktos To zobic ?