AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   BCM4 with window block and modifications... HELP! (https://forums.alliedmods.net/showthread.php?t=88356)

lolzin1 03-23-2009 15:00

BCM4 with window block and modifications... HELP!
 
What it wrong?

Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>

#pragma semicolon 1

#define OBJECT_BHOP 1
#define OBJECT_BLOCK 2
#define OBJECT_BOOSTBLOCK 3
#define OBJECT_ICEBHOP 4
#define OBJECT_DELAYEDBHOP 5
#define OBJECT_FALLBLOCK 6
#define OBJECT_TELEPORTBLOCK 7
#define OBJECT_FATALISBLOCK 8
#define OBJECT_TINKBLOCK 9
#define OBJECT_MAGICCARPET 10
#define OBJECT_DUCKBLOCK 11
#define OBJECT_SPEEDBLOCK 12
#define OBJECT_SLOWBLOCK 13
#define OBJECT_WINDOWBLOCK 14

#define MODEL_NORMAL 1
#define MODEL_WALLZ 2
#define MODEL_WALLX 3
#define MODEL_WALLY 4
#define MODEL_TINY 5
#define MODEL_TELESTART 6
#define MODEL_TELEDEST 7

#define TASK_ID_FALLBLOCK 101000
#define TASK_ID_RESETVELOCITY 202000
#define TASK_ID_UNSOLID 303000
#define TASK_ID_SOLID 404000
#define TASK_ID_SETVELOCITY 505000
#define TASK_ID_MAXSPEED 606000
#define TASK_ID_GRAB 707000
#define TASK_ID_SHOWXYZ 808000

new const gPLUGIN[] = "BCM";
new const gVERSION[] = "4";
new const gAUTHOR[] = "jOkeR";

new gDir[129] = "addons/amxmodx/data/kzm";

new const gTYPES[][] =
{
        "",
        "_bhop.",
        "_block.",
        "_boost.",
        "_ice.",
        "_delayedbhop.",
        "_fall.",
        "",
        "_fatalis.",
        "_tink.",
        "_magiccarpet.",
        "_duck.",
        "_speed.",
        "_window.",
        "_slow.",
};

new const gMODELTYPES[][] =
{
        "",
        "normal",
        "wall",
        "wall",
        "wall",
        "tiny",
        "blue_",
        "orange_"
};

new const gNORMALMODELS[][] =
{
        "",
        "models/bcm4/bcm4_normal_bhop.mdl",
        "models/bcm4/bcm4_normal_block.mdl",
        "models/bcm4/bcm4_normal_boost.mdl",
        "models/bcm4/bcm4_normal_ice.mdl",
        "models/bcm4/bcm4_normal_delayedbhop.mdl",
        "models/bcm4/bcm4_normal_fall.mdl",
        "",
        "models/bcm4/bcm4_normal_fatalis.mdl",
        "models/bcm4/bcm4_normal_tink.mdl",
        "models/bcm4/bcm4_normal_magiccarpet.mdl",
        "models/bcm4/bcm4_normal_duck.mdl",
        "models/bcm4/bcm4_normal_speed.mdl",
        "models/bcm4/bcm4_normal_window.mdl",
        "models/bcm4/bcm4_normal_slow.mdl",
};


new const gTINYMODELS[][] =
{
        "",
        "models/bcm4/bcm4_tiny_bhop.mdl",
        "models/bcm4/bcm4_tiny_block.mdl",
        "models/bcm4/bcm4_tiny_boost.mdl",
        "models/bcm4/bcm4_tiny_ice.mdl",
        "models/bcm4/bcm4_tiny_delayedbhop.mdl",
        "models/bcm4/bcm4_tiny_fall.mdl",
        "",
        "models/bcm4/bcm4_tiny_fatalis.mdl",
        "models/bcm4/bcm4_tiny_tink.mdl",
        "models/bcm4/bcm4_tiny_magiccarpet.mdl",
        "models/bcm4/bcm4_tiny_duck.mdl",
        "models/bcm4/bcm4_tiny_speed.mdl",
        "models/bcm4/bcm4_tiny_window.mdl",
        "models/bcm4/bcm4_tiny_slow.mdl",
};

new const gWALLMODELS[][] =
{
        "",
        "models/bcm4/bcm4_wall_bhop.mdl",
        "models/bcm4/bcm4_wall_block.mdl",
        "models/bcm4/bcm4_wall_boost.mdl",
        "models/bcm4/bcm4_wall_ice.mdl",
        "models/bcm4/bcm4_wall_delayedbhop.mdl",
        "models/bcm4/bcm4_wall_fall.mdl",
        "",
        "models/bcm4/bcm4_wall_fatalis.mdl",
        "models/bcm4/bcm4_wall_tink.mdl",
        "models/bcm4/bcm4_wall_magiccarpet.mdl",
        "models/bcm4/bcm4_wall_duck.mdl",
        "models/bcm4/bcm4_wall_speed.mdl",
        "models/bcm4/bcm4_wall_window.mdl",
        "models/bcm4/bcm4_wall_slow.mdl",
};

new const gTELEPORTMODELS[][] =
{
        "models/teleporter_blue_sprites.mdl",
        "models/teleporter_orange_rings.mdl"
};

new const gGLOWS[][] =
{
        {-1, -1, -1},// NULL
        {0, 0, 0}, // BHOP
        {0, 255, 0}, // BLOCK
        {255, 255, 0}, // BOOSTBLOCK
        {0, 255, 255}, // ICEBHOP
        {255, 0, 0}, // DELAYEDBHOP 100,0,0
        {0, 0, 255}, // FALLBLOCK
        {255, 255, 0}, // TELEPORTBLOCK
        {255, 255, 255}, // FATALISBLOCK
        {148, 0, 211}, // TINKBLOCK
        {50, 50, 100}, // MAGICCARPET
        {255, 150, 150}, // DUCKBLOCK
        {75, 200, 150}, // SPEEDBLOCK
        {0, 0, 0}, // WINDOWBLOCK
        {139, 69, 19} // SLOWBLOCK
};

new const Float:gMINS[][] =
{
        {-1.0, -1.0, -1.0}, // NULL
        {-32.0, -32.0, -4.0}, // Normal
        {-64.0, -64.0, -4.0}, // Wall Z
        {-64.0, -4.0, -64.0}, // Wall X
        {-4.0, -64.0, -64.0}, // Wall Y
        {-8.0, -8.0, -4.0}, // Tiny
        {-16.0, -16.0, -16.0}, // Tele Start
        {-16.0, -16.0, -16.0} // NULL (Tele Dest)
};

new const Float:gMAXS[][] =
{
        {-1.0, -1.0, -1.0}, // NULL
        {32.0, 32.0, 4.0}, // Normal
        {64.0, 64.0, 4.0}, // Wall Z
        {64.0, 4.0, 64.0}, // Wall X
        {4.0, 64.0, 64.0}, // Wall Y
        {8.0, 8.0, 4.0}, // Tiny
        {16.0, 16.0, 16.0}, // Tele Start
        {16.0, 16.0, 16.0} // Tele Dest
};

new const gOBJECTNAMES[][] =
{
        "",
        "Window Block - It's a window!",
        "Bhop - Regular Bhop",
        "Block - Regular Block",
        "Boost Block - Boosts you in the air",
        "Ice Bhop - No slowdown when landing",
        "Delayed Bhop - 1 sec disappear delay",
        "Fall Block - No fall damage",
        "Teleport",
        "Fatalis Block - Damage 10hp/sec",
        "Tink Block - Heal 2hp/sec",
        "Magic Carpet Block - CT's can ride on it",
        "Duck Block - Spams duck repeatedly",
        "Speed Block - Gives speed boost",
        "Slow Block - Slows you after 3 seconds",
};

new gMainMenu;

new gBuildMenu;
new gMoveMenu;
new gModelMenu;

new gMsgSayText;
new gMaxPlayers;

new Float:gSlowedTime[33];
new gEntSlowed[33];
new gCvarLimit;
new gCvarAccessBuild;
new gCvarAccessMove;
new gCvarAccessDelete;
new gCvarAccessNoclip;
new gCvarAccessLoad;
new gCvarAccessNewConfig;
new gCvarAccessSave;
new gCvarAccessMagicCarpet;

new Float:gSetVelocity[33][3];

new gChoseModel[33];
new gBeamSprite;

new gGrabLength[33];
new gCurConfig[33] = "default";

public plugin_precache()
{
        for( new i = 1; i < sizeof(gNORMALMODELS); i++ )
        {
                if( i != OBJECT_TELEPORTBLOCK )
                {
                        precache_model(gNORMALMODELS[i]);
                }
        }
       
        for( new i = 1; i < sizeof(gTINYMODELS); i++ )
        {
                if( i != OBJECT_TELEPORTBLOCK )
                {
                        precache_model(gTINYMODELS[i]);
                }
        }
       
        for( new i = 1; i < sizeof(gWALLMODELS); i++ )
        {
                if( i != OBJECT_TELEPORTBLOCK )
                {
                        precache_model(gWALLMODELS[i]);
                }
        }
       
        for( new i = 0; i < sizeof(gTELEPORTMODELS); i++ )
        {
                precache_model(gTELEPORTMODELS[i]);
        }
       
        gBeamSprite = precache_model("sprites/zbeam4.spr");
       
        return PLUGIN_CONTINUE;
}

public plugin_init()
{
        register_plugin(gPLUGIN, gVERSION, gAUTHOR);
       
        gCvarLimit = register_cvar("bcm_limit", "500", 0, 0.0);
        register_cvar("bcm4", "kzmed", FCVAR_SERVER|FCVAR_SPONLY, 0.0);
       
        gCvarAccessBuild = register_cvar("bcm_access_build", "c", FCVAR_SPONLY, 0.0);
        gCvarAccessMove = register_cvar("bcm_access_move", "c", FCVAR_SPONLY, 0.0);
        gCvarAccessDelete = register_cvar("bcm_access_delete", "c", FCVAR_SPONLY, 0.0);
        gCvarAccessNoclip = register_cvar("bcm_access_noclip", "c", FCVAR_SPONLY, 0.0);
        gCvarAccessLoad = register_cvar("bcm_access_load", "c", FCVAR_SPONLY, 0.0);
        gCvarAccessNewConfig = register_cvar("bcm_access_newconfig", "c", FCVAR_SPONLY, 0.0);
        gCvarAccessSave = register_cvar("bcm_access_save", "c", FCVAR_SPONLY, 0.0);
        gCvarAccessMagicCarpet = register_cvar("bcm_access_magiccarpet", "c", FCVAR_SPONLY, 0.0);
       
        new szAccessFlag[2];
        get_pcvar_string(gCvarAccessBuild, szAccessFlag, 1);
        new accessBuild = read_flags(szAccessFlag);
       
        get_pcvar_string(gCvarAccessMove, szAccessFlag, 1);
        new accessMove = read_flags(szAccessFlag);
       
        get_pcvar_string(gCvarAccessDelete, szAccessFlag, 1);
        new accessDelete = read_flags(szAccessFlag);
       
        get_pcvar_string(gCvarAccessNoclip, szAccessFlag, 1);
        new accessNoclip = read_flags(szAccessFlag);
       
        get_pcvar_string(gCvarAccessNewConfig, szAccessFlag, 1);
        new accessNewConfig = read_flags(szAccessFlag);
       
        get_pcvar_string(gCvarAccessSave, szAccessFlag, 1);
        new accessSave = read_flags(szAccessFlag);
       
        get_pcvar_string(gCvarAccessMagicCarpet, szAccessFlag, 1);
        new accessMagicCarpet = read_flags(szAccessFlag);
       
        register_forward(FM_Touch, "fwdTouch", 0);
       
        register_event("HLTV", "msgNewRound", "a", "1=0", "2=0");
       
        register_forward(FM_PlayerPreThink, "fwdPlayerPreThink", 0);
       
        gMsgSayText = get_user_msgid("SayText");
        gMaxPlayers = get_maxplayers();
       
        gMainMenu = menu_create("BCM4 EDITED by jOkeR", "mnuMain", 0);
        menu_additem(gMainMenu, "Build Menu", "1", 0, -1);
        menu_additem(gMainMenu, "Move Menu", "2", 0, -1);
        menu_additem(gMainMenu, "Destroy", "3", accessDelete, -1);
        menu_additem(gMainMenu, "Noclip", "4", accessNoclip, -1);
        menu_additem(gMainMenu, "Load", "5", 0, -1);
        menu_additem(gMainMenu, "Save", "6", accessSave, -1);
       
        gBuildMenu = menu_create("Build Menu", "mnuBuild", 0);
        menu_additem(gBuildMenu, "Bhop", "1", accessBuild, -1);
        menu_additem(gBuildMenu, "Block", "2", accessBuild, -1);
        menu_additem(gBuildMenu, "Boost Block", "3", accessBuild, -1);
        menu_additem(gBuildMenu, "Ice Bhop", "4", accessBuild, -1);
        menu_additem(gBuildMenu, "Delayed Bhop", "5", accessBuild, -1);
        menu_additem(gBuildMenu, "Fall Block", "6", accessBuild, -1);
        menu_additem(gBuildMenu, "Teleport", "7", accessBuild, -1);
        menu_additem(gBuildMenu, "Fatalis Block", "8", accessBuild, -1);
        menu_additem(gBuildMenu, "Tink Block", "9", accessBuild, -1);
        menu_additem(gBuildMenu, "Magic Carpet", "10", accessMagicCarpet, -1);
        menu_additem(gBuildMenu, "Duck Block", "11", accessBuild, -1);
        menu_additem(gBuildMenu, "Speed Block", "12", accessBuild, -1);
        menu_additem(gBuildMenu, "Slow Block", "13", accessBuild, -1);
        menu_additem(gBuildMenu, "Window Block", "14", accessBuild, -1);
       
        menu_setprop(gBuildMenu, MPROP_EXITNAME, "Main Menu");
               
        gMoveMenu = menu_create("Move Menu", "mnuMove", 0);
        menu_additem(gMoveMenu, "Z+ Green", "1", accessMove, -1);
        menu_additem(gMoveMenu, "Z-", "2", accessMove, -1);
        menu_additem(gMoveMenu, "X+ Red", "3", accessMove, -1);
        menu_additem(gMoveMenu, "X-", "4", accessMove, -1);
        menu_additem(gMoveMenu, "Y+ Blue", "5", accessMove, -1);
        menu_additem(gMoveMenu, "Y-", "6", accessMove, -1);
        menu_additem(gMoveMenu, "Z++", "7", accessMove, -1);
        menu_setprop(gMoveMenu, MPROP_EXITNAME, "Main Menu");
       
        gModelMenu = menu_create("Model Menu", "mnuModel", 0);
        menu_additem(gModelMenu, "Normal", "1", 0, -1);
        menu_additem(gModelMenu, "Wall Z (Green)", "2", 0, -1);
        menu_additem(gModelMenu, "Wall X (Red)", "3", 0, -1);
        menu_additem(gModelMenu, "Wall Y (Blue)", "4", 0, -1);
        menu_additem(gModelMenu, "Tiny", "5", 0, -1);
        menu_setprop(gMoveMenu, MPROP_EXITNAME, "Main Menu");
       
        register_clcmd("say /bhopmenu", "cmdBhopMenu", -1, "");
        register_clcmd("say /bcm", "cmdBhopMenu", -1, "");
        register_clcmd("amx_bcm", "cmdBhopMenu", -1, "");
        register_clcmd("bcm_newconfig", "cmdNewConfig", accessNewConfig, "");
       
        register_clcmd("+bcmgrab", "cmdBCMGrabOn", accessMove, "");
        register_clcmd("-bcmgrab", "cmdBCMGrabOff", accessMove, "");
       
        register_srvcmd("bcm_backwardscompat2", "fnConvertFrom2", -1, "");
       
        if( !dir_exists(gDir) )
        {
                mkdir(gDir);
        }
       
        add(gDir, 128, "/bcm", 0);
       
        if( !dir_exists(gDir) )
        {
                mkdir(gDir);
        }
       
        new szMap[33];
        get_mapname(szMap, 32);
       
        format(gDir, 128, "%s/%s", gDir, szMap);
       
        if( !dir_exists(gDir) )
        {
                mkdir(gDir);
        }
       
        fnBackwardsCompat3();
       
        fnLoad("default");
       
        set_task(2.0, "tskShowObjectInfo", 0, "", 0, "b", 0);
       
        return PLUGIN_CONTINUE;
}

public cmdNewConfig(plr, level, cid)
{
        if( !cmd_access(plr, level, cid, 2) )
        {
                return PLUGIN_HANDLED;
        }
       
        new szArg[33];
        read_argv(1, szArg, 32);
       
        if( !fnIsStringAlphaNumeric(szArg) )
        {
                fnGreenChat(plr, "[KzM] Config name must be alphanumeric.");
               
                return PLUGIN_HANDLED;
        }
       
        new szPath[129];
        format(szPath, 128, "%s/%s.txt", gDir, szArg);
       
        if( !file_exists(szPath) )
        {
                new f = fopen(szPath, "wt");
                fputs(f, "");
                fclose(f);
               
                new szName[32];
                get_user_name(plr, szName, 32);
               
                fnGreenChat(0, "[KzM] %s created config ^"%s^".", szName, szArg);
        }
       
        return PLUGIN_HANDLED;
}

fnBackwardsCompat3()
{
        new szPath[129];
        format(szPath, 128, "%s.txt", gDir);
       
        if( file_exists(szPath) )
        {
                new szNewPath[129];
                format(szNewPath, 128, "%s/default.txt", gDir);
               
                new szData[129], f = fopen(szPath, "rt"), newf = fopen(szNewPath, "at");
                while( !feof(f) )
                {
                        fgets(f, szData, 128);
                       
                        if( szData[0] == '^0' )
                        {
                                continue;
                        }
                       
                        fputs(newf, szData);
                }
                fclose(f);
                fclose(newf);
               
                delete_file(szPath);
        }
}

public cmdBCMGrabOn(plr, level, cid)
{
        if( !cmd_access(plr, level, cid, 1) )
        {
                return PLUGIN_HANDLED;
        }
       
        new ent = fnGetAimEnt(plr);
       
        new type = fnGetObjectType(ent);
       
        if( type )
        {
                new szEnt[5];
                num_to_str(ent, szEnt, 4);
               
                new Float:vPlayerOrigin[3], Float:vEntOrigin[3];
                pev(plr, pev_origin, vPlayerOrigin);
                pev(ent, pev_origin, vEntOrigin);
               
                gGrabLength[plr] = floatround(vector_distance(vPlayerOrigin, vEntOrigin));
               
                set_task(0.1, "tskGrab", TASK_ID_GRAB + plr, szEnt, 4, "b", 0);
        }
       
        return PLUGIN_HANDLED_MAIN;
}

public cmdBCMGrabOff(plr, level, cid)
{
        if( !cmd_access(plr, level, cid, 1) )
        {
                return PLUGIN_HANDLED;
        }
       
        remove_task(TASK_ID_GRAB + plr, 0);
       
        return PLUGIN_HANDLED;
}

public tskGrab(const szEnt[], plr)
{
        plr -= TASK_ID_GRAB;
       
        static ent;
        ent = str_to_num(szEnt);
       
        static Float:vAim[3];
        velocity_by_aim(plr, gGrabLength[plr], vAim);
       
        static Float:vOrigin[3];
        pev(plr, pev_origin, vOrigin);
       
        vOrigin[0] += vAim[0];
        vOrigin[1] += vAim[1];
        vOrigin[2] += vAim[2];
       
        fnSetOriginSnap(ent, vOrigin);
       
        return PLUGIN_CONTINUE;
}

public cmdBhopMenu(plr, level, cid)
{
        menu_display(plr, gMainMenu, 0);
       
        return PLUGIN_CONTINUE;
}

public mnuMain(plr, menu, item)
{
        if( item == MENU_EXIT )
        {
                return PLUGIN_CONTINUE;
        }
       
        new szCmd[3],  _access, callback;
        menu_item_getinfo(menu, item, _access, szCmd, 2, "", 0, callback);
       
        switch( str_to_num(szCmd) )
        {
                case 1: // Build
                {
                        menu_display(plr, gModelMenu, 0);
                        set_task(0.1, "tskShowXYZ", TASK_ID_SHOWXYZ + plr, "", 0, "b", 0);
                        return PLUGIN_CONTINUE;
                }
                case 2: // Move
                {
                        menu_display(plr, gMoveMenu, 0);
                        set_task(0.1, "tskShowXYZ", TASK_ID_SHOWXYZ + plr, "", 0, "b", 0);
                        return PLUGIN_CONTINUE;
                }
                case 3: // Delete
                {
                        new ent = fnGetAimEnt(plr);
                       
                        new type = fnGetObjectType(ent);
                        if( type )
                        {
                                if( type != 99 )
                                {
                                        engfunc(EngFunc_RemoveEntity, ent);
                                }
                                else
                                {
                                        new szTarget[5];
                                        pev(ent, pev_target, szTarget, 4);
                                       
                                        new dest = engfunc(EngFunc_FindEntityByString, -1,
                                                "targetname", szTarget);
                                               
                                        engfunc(EngFunc_RemoveEntity, ent);
                                        if( dest )
                                        {
                                                engfunc(EngFunc_RemoveEntity, dest);
                                        }
                                }
                        }
                }
                case 4: // Noclip
                {
                        if( get_user_flags(plr, 0)&ADMIN_KICK ) // quick fix for a bug that only happens on one person's server
                        {
                                set_pev(plr, pev_movetype, pev(plr, pev_movetype) == MOVETYPE_WALK ?
                                        MOVETYPE_NOCLIP : MOVETYPE_WALK);
                        }
                }
                case 5: // Load
                {
                        new szTitle[49];
                        format(szTitle, 48, "Load Menu - Current: %s", gCurConfig);
                       
                        new menu = menu_create(szTitle, "mnuLoad", 0);
                       
                        new szAccessFlag[2];
                        get_pcvar_string(gCvarAccessLoad, szAccessFlag, 1);
                        new accessLoad = read_flags(szAccessFlag);
                       
                        new dir = open_dir(gDir, "", 0);
                       
                        new szFileName[65];
                        while( next_file(dir, szFileName, 64) )
                        {
                                if( szFileName[0] == '.' )
                                {
                                        continue;
                                }
                               
                                replace(szFileName, 64, ".txt", "");
                                menu_additem(menu, szFileName, "", accessLoad, -1);
                        }
                        close_dir(dir);
                       
                        menu_additem(menu, "\rNew Config", "1", 0, -1);
                       
                        menu_setprop(menu, MPROP_EXITNAME, "Main Menu");
                       
                        menu_display(plr, menu, 0);
                       
                        return PLUGIN_CONTINUE;
                       
                        /*new ent = fnGetAimEnt(plr);
                       
                        new type = fnGetObjectType(ent);
                        if( type && type != 99 )
                        {
                                new szName[32];
                                pev(ent, pev_targetname, szName, 31);
                               
                                if( szName[0] == '^0' )
                                {
                                        copy(szName, 31, "Unknown");
                                }
                               
                                fnGreenChat(plr, "[KzM] Creator: %s", szName);
                        }
                        else
                        {
                                fnGreenChat(plr, "[KzM] Aim at an object first.");
                        }*/
                       
                }
                case 6: // Save
                {
                        new szName[32];
                        get_user_name(plr, szName, 31);
                       
                        fnGreenChat(0, "[KzM] %s saved config ^"%s^", %i objects.", szName,
                                gCurConfig, fnSave());
                }
        }
       
        menu_display(plr, gMainMenu, 0);
       
        return PLUGIN_CONTINUE;
}

public mnuLoad(plr, menu, item)
{
        if( item == MENU_EXIT )
        {
                menu_destroy(menu);
                menu_display(plr, gMainMenu, 0);
                return PLUGIN_CONTINUE;
        }
       
        new szCmd[2], szItem[33], _access, callback;
        menu_item_getinfo(menu, item, _access, szCmd, 1, szItem, 32, callback);
       
        if( str_to_num(szCmd) )
        {
                fnGreenChat(plr, "[KzM] Type a name for the new config.");
               
                client_cmd(plr, "messagemode bcm_newconfig");
               
                menu_destroy(menu);
                menu_display(plr, gMainMenu, 0);
                return PLUGIN_CONTINUE;
        }
       
        new szName[32];
        get_user_name(plr, szName, 32);
       
        fnGreenChat(0, "[KzM] %s loaded config ^"%s^", %i objects.", szName, szItem, fnLoad(szItem));
       
        menu_destroy(menu);
        menu_display(plr, gMainMenu, 0);
        return PLUGIN_CONTINUE;
}

public mnuBuild(plr, menu, item)
{
        if( item == MENU_EXIT )
        {
                menu_display(plr, gMainMenu, 0);
                return PLUGIN_CONTINUE;
        }
       
        new szCmd[3],  _access, callback;
        menu_item_getinfo(menu, item, _access, szCmd, 2, "", 0, callback);
       
        new cmd = str_to_num(szCmd);
       
        if( fnGetObjectCount() >= get_pcvar_num(gCvarLimit) )
        {
                fnGreenChat(plr, "[KzM] Object limit of %i reached.", get_pcvar_num(gCvarLimit));
                menu_display(plr, gBuildMenu, cmd > 7 ? 1 : 0);
                return PLUGIN_CONTINUE;
        }
       
        switch( cmd )
        {
                case 1..6, 8..13:
                {
                        new Float:vOrigin[3];
                        fnGetAimOrigin(plr, vOrigin);
                        vOrigin[2] += 4.0;
                       
                        new szName[32];
                        get_user_name(plr, szName, 31);
                        replace_all(szName, 31, " ", "_");
                       
                        fnMakeObject(cmd, gChoseModel[plr], vOrigin, szName);
                }
                case OBJECT_TELEPORTBLOCK:
                {
                        new Float:vOrigin[3];
                        fnGetAimOrigin(plr, vOrigin);
                        vOrigin[2] += 4.0;
                       
                        static bool:alt[33], szRand[33][5];
                        if( !alt[plr] )
                        {
                                alt[plr] = true;
                               
                                format(szRand[plr], 4, "%c%c%c%c",
                                        random_num('a', 'z'),
                                        random_num('a', 'z'),
                                        random_num('a', 'z'),
                                        random_num('a', 'z'));
                                       
                                fnMakeTeleport(vOrigin, szRand[plr], true);
                        }
                        else
                        {
                                alt[plr] = false;
                               
                                fnMakeTeleport(vOrigin, szRand[plr], false);
                        }
                }
        }
       
        menu_display(plr, gBuildMenu, cmd > 7 ? 1 : 0);
       
        return PLUGIN_CONTINUE;
}

public mnuMove(plr, menu, item)
{
        if( item == MENU_EXIT )
        {
                menu_display(plr, gMainMenu, 0);
                remove_task(TASK_ID_SHOWXYZ + plr, 0);
               
                return PLUGIN_CONTINUE;
        }
       
        new ent = fnGetAimEnt(plr);
       
        if( !fnGetObjectType(ent) )
        {
                menu_display(plr, gMoveMenu, 0);
                return PLUGIN_CONTINUE;
        }
       
        new Float:vOrigin[3];
        pev(ent, pev_origin, vOrigin);
       
        new szCmd[3],  _access, callback;
        menu_item_getinfo(menu, item, _access, szCmd, 2, "", 0, callback);
       
        switch( str_to_num(szCmd) )
        {
                case 1:
                {
                        vOrigin[2] += 8.0;
                }
                case 2:
                {
                        vOrigin[2] -= 8.0;
                }
                case 3:
                {
                        vOrigin[0] += 8.0;
                }
                case 4:
                {
                        vOrigin[0] -= 8.0;
                }
                case 5:
                {
                        vOrigin[1] += 8.0;
                }
                case 6:
                {
                        vOrigin[1] -= 8.0;
                }
                case 7:
                {
                        vOrigin[2] += 32.0;
                }
        }
       
        fnSetOriginSnap(ent, vOrigin);
       
        menu_display(plr, gMoveMenu, 0);
       
        return PLUGIN_CONTINUE;
}

public mnuModel(plr, menu, item)
{
        new szCmd[3],  _access, callback;
        menu_item_getinfo(menu, item, _access, szCmd, 2, "", 0, callback);
       
        remove_task(TASK_ID_SHOWXYZ + plr, 0);
       
        gChoseModel[plr] = str_to_num(szCmd);
       
        menu_display(plr, gBuildMenu, 0);
       
        return PLUGIN_CONTINUE;
}

public fwdTouch(ent, plr)
{
        if( !is_user_alive(plr) )
        {
                return FMRES_IGNORED;
        }
       
        static szEntClass[6];
        pev(ent, pev_classname, szEntClass, 5);
       
        if( equal(szEntClass, "bcm_3", 0) )
        {
                new type = fnGetObjectType(ent);
               
                switch( type )
                {
                case OBJECT_BHOP:
                {
                        if( !task_exists(TASK_ID_UNSOLID + ent, 0)
                        && !task_exists(TASK_ID_SOLID + ent, 0) )
                        {
                                set_task(0.1, "tskUnsolid", TASK_ID_UNSOLID + ent, "", 0, "", 0);
                        }
                }
                case OBJECT_BLOCK:
                {
                       
                }
                }
                case OBJECT_WINDOWBLOCK:
                {
               
                }
                }
                case OBJECT_BOOSTBLOCK:
                {
                        pev(plr, pev_velocity, gSetVelocity[plr]);
                       
                        gSetVelocity[plr][2] = 600.0;
                        if( !task_exists(TASK_ID_FALLBLOCK + plr, 0) )
                        {
                                set_pev(plr, pev_takedamage, 0.0);
                                set_task(0.0, "tskFallBlock", TASK_ID_FALLBLOCK + plr, "", 0, "", 0);
                        }
                }
                case OBJECT_ICEBHOP:
                {
                        set_pev(plr, pev_fuser2, 0.0);
                       
                        if( !task_exists(TASK_ID_UNSOLID + ent, 0)
                        && !task_exists(TASK_ID_SOLID + ent, 0) )
                        {
                                set_task(0.1, "tskUnsolid", TASK_ID_UNSOLID + ent, "", 0, "", 0);
                        }
                }
                case OBJECT_DELAYEDBHOP:
                {
                        if( !task_exists(TASK_ID_UNSOLID + ent, 0)
                        && !task_exists(TASK_ID_SOLID + ent, 0) )
                        {
                                set_task(1.0, "tskUnsolid", TASK_ID_UNSOLID + ent, "", 0, "", 0);
                        }
                }
                case OBJECT_FALLBLOCK:
                {
                        static Float:lastTouch[33];
                       
                        if( get_gametime() - lastTouch[plr] < 1.0 )
                        {
                                return FMRES_IGNORED;
                        }
                       
                        lastTouch[plr] = get_gametime();
                       
                        if( !task_exists(TASK_ID_FALLBLOCK + plr, 0) )
                        {
                                set_pev(plr, pev_takedamage, 0.0);
                                set_task(0.0, "tskFallBlock", TASK_ID_FALLBLOCK + plr, "", 0, "", 0);
                        }
                }
                case OBJECT_TELEPORTBLOCK:
                {
                       
                }
                case OBJECT_FATALISBLOCK:
                {
                        static Float:lastTouched[33];
                       
                        if( get_gametime() - lastTouched[plr] > 1.0 )
                        {
                                new Float:health;
                                pev(plr, pev_health, health);
                               
                                if( health > 10.0 )
                                {
                                        if( pev(plr, pev_takedamage) )
                                        {
                                                set_pev(plr, pev_health, health - 100.0);
                                        }
                                }
                                else
                                {
                                        user_kill(plr, 0);
                                }
                               
                                lastTouched[plr] = get_gametime();
                        }
                }
                case OBJECT_TINKBLOCK:
                {
                        static Float:lastTouched[33];
                       
                        if( get_gametime() - lastTouched[plr] > 1.0 )
                        {
                                new Float:health;
                                pev(plr, pev_health, health);
                                if( health <= 98.0 )
                                {
                                        set_pev(plr, pev_health, health + 5.0);
                                }
                               
                                lastTouched[plr] = get_gametime();
                        }
                }
                case OBJECT_MAGICCARPET:
                {
                        if( get_user_team(plr, "", 0) == 2)
                        {
                                new Float:vVelocity[3];
                                pev(plr, pev_velocity, vVelocity);
                                vVelocity[2] = 0.0;
                                set_pev(ent, pev_velocity, vVelocity);
                        }
                }
                case OBJECT_DUCKBLOCK:
                {
                        set_pev(plr, pev_bInDuck, 1);
                }
                case OBJECT_SPEEDBLOCK:
                {
                        velocity_by_aim(plr, 1200, gSetVelocity[plr]);
                        gSetVelocity[plr][2] = 0.0;
                }
                case OBJECT_SLOWBLOCK:
                {
                        if( get_gametime() - gSlowedTime[plr] < 3.0
                        && gEntSlowed[plr] == ent )
                        {
                                set_pev(plr, pev_maxspeed, 75.0);
                        }
                       
                        if( !task_exists(TASK_ID_MAXSPEED + plr, 0) )
                        {
                                new szEntId[5];
                                num_to_str(ent, szEntId, 4);
                               
                                set_task(3.0, "tskMaxSpeed", TASK_ID_MAXSPEED + plr, szEntId, 4, "", 0);
                        }
                }
                }
        }
        else if( equal(szEntClass, "bcm_t", 0) )
        {
                new szTarget[5];
                pev(ent, pev_target, szTarget, 4);
               
                new dest = engfunc(EngFunc_FindEntityByString, -1, "targetname", szTarget);
               
                if( dest )
                {
                        new Float:vOrigin[3];
                        pev(dest, pev_origin, vOrigin);
                        vOrigin[2] += 64.0;
                       
                        if( !task_exists(TASK_ID_RESETVELOCITY + plr, 0) )
                        {
                                set_task(0.0, "tskResetVelocity", TASK_ID_RESETVELOCITY + plr, "", 0, "", 0);
                        }
                       
                        engfunc(EngFunc_SetOrigin, plr, vOrigin);
                }
        }
       
        return FMRES_IGNORED;
}

public tskMaxSpeed(const szEntId[], plr)
{
        plr -= TASK_ID_MAXSPEED;
       
        if( is_user_alive(plr) )
        {
                gSlowedTime[plr] = get_gametime();
               
                gEntSlowed[plr] = str_to_num(szEntId);
       
                set_pev(plr, pev_maxspeed, 250.0);
        }
}

public tskUnsolid(ent)
{
        ent -= TASK_ID_UNSOLID;
       
        set_pev(ent, pev_solid, SOLID_NOT);
        set_pev(ent, pev_rendermode, kRenderTransAdd);
        set_pev(ent, pev_renderamt, 100.0);
       
        set_task(1.0, "tskSolid", TASK_ID_SOLID + ent, "", 0, "", 0);
}

public tskSolid(ent)
{
        ent -= TASK_ID_SOLID;
       
        set_pev(ent, pev_solid, SOLID_BBOX);
        set_pev(ent, pev_rendermode, kRenderNormal);
}

public tskResetVelocity(plr)
{
        plr -= TASK_ID_RESETVELOCITY;
       
        set_pev(plr, pev_velocity, Float:{0.0, 0.0, 0.0});
}

public tskFallBlock(plr)
{
        plr -= TASK_ID_FALLBLOCK;
       
        set_pev(plr, pev_takedamage, 1.0);
}

public msgNewRound()
{
        new ent, Float:vOrigin[3];
        while( (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "bcm_3")) )
        {
                if( fnGetObjectType(ent) == OBJECT_MAGICCARPET )
                {
                        pev(ent, pev_v_angle, vOrigin);
                       
                        set_pev(ent, pev_velocity, Float:{0.0, 0.0, 0.0});
                        engfunc(EngFunc_SetOrigin, ent, vOrigin);
                }
        }
}

fnMakeObject(object, model, Float:vOrigin[3], const szName[])
{
        if( (vOrigin[0] == 0.0
        && vOrigin[1] == 0.0
        && vOrigin[2] == 0.0)
        || !fnIsOriginVacant(model, vOrigin) )
        {
                return 0;
        }
       
        new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
       
        if( !pev_valid(ent) )
        {
                return 0;
        }
       
        set_pev(ent, pev_classname, "bcm_3");
        set_pev(ent, pev_solid, SOLID_BBOX);
        set_pev(ent, pev_movetype, MOVETYPE_NONE);
        set_pev(ent, pev_targetname, szName);
       
        switch( model )
        {
        case MODEL_NORMAL:
        {
                engfunc(EngFunc_SetModel, ent, gNORMALMODELS[object]);
        }
        case MODEL_WALLZ..MODEL_WALLY:
        {
                engfunc(EngFunc_SetModel, ent, gWALLMODELS[object]);
        }
        case MODEL_TINY:
        {
                engfunc(EngFunc_SetModel, ent, gTINYMODELS[object]);
        }
        }
       
        engfunc(EngFunc_SetSize, ent, gMINS[model], gMAXS[model]);
       
        if( model == MODEL_WALLY )
        {
                set_pev(ent, pev_angles, Float:{0.0, 90.0, 0.0});
        }
        else if( model == MODEL_WALLZ )
        {
                set_pev(ent, pev_angles, Float:{0.0, 0.0, 90.0});
        }
       
        fnSetOriginSnap(ent, vOrigin);
       
        if( object == OBJECT_MAGICCARPET )
        {
                set_pev(ent, pev_movetype, MOVETYPE_FLY);
                set_pev(ent, pev_v_angle, vOrigin);
        }
       
        return 1;
}

fnMakeTeleport(Float:vOrigin[3], const szTarget[], bool:mode)
{
        if( (vOrigin[0] == 0.0 && vOrigin[1] == 0.0 && vOrigin[2] == 0.0)
        || !fnIsOriginVacant(MODEL_TELESTART, vOrigin)
        || (!mode && !engfunc(EngFunc_FindEntityByString, -1, "target", szTarget)) )
        {
                return 0;
        }
       
        new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
       
        if( !pev_valid(ent) )
        {
                return 0;
        }
       
        set_pev(ent, pev_classname, mode ? "bcm_t" : "bcm_d");
        set_pev(ent, pev_solid, SOLID_BBOX);
        set_pev(ent, pev_movetype, MOVETYPE_NONE);
        set_pev(ent, mode ? pev_target : pev_targetname, szTarget);
        set_pev(ent, pev_framerate, 5.0);
        set_pev(ent, pev_rendermode, kRenderTransAdd);
        set_pev(ent, pev_renderamt, 255.0);
       
        if( !mode )
        {
                set_pev(ent, pev_angles, Float:{0.0, 0.0, 90.0});
        }
       
        engfunc(EngFunc_SetModel, ent, mode ? gTELEPORTMODELS[0] : gTELEPORTMODELS[1]);
       
        engfunc(EngFunc_SetSize, ent, gMINS[MODEL_TELESTART], gMAXS[MODEL_TELESTART]);
       
        fnSetOriginSnap(ent, vOrigin);
       
        return 1;
}

fnGetAimOrigin(plr, Float:vOrigin[3])
{
        new Float:vStart[3], Float:vViewOfs[3], Float:vDest[3];
       
        pev(plr, pev_origin, vStart);
        pev(plr, pev_view_ofs, vViewOfs);
       
        vStart[0] += vViewOfs[0];
        vStart[1] += vViewOfs[1];
        vStart[2] += vViewOfs[2];
       
        pev(plr, pev_v_angle, vDest);
        engfunc(EngFunc_MakeVectors, vDest);
        global_get(glb_v_forward, vDest);
       
        vDest[0] *= 9999.0;
        vDest[1] *= 9999.0;
        vDest[2] *= 9999.0;
       
        vDest[0] += vStart[0];
        vDest[1] += vStart[1];
        vDest[2] += vStart[2];

        engfunc(EngFunc_TraceLine, vStart, vDest, 0, plr, 0);
        get_tr2(0, TR_vecEndPos, vOrigin);

        return 1;
}

fnGetAimEnt(plr)
{
        new Float:vStart[3], Float:vViewOfs[3], Float:vDest[3];
       
        pev(plr, pev_origin, vStart);
        pev(plr, pev_view_ofs, vViewOfs);
       
        vStart[0] += vViewOfs[0];
        vStart[1] += vViewOfs[1];
        vStart[2] += vViewOfs[2];
       
        pev(plr, pev_v_angle, vDest);
        engfunc(EngFunc_MakeVectors, vDest);
        global_get(glb_v_forward, vDest);
       
        vDest[0] *= 9999.0;
        vDest[1] *= 9999.0;
        vDest[2] *= 9999.0;
       
        vDest[0] += vStart[0];
        vDest[1] += vStart[1];
        vDest[2] += vStart[2];

        engfunc(EngFunc_TraceLine, vStart, vDest, 0, plr, 0);
       
        new ent = get_tr2(0, TR_pHit);
       
        if( !pev_valid(ent) )
        {
                new Float:vOrigin[3];
                fnGetAimOrigin(plr, vOrigin);
               
                new szClass[6];
                while( (ent = engfunc(EngFunc_FindEntityInSphere, ent, vOrigin, 1.0)) )
                {
                        pev(ent, pev_classname, szClass, 5);
                        if( equal(szClass, "bcm_3", 0) )
                        {
                                return ent;
                        }
                }
               
                return 0;
        }
       
        return ent;
}

fnSetOriginSnap(ent, Float:vOrigin[3])
{
        vOrigin[0] = float(floatround(vOrigin[0] / 8.0)) * 8.0;
        vOrigin[1] = float(floatround(vOrigin[1] / 8.0)) * 8.0;
        vOrigin[2] = float(floatround(vOrigin[2] / 8.0)) * 8.0;
       
        new model = fnGetObjectModelType(ent);
        if( !model )
        {
                return 0;
        }
       
        if( !fnIsOriginNearSpawn(vOrigin)
        && fnIsOriginVacant(model, vOrigin) )
        {               
                engfunc(EngFunc_SetOrigin, ent, vOrigin);
               
                if( model == MODEL_WALLX
                || model == MODEL_WALLY )
                {
                        vOrigin[2] += 15.0;////
                }
               
                if( engfunc(EngFunc_PointContents, vOrigin) == -2 )
                {
                        new type = fnGetObjectType(ent);
                       
                        if( type && type != 99 )
                        {
                                fnSetRendering(ent, kRenderFxGlowShell, gGLOWS[type][0],
                                        gGLOWS[type][1], gGLOWS[type][2], kRenderNormal, 64);
                        }
                }
                else
                {
                        set_pev(ent, pev_renderfx, kRenderFxNone);
                }
        }
       
        return 1;
}

bool:fnIsOriginNearSpawn(Float:vOrigin[3])
{
        new ent;
        new szClass[23];
       
        while( (ent = engfunc(EngFunc_FindEntityInSphere, ent, vOrigin, 128.0)) )
        {
                pev(ent, pev_classname, szClass, 22);
               
                if( equal(szClass, "info_player_start", 0)
                || equal(szClass,"info_player_deathmatch", 0) )
                {
                        return true;
                }
        }
       
        return false;
}

fnGetObjectType(ent)
{
        new szClass[6];
        pev(ent, pev_classname, szClass, 5);
       
        if( equal(szClass, "bcm_t", 0)
        || equal(szClass, "bcm_d", 0) )
        {
                return 99;
        }
        else if( !equal(szClass, "bcm_3", 0) )
        {
                return 0;
        }
       
        /*new Float:vColor[3];
        pev(ent, pev_rendercolor, vColor);
       
        for( new i = 0; i < sizeof(gGLOWS); i++ )
        {
                if( vColor[0] == gGLOWS[i][0]
                && vColor[1] == gGLOWS[i][1]
                && vColor[2] == gGLOWS[i][2] )
                {
                        return i;
                }
        }*/
       
        new szModel[65];
        pev(ent, pev_model, szModel, 64);
       
        for( new i = 1; i < sizeof(gTYPES); i++ )
        {
                if( contain(szModel, gTYPES[i]) > -1 )
                {
                        return i;
                }
        }
       
        return 0;
}

fnGetObjectModelType(ent)
{
        new szModel[65];
        pev(ent, pev_model, szModel, 64);
       
        for( new i = 1; i < sizeof(gMODELTYPES); i++ )
        {
                if( contain(szModel, gMODELTYPES[i]) > -1 )
                {
                        switch( i )
                        {
                        case MODEL_WALLZ .. MODEL_WALLY:
                        {
                                new Float:vAngles[3];
                                pev(ent, pev_angles, vAngles);
                               
                                if( vAngles[1] == 90.0 )
                                {
                                        return MODEL_WALLY;
                                }
                                else if( vAngles[2] == 90.0 )
                                {
                                        return MODEL_WALLZ;
                                }
                                else
                                {
                                        return MODEL_WALLX;
                                }
                        }
                        default:
                        {
                                return i;
                        }
                        }
                }
        }
       
        return 0;
}

fnSave()
{
        new szPath[129];
        format(szPath, 128, "%s/%s.txt", gDir, gCurConfig);
       
        delete_file(szPath);
       
        new f = fopen(szPath, "at");
       
        new ent, type, szData[129], Float:vOrigin[3], szName[32], count, modelType;
        while( (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "bcm_3")) )
        {
                count++;
               
                type = fnGetObjectType(ent);
                pev(ent, pev_origin, vOrigin);
                pev(ent, pev_targetname, szName, 31);
               
                modelType = fnGetObjectModelType(ent);
               
                format(szData, 128, "%i %f %f %f %s %i^n", type, vOrigin[0], vOrigin[1], vOrigin[2],
                        szName, modelType);
                fputs(f, szData);
        }
       
        new Float:vOrigin2[3], dest, szTarget[5];
        ent = 0;
        while( (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "bcm_t")) )
        {
                count++;
               
                pev(ent, pev_origin, vOrigin);
                pev(ent, pev_target, szTarget, 4);
               
                dest = engfunc(EngFunc_FindEntityByString, -1, "targetname", szTarget);
                if( !dest )
                {
                        continue;
                }
               
                pev(dest, pev_origin, vOrigin2);
               
                format(szData, 128, "99 %f %f %f %f %f %f^n", vOrigin[0], vOrigin[1], vOrigin[2],
                        vOrigin2[0], vOrigin2[1], vOrigin2[2]);
                       
                fputs(f, szData);
        }
       
        fclose(f);
       
        return count;
}

fnLoad(const szConfigName[])
{
        new ent;
        while( (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "bcm_3")) )
        {
                engfunc(EngFunc_RemoveEntity, ent);
        }
        ent = 0;
        while( (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "bcm_t")) )
        {
                engfunc(EngFunc_RemoveEntity, ent);
        }
        ent = 0;
        while( (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "bcm_d")) )
        {
                engfunc(EngFunc_RemoveEntity, ent);
        }
       
        new szData[129], szType[3], szX[13], szY[13], szZ[13], szName[32], szModelType[3];
        new szX2[13], szY2[13], szZ2[13], szTarget[5];
        new Float:vOrigin[3], Float:vOrigin2[3];
        new type, modelType, count;
       
        new szPath[129];
        format(szPath, 128, "%s/%s.txt", gDir, szConfigName);
       
        if( !file_exists(szPath) )
        {
                return 0;
        }
       
        copy(gCurConfig, 32, szConfigName);
       
        new f = fopen(szPath, "rt");
        while( !feof(f) )
        {
                fgets(f, szData,128);
               
                if( !strlen(szData) )
                {
                        continue;
                }
               
                parse(szData, szType, 2);
               
                type = str_to_num(szType);
                if( type != 99 )
                {
                        parse(szData, "", 0, szX, 12, szY, 12, szZ, 12, szName, 31, szModelType, 2);
                        vOrigin[0] = str_to_float(szX);
                        vOrigin[1] = str_to_float(szY);
                        vOrigin[2] = str_to_float(szZ);
                       
                        modelType = str_to_num(szModelType);
                        count++;
                       
                        fnMakeObject(type, !modelType ? MODEL_NORMAL : modelType, vOrigin, szName);////
                }
                else
                {
                        parse(szData, "", 0, szX, 12, szY, 12, szZ, 12, szX2, 12, szY2, 12, szZ2, 12);
                       
                        vOrigin[0] = str_to_float(szX);
                        vOrigin[1] = str_to_float(szY);
                        vOrigin[2] = str_to_float(szZ);
                       
                        vOrigin2[0] = str_to_float(szX2);
                        vOrigin2[1] = str_to_float(szY2);
                        vOrigin2[2] = str_to_float(szZ2);
                       
                        format(szTarget, 4, "%c%c%c%c",
                                random_num('a', 'z'),
                                random_num('a', 'z'),
                                random_num('a', 'z'),
                                random_num('a', 'z'));
                               
                        count++;
                               
                        fnMakeTeleport(vOrigin, szTarget, true);
                        fnMakeTeleport(vOrigin2, szTarget, false);
                }
               
        }
       
        fclose(f);
       
        return count;
}

fnGreenChat(plr, const message[], {Float,Sql,Result,_}:...)
{
        static msg[192];
        msg[0] = 0x04;
       
        vformat(msg[1], 190, message, 3);
       
        if( plr > 0 && plr <= 32 )
        {
                message_begin(MSG_ONE, gMsgSayText, {0, 0, 0}, plr);
                write_byte(plr);
                write_string(msg);
                message_end();
        }
        else if( plr == 0 )
        {
                for( new i = 1; i <= gMaxPlayers; i++ )
                {
                        if( !is_user_connected(i) )
                        {
                                continue;
                        }
                       
                        message_begin(MSG_ONE, gMsgSayText, {0, 0, 0}, i);
                        write_byte(i);
                        write_string(msg);
                        message_end();
                }
        }
       
        return 1;
}

public tskShowObjectInfo()
{
        for( new i = 1; i <= gMaxPlayers; i++ )
        {
                if( !is_user_connected(i) )
                {
                        continue;
                }
               
                new ent = fnGetAimEnt(i);
               
                new type = fnGetObjectType(ent);
                if( type && type != 99 )
                {
                        new szName[32];
                        pev(ent, pev_targetname, szName, 31);
                       
                        if( szName[0] == '^0' )
                        {
                                copy(szName, 31, "Unknown");
                        }
                       
                        set_hudmessage(255, 255, 0, -1.0, 0.75, 0, 0.0, 2.0, 0.0, 0.0, 4);
                        show_hudmessage(i, "Object Type: %s^nCreator: %s", gOBJECTNAMES[type], szName);
                }
        }
}

fnGetObjectCount()
{
        new ent, i;
        while( (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "bcm_3")) )
        {
                i++;
        }
       
        ent = 0;
       
        while( (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "bcm_t")) )
        {
                i++;
        }
       
        ent = 0;
       
        while( (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "bcm_t")) )
        {
                i++;
        }
       
        return i;
}

public fnConvertFrom2()
{
        new szDir[] = "addons/amxmodx/configs/bcm";
        new dir = open_dir(szDir, "", 0);
       
        new szFile[65];
        new szPath[129];
        while( next_file(dir, szFile, 64) )
        {
                if( szFile[0] == '.' )
                {
                        continue;
                }
               
                format(szPath, 128, "%s/%s", szDir, szFile);
               
                new f = fopen(szPath, "rt");
                new szData[129];
                while( !feof(f) )
                {
                        fgets(f, szData, 128);
                        replace(szData, 128, "S", "2");
                        replace(szData, 128, "B", "1");
                        replace(szData, 128, "E", "2");
                       
                        replace(szFile, 64, ".cfg", "");
                        format(szPath, 128, "addons/amxmodx/data/kzm/bcm/%s.txt", szFile);
                       
                        new f2 = fopen(szPath, "at");
                        fputs(f2, szData);
                        fclose(f2);
                }
                fclose(f);
        }
        close_dir(dir);
}

public fwdPlayerPreThink(plr)
{
        // emp
        if( (gSetVelocity[plr][0] != 0.0
        || gSetVelocity[plr][1] != 0.0
        || gSetVelocity[plr][2] != 0.0)
        && is_user_alive(plr) )
        {
                set_pev(plr, pev_velocity, gSetVelocity[plr]);
                gSetVelocity[plr][0] = 0.0;
                gSetVelocity[plr][1] = 0.0;
                gSetVelocity[plr][2] = 0.0;
        }
       
        return FMRES_IGNORED;
}

public tskShowXYZ(plr)
{
        plr -= TASK_ID_SHOWXYZ;
       
        if( !is_user_connected(plr) )
        {
                remove_task(TASK_ID_SHOWXYZ + plr, 0);
               
                return PLUGIN_CONTINUE;
        }
       
        static Float:vAim[3];
        velocity_by_aim(plr, 64, vAim);
       
        static Float:vOrigin[3];
        pev(plr, pev_origin, vOrigin);
       
        vOrigin[0] += vAim[0];
        vOrigin[1] += vAim[1];
        vOrigin[2] += vAim[2];
       
        vOrigin[2] += 16.0;
       
        static origin[3], origin2[3];
        FVecIVec(vOrigin, origin);
       
        origin2 = origin;
       
        origin[0] += 16;
        fnMakeSprite(plr, origin, origin2, {255, 0, 0});
       
        origin[0] -= 16;
        origin[1] += 16;
        fnMakeSprite(plr, origin, origin2, {0, 0, 255});
       
        origin[1] -= 16;
        origin[2] += 16;
        fnMakeSprite(plr, origin, origin2, {0, 255, 0});
       
        return PLUGIN_CONTINUE;
}

fnMakeSprite(plr, origin[], origin2[], color[], stay=1, all=0)////
{
        message_begin(all ? MSG_BROADCAST : MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, all ? 0 : plr);
        write_byte(0);
        write_coord(origin[0]);
        write_coord(origin[1]);
        write_coord(origin[2]);
        write_coord(origin2[0]);
        write_coord(origin2[1]);
        write_coord(origin2[2]);
        write_short(gBeamSprite);
        write_byte(1);
        write_byte(1);
        write_byte(stay);
        write_byte(4);
        write_byte(0);
        write_byte(color[0]);
        write_byte(color[1]);
        write_byte(color[2]);
        write_byte(190);
        write_byte(0);
        message_end();
       
        return 1;
}

fnIsOriginVacant(model, Float:vOrigin[3])
{
        // woot bad code
        static Float:vMins[3], Float:vMaxs[3];
        vMins[0] = gMINS[model][0];
        vMins[1] = gMINS[model][1];
        vMins[2] = gMINS[model][2];
       
        vMaxs[0] = gMAXS[model][0];
        vMaxs[1] = gMAXS[model][1];
        vMaxs[2] = gMAXS[model][2];
       
        vMins[0] += 1.0;
        vMins[1] += 1.0;
        vMins[2] += 1.0;
       
        vMaxs[0] += -1.0;
        vMaxs[1] += -1.0;
        vMaxs[2] += -1.0;
       
        static Float:vOrigins[8][3];
        vOrigins[0] = vOrigin;
        vOrigins[1] = vOrigin;
        vOrigins[2] = vOrigin;
        vOrigins[3] = vOrigin;
        vOrigins[4] = vOrigin;
        vOrigins[5] = vOrigin;
        vOrigins[6] = vOrigin;
        vOrigins[7] = vOrigin;
       
        vOrigins[0][0] += vMaxs[0];
        vOrigins[0][1] += vMins[1];
        vOrigins[0][2] += vMaxs[2];
       
        vOrigins[1][0] += vMaxs[0];
        vOrigins[1][1] += vMins[1];
        vOrigins[1][2] += vMins[2];
       
        vOrigins[2][0] += vMins[0];
        vOrigins[2][1] += vMaxs[1];
        vOrigins[2][2] += vMaxs[2];
       
        vOrigins[3][0] += vMins[0];
        vOrigins[3][1] += vMaxs[1];
        vOrigins[3][2] += vMins[2];
       
        vOrigins[4][0] += vMins[0];
        vOrigins[4][1] += vMins[1];
        vOrigins[4][2] += vMins[2];
       
        vOrigins[5][0] += vMins[0];
        vOrigins[5][1] += vMins[1];
        vOrigins[5][2] += vMaxs[2];
       
        vOrigins[6][0] += vMaxs[0];
        vOrigins[6][1] += vMaxs[1];
        vOrigins[6][2] += vMaxs[2];
       
        vOrigins[7][0] += vMaxs[0];
        vOrigins[7][1] += vMaxs[1];
        vOrigins[7][2] += vMins[2];
       
        /*new origins[8][3];
       
        for( new i = 0; i < 8; i++ )
        {
                FVecIVec(vOrigins[i], origins[i]);
        }
       
        fnMakeSprite(0, origins[0], origins[1], {255, 255, 255}, 50, 1);
        fnMakeSprite(0, origins[2], origins[3], {255, 255, 255}, 50, 1);
        fnMakeSprite(0, origins[4], origins[5], {255, 255, 255}, 50, 1);
        fnMakeSprite(0, origins[6], origins[7], {255, 255, 255}, 50, 1);*/
       
        new j;
        for( new i = 0; i <= 7; i++ )
        {
                if( engfunc(EngFunc_PointContents, vOrigins[i]) != -2 )
                {
                        j++;
                }
        }
       
        return j ? true : false;
}

fnSetRendering(ent, fx, r, g, b, rend, amt)
{
        new Float:vColor[3];
        vColor[0] = float(r);
        vColor[1] = float(g);
        vColor[2] = float(b);
       
        set_pev(ent, pev_renderfx, fx);
        set_pev(ent, pev_rendercolor, vColor);
        set_pev(ent, pev_rendermode, rend);
        set_pev(ent, pev_renderamt, float(amt));
       
        return 1;
}

bool:fnIsStringAlphaNumeric(const szString[])
{
        for( new i = 0; i < strlen(szString); i++ )
        {
                if( (szString[i] >= 'a' && szString[i] <= 'z')
                || (szString[i] >= 'A' && szString[i] <= 'Z')
                || (szString[i] >= '0' && szString[i] <= '9') )
                {
                        continue;
                }
                else
                {
                        return false;
                }
        }
       
        return true;
}

COMPILE ERROR >>>>> http://rapidshare.com/files/212668613/Doc1.doc.html

PLZZZ HEEELP !


All times are GMT -4. The time now is 08:57.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.