diff --git a/catchmod_main.sma b/catchmod_main.sma index c6c6b9b..9ca14c2 100644 --- a/catchmod_main.sma +++ b/catchmod_main.sma @@ -176,6 +176,10 @@ public OnPlayerThink(id) } // Wall Touch + if (get_entvar(id, var_flags) & FL_ONGROUND && g_iWallTouches[id] != get_pcvar_num(g_iCvarTouches)) + { + g_iWallTouches[id] = get_pcvar_num(g_iCvarTouches) + } if (g_bJump[id]) { @@ -604,7 +608,7 @@ public SpeedEntityThink() fSpeed = vector_length(fVelocity) f2dmSpeed = floatsqroot(fVelocity[0] * fVelocity[0] + fVelocity[1] * fVelocity[1]) - set_hudmessage(255, 255, 255, -1.0, 0.7, 0, 0.0, 0.2, 0.01, 0.0) + set_hudmessage(255, 0, 0, -1.0, 0.7, 0, 0.0, 0.2, 0.01, 0.0) ShowSyncHudMsg(i, g_iHud[HudSpeedEnt][HudSync], "%3.2f units/second^n%3.2f velocity", fSpeed, f2dmSpeed) } @@ -660,7 +664,7 @@ public OnPlayerSpawn(id) g_fPlayerSpeed[id] = get_pcvar_float(g_iCvarSpeed) - UpdateHud(id) + set_entvar(g_iHud[HudStatusEnt][TaskEntity], var_nextthink, get_gametime() + 0.5) } // Stopping some functions diff --git a/catchmod_ranksystem.sma b/catchmod_ranksystem.sma new file mode 100644 index 0000000..0261e8f --- /dev/null +++ b/catchmod_ranksystem.sma @@ -0,0 +1,158 @@ +// Defaults +#include +// #include + +// Modules +// #include +// #include +// #include +// #include +// #include +// #include +// #include +// #include + +// 3rd Part +// Add your code here... + +// mi0 utils +// #define UTIL_FADEEFFECT +// #define UTIL_HUDMESSAGE +// #define UTIL_CLIENTCMD +// #define UTIL_LICENSE 0 +// #define UTIL_KUR print_chat + +// #include + +// Defines +// Main plugin Defines +#define PLUGIN "Catch Mod: Rank System" +#define VERSION CATCHMOD_VER +#define AUTHOR "mi0" + +#define MAXPLAYERSVAR MAX_PLAYERS + 1 + +// Enums +enum CfgSections +{ + SectionNone, + SectionSettings, + SectionLevels +} + +enum _:LevelInfo +{ + LevelName[64], + LevelColor[64], + LevelXP, + LevelInfo[64] +} + +// Global Vars +new g_iPlayersXP[MAXPLAYERSVAR], g_iPlayerLevel[MAXPLAYERSVAR] +new g_iLevels, Array:g_aLevels + +// Plugin forwards +public plugin_init() +{ + register_plugin(PLUGIN, VERSION, AUTHOR) + + // Add your code here... +} + +public plugin_cfg() +{ + g_aLevels = ArrayCreate(LevelInfo) + LoadCfg() +} + +public plugin_end() +{ + ArrayDestroy(g_aLevels) +} + +// Cmds +// Add your code here... + +// Ham/Reapi/Fm/Engine Forwards +// Add your code here... + +// Custom Functions +LoadCfg() +{ + new szFileDir[128] + get_configsdir(szFileDir, charsmax(szFileDir)) + add(szFileDir, charsmax(szFileDir), "/RankConfig.ini") + + new iFile = fopen(szFileDir, "rt") + if (iFile) + { + new szLine[256], CfgSections:iSection + new szKey[32], szValue[32] + new eTempArray[LevelInfo] + + while (!feof(iFile)) + { + fgets(iFile, szLine, charsmax(szLine)) + trim(szLine) + + if (szLine[0] == EOS || szLine[0] == '#' || szLine[0] == ';' || (szLine[0] == '/' && szLine[1] == '/')) + { + continue + } + else if (szLine[0] == '[') + { + switch (szLine[1]) + { + case 'S': + { + iSection = SectionSettings + } + + case 'L': + { + iSection = SectionLevels + } + + default: + { + iSection = SectionNone + } + } + + continue + } + + switch (iSection) + { + case SectionSettings: + { + strtok(szLine, szKey, charsmax(szKey), szValue, charsmax(szValue), "=") + trim(szKey) + trim(szValue) + + + } + + case SectionLevels: + { + parse(szLine, eTempArray[LevelName], charsmax(eTempArray[LevelName]), + eTempArray[LevelColor], charsmax(eTempArray[LevelColor]), + szValue, charsmax(szValue), + eTempArray[LevelInfo], charsmax(eTempArray[LevelInfo])) + + eTempArray[LevelXP] = str_to_num(szValue) + + ArrayPushArray(g_aLevels, eTempArray) + g_iLevels++ + } + } + } + } +} + +// Stocks +// Add your code here... + +// Natives +// Add your code here... \ No newline at end of file diff --git a/catchmod_trail.sma b/catchmod_trail.sma index a9668ac..2859654 100644 --- a/catchmod_trail.sma +++ b/catchmod_trail.sma @@ -3,54 +3,8 @@ #include #include -//TODO: -/* - new sprite = get_pcvar_num(g_model) - message_begin(0, 23, 812, 0) - write_byte(17) - write_coord(g_lorigin[id][0]) - write_coord(g_lorigin[id][1]) - new var1 - if (sprite) - { - var1 = g_offset[id][1] - } - else - { - var1 = g_offset[id][0] - } - write_coord(g_lorigin[id][2] - var1) - new var2 - if (sprite) - { - var2 = g_fire - } - else - { - var2 = g_sprite - } - write_short(var2) - new var3 - if (sprite) - { - var3 = g_size[1] - } - else - { - var3 = g_size[0] - } - write_byte(var3) - new var4 - if (sprite) - { - var4 = g_brightness[1] - } - else - { - var4 = g_brightness[0] - } - write_byte(var4) - message_end()*/ +#define TASKID 1000 +//#define DEBUG enum Sections { @@ -454,26 +408,67 @@ public TypesMenu_Handler(id, iMenu, iItem) public OnPlayerHudReset(id) { - if (g_eUserSettings[id][TrailOn]) + new iTaskID = id + TASKID + if (task_exists(iTaskID)) { - return HC_CONTINUE + remove_task(iTaskID) } - new Teams:iPlayerTeam = catchmod_get_user_team(id) - new Float:fColors[3] + set_task_ex(1.0, "task_PreApply", iTaskID) + return HC_CONTINUE +} + +public task_PreApply(iTaskID) +{ + new id = iTaskID - TASKID + + #if defined DEBUG + client_print_color(id, id, "^x04[DEBUG]^x01 Function - PreApply") + client_print_color(id, id, "^x04---------------------------") + #endif - copy(g_eUserSettings[id][TrailColors], 3, g_eTeamsColors[iPlayerTeam]) - fColors[0] = float(g_eTeamsColors[iPlayerTeam][0]) - fColors[1] = float(g_eTeamsColors[iPlayerTeam][1]) - fColors[2] = float(g_eTeamsColors[iPlayerTeam][2]) + if (!g_eUserSettings[id][TrailOn]) + { + new Teams:iPlayerTeam = catchmod_get_user_team(id) + new Float:fColors[3] + + g_eUserSettings[id][TrailColors][0] = g_eTeamsColors[iPlayerTeam][0] + g_eUserSettings[id][TrailColors][1] = g_eTeamsColors[iPlayerTeam][1] + g_eUserSettings[id][TrailColors][2] = g_eTeamsColors[iPlayerTeam][2] + fColors[0] = float(g_eTeamsColors[iPlayerTeam][0]) + fColors[1] = float(g_eTeamsColors[iPlayerTeam][1]) + fColors[2] = float(g_eTeamsColors[iPlayerTeam][2]) + + set_entvar(id, var_renderfx, kRenderFxGlowShell) + set_entvar(id, var_rendercolor, fColors) + set_entvar(id, var_renderamt, 25.0) + + #if defined DEBUG + client_print_color(id, id, "Teams - %i %i %i", g_eTeamsColors[iPlayerTeam][0], g_eTeamsColors[iPlayerTeam][1], g_eTeamsColors[iPlayerTeam][2]) + client_print_color(id, id, "User - %i %i %i", g_eUserSettings[id][TrailColors][0], g_eUserSettings[id][TrailColors][1], g_eUserSettings[id][TrailColors][2]) + client_print_color(id, id, "Floats - %f %f %f", fColors[0], fColors[1], fColors[2]) + #endif + } + #if defined DEBUG + else + { + client_print_color(id, id, "Function Cutted") + } + client_print_color(id, id, "^x04---------------------------") + #endif - set_entvar(id, var_renderfx, kRenderFxGlowShell) - set_entvar(id, var_rendercolor, fColors) - set_entvar(id, var_renderamt, 25.0) + UpdateUserTrail(id) + set_task_ex(10.0, "task_Apply", id + TASKID, .flags = SetTask_Repeat) +} +public task_Apply(iTaskID) +{ + new id = iTaskID - TASKID UpdateUserTrail(id) - return HC_CONTINUE + #if defined DEBUG + client_print_color(id, id, "^x04[DEBUG]^x01 Function - Apply") + #endif } UpdateUserTrail(id) diff --git a/useful codes/catchmod_semiclip.inc b/useful codes/catchmod_semiclip.inc new file mode 100644 index 0000000..b6e8b17 --- /dev/null +++ b/useful codes/catchmod_semiclip.inc @@ -0,0 +1,110 @@ +new TeamName:g_iTeam[MAX_PLAYERS + 1] +new bool:g_bSolid[MAX_PLAYERS + 1] +new bool:g_bHasSemiclip[MAX_PLAYERS + 1] + +#define SEMICLIP_DISTANCE 260.0 + +public plugin_init() +{ + register_forward(FM_PlayerPreThink, "FM__PlayerPreThink") + register_forward(FM_PlayerPostThink, "FM__PlayerPostThink") + register_forward(FM_AddToFullPack, "FM__AddToFullPack", 1) +} + +FirstThink() +{ + new iPlayers[MAX_PLAYERS], iNum, id + get_players_ex(iPlayers, iNum, GetPlayers_ExcludeDead) + + for (--iNum; iNum >= 0; iNum--) + { + id = iPlayers[iNum] + g_bSolid[id] = pev(id, pev_solid) == SOLID_SLIDEBOX ? true : false + } +} + +public FM__PlayerPreThink(id) +{ + static i, LastThink + + if (LastThink > id) + { + FirstThink() + } + + LastThink = id + + if (!g_bSolid[id]) + { + return FMRES_IGNORED + } + + new iPlayers[MAX_PLAYERS], iNum + get_players_ex(iPlayers, iNum, GetPlayers_ExcludeDead) + + for (--iNum; iNum >= 0; iNum--) + { + i = iPlayers[iNum] + + if (!g_bSolid[i] || id == i) + { + continue + } + + if (g_iTeam[i] == g_iTeam[id]) + { + set_pev(i, pev_solid, SOLID_NOT) + g_bHasSemiclip[i] = true + } + } + + return FMRES_IGNORED +} + +public FM__PlayerPostThink(id) +{ + new iPlayers[MAX_PLAYERS], iNum, iPlayer + get_players_ex(iPlayers, iNum, GetPlayers_ExcludeDead) + + for (--iNum; iNum >= 0; iNum--) + { + iPlayer = iPlayers[iNum] + + if (g_bHasSemiclip[iPlayer]) + { + set_pev(iPlayer, pev_solid, SOLID_SLIDEBOX) + g_bHasSemiclip[iPlayer] = false + } + } +} + +public FM__AddToFullPack(es, e, ent, host, hostflags, player, pSet) +{ + if (player) + { + #if defined BOOST + + static Float:flDistance + flDistance = entity_range(host, ent) + + if (g_bSolid[host] && g_bSolid[ent] && g_iTeam[host] == g_iTeam[ent] && flDistance < SEMICLIP_DISTANCE) + { + set_es(es, ES_Solid, SOLID_NOT) + set_es(es, ES_RenderMode, kRenderTransAlpha) + set_es(es, ES_RenderAmt, floatround(flDistance) / 1) + } + } + + return FMRES_IGNORED +} + +public FM__AddToFullPack_Pre(es, e, ent, host, hostflags, player, pSet) +{ + if (player && is_user_alive(host) && g_iTeam[host] == TEAM_SEEKER && g_iTeam[ent] == TEAM_HIDER) + { + forward_return(FMV_CELL, 0) + return FMRES_SUPERCEDE + } + + return FMRES_IGNORED +} \ No newline at end of file diff --git a/useful codes/catchmod_speedometer.sma b/useful codes/catchmod_speedometer.sma new file mode 100644 index 0000000..eee1496 --- /dev/null +++ b/useful codes/catchmod_speedometer.sma @@ -0,0 +1,60 @@ +#include +#include +#include + +new g_iTaskEnt +new bool:g_bSpeedOn[33] +new g_iHudID + +public plugin_init() +{ + register_plugin("Catch Mod: Speedometer", CATCHMOD_VER, "mi0") + + register_clcmd("say /speed", "cmd_speed") + + g_iHudID = CreateHudSyncObj() + + g_iTaskEnt = rg_create_entity("info_target") + set_entvar(g_iTaskEnt, var_classname, "SpeedometerEnt") + set_entvar(g_iTaskEnt, var_nextthink, get_gametime() + 1.0) + SetThink(g_iTaskEnt, "OnEntThink") +} + +public client_connect(id) +{ + g_bSpeedOn[id] = true +} + +public cmd_speed(id) +{ + g_bSpeedOn[id] = !g_bSpeedOn[id] + client_print(id, print_chat, "You successfuly turned your speed %s!", g_bSpeedOn[id] ? "On" : "Off") + + return PLUGIN_HANDLED +} + +public OnEntThink() +{ + static i, iTarget + static Float:fVelocity[3] + static Float:fSpeed, Float:f2dmSpeed + + for (i = 1; i <= 32; i++) + { + if (!is_user_connected(i) || !g_bSpeedOn[i]) + { + continue + } + + iTarget = get_entvar(i, var_iuser1) == 4 ? get_entvar(i, var_iuser1) : i + get_entvar(iTarget, var_velocity, fVelocity) + + fSpeed = vector_length(fVelocity) + f2dmSpeed = floatsqroot(fVelocity[0] * fVelocity[0] + fVelocity[1] * fVelocity[1]) + + set_hudmessage(255, 255, 255, -1.0, 0.7, 0, 0.0, 0.2, 0.01, 0.0) + ShowSyncHudMsg(i, g_iHudID, "%3.2f units/second^n%3.2f velocity", fSpeed, f2dmSpeed) + } + + set_entvar(g_iTaskEnt, var_nextthink, get_gametime() + 0.1) +} \ No newline at end of file diff --git a/catchmod_walls.sma b/useful codes/catchmod_walls.sma similarity index 100% rename from catchmod_walls.sma rename to useful codes/catchmod_walls.sma