Issue with user origin
Here's a little plugin to make 2x2 maps from 3 big maps. The problem is if player will insist to go through block zone you will be stuck. Mostly at the corners (near walls). I've just try to go 2 times and i am stuck. This is very bad! Is that possible to predict such situations and unstuck or do anything else, idk? Or maybe there's a better way to make 2x2 maps from dust2, inferno and nuke?
PHP Code:
#include <amxmodx> #include <fun> #include <engine>
#define DE_DUST2 1 #define DE_INFERNO 2 #define DE_NUKE 3
static g_iMap = 0; static g_iOriginLast[33][3]; static bool: g_bCurRoundEnable = false;
public plugin_init () { new sMap[64]; get_mapname (sMap,63); if (equali (sMap,"de_dust2")) g_iMap = DE_DUST2; else if (equali (sMap,"de_nuke")) g_iMap = DE_NUKE; else if (equali (sMap,"de_inferno")) g_iMap = DE_INFERNO; if (g_iMap) { register_logevent ("round_start",2,"1=Round_Start"); set_task (0.1,"check_user_origin",_,_,_,"b"); } }
public round_start () { if (get_playersnum () < 10) g_bCurRoundEnable = true; else g_bCurRoundEnable = false; }
public check_user_origin () { if (!g_bCurRoundEnable) return PLUGIN_CONTINUE; new a = 0; new iOrigin[3]; for (a = 1;a < 33;a ++) { if (!is_user_connected (a) || is_user_hltv (a) || !is_user_alive (a)) continue; get_user_origin (a,iOrigin); switch (g_iMap) { case DE_DUST2: { if ((iOrigin[0] <= (-500) && iOrigin[1] >= 1310) || (iOrigin[0] <= (-1360) && iOrigin[1] >= (-980) && iOrigin[1] <= (-270))) { stop_player_ground (a); continue; } } case DE_NUKE: { if ((iOrigin[0] >= (-240) && iOrigin[0] <= (-80) && iOrigin[1] >= (-685)) || (iOrigin[0] >= 800 && iOrigin[0] <= 831 && iOrigin[1] >= (-1365) && iOrigin[2] <= (-550)) || (iOrigin[0] >= 800 && iOrigin[0] <= 831 && iOrigin[1] <= (-1470) && iOrigin[2] <= (-550)) || (iOrigin[0] >= 448 && iOrigin[0] <= 479 && iOrigin[1] >= (-1365) && iOrigin[2] <= (-550)) || (iOrigin[0] >= 448 && iOrigin[0] <= 479 && iOrigin[1] <= (-1470) && iOrigin[2] <= (-550)) || (iOrigin[0] >= 1040 && iOrigin[0] <= 1199 && iOrigin[1] >= (-130)) || (iOrigin[0] <= 2325 && iOrigin[0] >= 2160 && iOrigin[1] <= (-1713))) { stop_player_ground (a); continue; } if (iOrigin[0] >= 206 && iOrigin[0] <= 210 && iOrigin[1] <= (-765) && iOrigin[1] >= (-825) && iOrigin[2] >= (-165)) { stop_player_ladder (a); continue; } } case DE_INFERNO: { if ((iOrigin[0] >= 50 && iOrigin[0] <= 195 && iOrigin[1] >= 912) || (iOrigin[0] <= 2224 && iOrigin[1] <= 2607 && iOrigin[1] >= 2224)){ stop_player_ground (a); continue; } } } g_iOriginLast[a][0] = iOrigin[0]; g_iOriginLast[a][1] = iOrigin[1]; g_iOriginLast[a][2] = iOrigin[2]; } return PLUGIN_CONTINUE; }
public stop_player_ground (id) { new iOriginEnd[3]; iOriginEnd[0] = g_iOriginLast[id][0]; iOriginEnd[1] = g_iOriginLast[id][1]; iOriginEnd[2] = g_iOriginLast[id][2] + 10; set_user_origin (id,iOriginEnd); drop_to_floor (id); set_user_velocity (id,Float: {0.0,0.0,0.0}); }
public stop_player_ladder (id) { set_user_origin (id,g_iOriginLast[id]); set_user_velocity (id,Float: {0.0,0.0,0.0}); }
public client_connect (id) { clean_vars (id); }
public client_disconnect (id) { clean_vars (id); }
public clean_vars (id) { g_iOriginLast[id][0] = 0; g_iOriginLast[id][1] = 0; g_iOriginLast[id][2] = 0; }
|