AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need Help Coding BCM (https://forums.alliedmods.net/showthread.php?t=57399)

mL_ 07-04-2007 00:44

Need Help Coding BCM
 
ehh, im having trouble adding more boxes into bcm, i pretty much coded everything to be just like the original bcm from fatalis but thr is no stop box and the colors of the models and everything is changed. if you can help me, please, i need help adding more boxes such as heal boxes and gravity boxes, etc.

stupok 07-04-2007 01:05

Re: Need Help Coding BCM
 
fatalis' plugins:
http://www.amxmodx.org/compiler.php?...alis&go=search

BCM:
http://forums.alliedmods.net/showthread.php?p=129120

I don't know what you're talking about and I'm not sure anyone else does either.

mL_ 07-04-2007 01:23

Re: Need Help Coding BCM
 
Bunnyhop Course Maker.

Fatalis deleted his so pretty much i copied everything from fatalis's sma but i changed everything but i dont know how to add new boxes. i deleted one of the boxes in the menu already that i didnt use but i would like to add a box that gives you gravity and a box that heals so many health points per second. I gave FatalisDK TOTAL credit for his work on my new version of the sma. This is what i have so far.
Code:

ORIGINALLY MADE BY FatalisDK. Remade and recoded by mL_ <3
/*
    Coded by mL_<3 (http://www.myspace.com/partymanjapan)
   
    CVARS:
    amx_noslowdown (0|1) - Stop slowdown once you touch a bhop box? (For people new to bhopping)
   
    Chat Commands:
    /bcm - Open the main menu of the plugin - Admins with flag 'u' only.
   
    Console Commands:
    amx_bcm - Open the main menu of the plugin - Admins with flag 'u' only.
*/

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

#pragma semicolon 1;

/* Strings */
new const gPLUGIN[] =  "BCM";
new const gVERSION[] =  "0.1-beta";
new const gAUTHOR[] =  "mL_ <3";
new const gMODEL[] = "models/bhopbox.mdl";
new gFile[97];

/* Integers */
new gBhopMenu;
new gNoSlowdown;
new gInfoTarget;
new gTimes[33];

public plugin_init()
{
    register_plugin(gPLUGIN, gVERSION, gAUTHOR);
   
    /* CVARS */
    register_cvar("BCM", gVERSION, FCVAR_SERVER, 0.0);
    gNoSlowdown = register_cvar("amx_noslowdown", "0", 0, 0.0);
   
    /* CLCMDS */
    register_clcmd("say /bcm", "cmdBhopMenu", ADMIN_MENU, "");
    register_clcmd("amx_bcm", "cmdBhopMenu", ADMIN_MENU, "");
   
    /* Forwards */
    register_forward(FM_Touch, "fwdTouch", 0);
   
    /* Events */
    register_event("DeathMsg","evntDeathMsg","a", "");
   
    gBhopMenu = menu_create("BCM by mL_ <3", "mnuBhop");
    menu_additem(gBhopMenu, "Make Start", "1", 0, -1);
    menu_additem(gBhopMenu, "Make Box", "2", 0, -1);
    menu_additem(gBhopMenu, "Move Up", "3", 0, -1);
    menu_additem(gBhopMenu, "Move Down", "4", 0, -1);
    menu_additem(gBhopMenu, "Destroy Object", "5", 0, -1);
    menu_additem(gBhopMenu, "Write to file", "6", 0, -1);
   
    gInfoTarget = engfunc(EngFunc_AllocString, "info_target");
   
    new szDir[65];
    get_configsdir(szDir, 64);
    add(szDir, 64, "/bcm", 0);
    if( !dir_exists(szDir) )
        mkdir(szDir);
       
    new szMap[33];
    get_mapname(szMap, 32);
    formatex(gFile, 96, "%s/%s.cfg", szDir, szMap);
}

public plugin_precache()
{
    precache_model(gMODEL);
}

public plugin_cfg()
{
    readFile();
}

readFile()
{
    if( !file_exists(gFile) )
    {
        return;
    }
   
    new szData[41]; /*S -9999.999999 -9999.999999 -9999.999999*/
    new szType[2], szX[13], szY[13], szZ[13];
    new Float:vOrigin[3];
    new f = fopen(gFile, "rt");
    while( !feof(f) )
    {
        fgets(f, szData, 40);
        parse(szData, szType, 1, szX, 12, szY, 12, szZ, 12);
       
        vOrigin[0] = str_to_float(szX);
        vOrigin[1] = str_to_float(szY);
        vOrigin[2] = str_to_float(szZ);
       
        if( szType[0] == 'S' )
        {
            makeBox(0, "bcm_start", 1, vOrigin);
        }
        else if( szType[0] == 'B' )
        {
            makeBox(0, "bcm_box", 2, vOrigin);
        }
        else if( szType[0] == 'E' )
        {
            makeBox(0, "bcm_end", 3, vOrigin);
        }
        else
        {
            log_amx("[ml_ <3's bcm] Invalid box type: %c in: %s", szType[0], gFile);
        }
    }
    fclose(f);
}

public fwdTouch(ptr, ptd)
{
    if( !ptd || ptd > 32 )
    {
        return FMRES_IGNORED;
    }
   
    static szClassname[33];
    pev(ptr, pev_classname, szClassname, 32);
   
    if( equal(szClassname, "worldspawn", 0) || equal(szClassname, "func_wall", 0) )
    {
        if( task_exists(ptd+100110, 0) )
        {
            remove_task(ptd+100110, 0);
            gTimes[ptd] = 0;
        }
    }
    else if( equal(szClassname, "bcm_box", 0) )
    {
        if( get_pcvar_num(gNoSlowdown) )
        {
            set_pev(ptd, pev_fuser2, 0.0);
        }
        if( !task_exists(ptr+5656) && !task_exists(ptr+6767) )
        {
            set_task(0.1, "tskUnsolid", ptr+5656, "", 0, "", 0);
        }
    }
    else if( equal(szClassname, "bcm_start", 0) )
    {
        if( task_exists(ptd+100110, 0) )
        {
            remove_task(ptd+100110, 0);
        }
        gTimes[ptd] = 0;
        set_task(1.0, "tskTimer", ptd+100110, "", 0, "b", 0);
    }
    else if( equal(szClassname, "bcm_end", 0) )
    {
        if( get_pcvar_num(gNoSlowdown) )
        {
            set_pev(ptd, pev_fuser2, 0.0);
        }
        if( task_exists(ptd+100110, 0) )
        {
            new szName[33];
            get_user_name(ptd, szName, 32);
            client_print(0, print_chat, "[ml_ <3's bcm] %s finished course %i in %i seconds!", szName, ptr, gTimes[ptd]);
           
            remove_task(ptd+100110, 0);
            gTimes[ptd] = 0;
        }
    }
   
    return FMRES_IGNORED;
}

public tskTimer(taskid)
{
    taskid-=100110;
    gTimes[taskid]+=1;
   
    set_hudmessage(255, 255, 255, 0.1, 0.75, 0, 0.0, 1.0, 0.0, 0.0, 2);
    show_hudmessage(taskid, "%i", gTimes[taskid]);
}

public tskUnsolid(taskid)
{
    taskid-=5656;
    set_pev(taskid, pev_solid, SOLID_NOT);
    fm_set_rendering(taskid, kRenderFxNone, 0, 0, 0, kRenderTransAdd, 100);
    set_task(1.0, "tskSolid", taskid+6767);
}

public tskSolid(taskid)
{
    taskid-=6767;
    set_pev(taskid, pev_solid, SOLID_BBOX);
    fm_set_rendering(taskid, kRenderFxNone, 0, 0, 0, kRenderNormal, 16);
}

public cmdBhopMenu(id, level, cid)
{
    if( !cmd_access(id, level, cid, 1) )
    {
        return PLUGIN_HANDLED;
    }
   
    menu_display(id, gBhopMenu, 0);
   
    return PLUGIN_HANDLED;
}

public mnuBhop(id, menu, item)
{
    new szCmd[2],  _access, callback;
    menu_item_getinfo(menu, item, _access, szCmd, 1, "", 0, callback);
   
    if( item == MENU_EXIT )
    {
        return PLUGIN_HANDLED;
    }
   
    switch( szCmd[0] )
    {
        case '-':
        {
            return PLUGIN_HANDLED;
        }
        case '1':
        {
            makeBox(id, "bcm_start", 1, Float:{0.0, 0.0, 0.0});
        }
        case '2':
        {
            makeBox(id, "bcm_box", 2, Float:{0.0, 0.0, 0.0});
        }
        case '3':
        {
            moveBox(id, 1); /* Up */
        }
        case '4':
        {   
            moveBox(id, 2); /* Down */
        }
        case '5':
        {
            new ent, body;
            get_user_aiming(id, ent, body, 9999);
           
            if( !pev_valid(ent) )
            {
                client_print(id, print_chat, "[ml_ <3's bcm] Aim at object to destroy it.");
            }
            else
            {
                new szClassname[33];
                pev(ent, pev_classname, szClassname, 32);
               
                if( !equal(szClassname, "bcm_box", 0)
                && !equal(szClassname, "bcm_start", 0)
                && !equal(szClassname, "bcm_end", 0)
                && !equali(szClassname, "func_button", 0)
                && !equali(szClassname, "func_door", 0) )
                {
                    client_print(0, print_chat, "[ml_ <3's bcm] Aim at object to destroy it.");
                }
                else
                {
                    set_pev(ent, pev_flags, pev(ent, pev_flags) | FL_KILLME);
                    client_print(id, print_chat, "[ml_ <3's bcm] Object sucessfully destroyed!");
                }
            }
        }
        case '6':
        {
            if( file_exists(gFile) )
            {
                delete_file(gFile);
            }
           
            new ent, Float:vOrigin[3], szData[42]; /*S -9999.999999 -9999.999999 -9999.999999^n*/
            new f = fopen(gFile, "at");
            while( (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "bcm_start")) )
            {
                pev(ent, pev_origin, vOrigin);
                formatex(szData, 41, "S %f %f %f^n", vOrigin[0], vOrigin[1], vOrigin[2]);
                fputs(f, szData);
            }
            ent = 0;
            while( (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "bcm_box")) )
            {
                pev(ent, pev_origin, vOrigin);
                formatex(szData, 41, "B %f %f %f^n", vOrigin[0], vOrigin[1], vOrigin[2]);
                fputs(f, szData);
            }
            ent = 0;
            while( (ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "bcm_end")) )
            {
                pev(ent, pev_origin, vOrigin);
                formatex(szData, 41, "E %f %f %f^n", vOrigin[0], vOrigin[1], vOrigin[2]);
                fputs(f, szData);
            }
            fclose(f);
           
            client_print(id, print_chat, "[ml_ <3's bcm] Sucessfully saved to server!");
        }
    }
   
    menu_display(id, gBhopMenu, 0);
   
    return PLUGIN_HANDLED;
}

makeBox(id, const szClassname[], color, Float:pOrigin[3])
{
    new ent= engfunc(EngFunc_CreateNamedEntity, gInfoTarget);
   
    if( !pev_valid(ent) )
    {
        return PLUGIN_HANDLED;
    }
       
    set_pev(ent, pev_classname, szClassname);
    set_pev(ent, pev_solid, SOLID_BBOX);
    set_pev(ent, pev_movetype, MOVETYPE_NONE);
    engfunc(EngFunc_SetModel, ent, gMODEL);
    engfunc(EngFunc_SetSize, ent, Float:{-32.0, -32.0, -4.0}, Float:{32.0, 32.0, 4.0});
   
    if( pOrigin[0] == 0.0
    && pOrigin[1] == 0.0
    && pOrigin[2] == 0.0 )
    {
        new origin[3], Float:vOrigin[3];
        get_user_origin(id, origin, 3);
        IVecFVec(origin, vOrigin);
        vOrigin[2] += 16.0;
        engfunc(EngFunc_SetOrigin, ent, vOrigin);
       
    }
    else
    {   
        engfunc(EngFunc_SetOrigin, ent, pOrigin);
    }
   
    if( color == 1 )
    {
        fm_set_rendering(ent, kRenderFxGlowShell, 2, 14, 255, kRenderNormal, 16);
    }
    else if( color == 3 )
    {
        fm_set_rendering(ent, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 16);
    }
   
    if( isNearSpawn(ent) )
    {
        client_print(id, print_chat, "[ml_ <3's bcm] You are not able to place near spawns.");
        set_pev(ent, pev_flags, pev(ent, pev_flags) | FL_KILLME);
    }
       
    return PLUGIN_HANDLED;
}

moveBox(id, mode)
{
    new ent, body, szClassname[33];
    get_user_aiming(id, ent, body, 9999);
   
    if( !pev_valid(ent) )
    {
        return PLUGIN_HANDLED;
    }
       
    pev(ent, pev_classname, szClassname, 32);
   
    if( !equal(szClassname, "bcm_box", 0)
    && !equal(szClassname, "bcm_start", 0)
    && !equal(szClassname, "bcm_end", 0) )
    {
        client_print(id, print_chat, "[ml_ <3's bcm] You must aim at an object.");
    }
    else
    {
        new Float:vOrigin[3];
        pev(ent, pev_origin, vOrigin);
   
        if( mode == 1 )
        {
            vOrigin[2]+=1.0;
        }
        else if( mode == 2 )
        {
            vOrigin[2]-=1.0;
        }
       
        engfunc(EngFunc_SetOrigin, ent, vOrigin);
    }
   
    return PLUGIN_HANDLED;
}

bool:isNearSpawn(id)
{
    new Float:vOrigin[3], ent, szClassname[33];
    pev(id, pev_origin, vOrigin);
   
    while( (ent = engfunc(EngFunc_FindEntityInSphere, ent, vOrigin, 128.0)) )
    {
        pev(ent, pev_classname, szClassname, 32);
        if( equal(szClassname, "info_player_start", 0)
        || equal(szClassname,"info_player_deathmatch", 0) )
        {
            return true;
        }
    }
   
    return false;
}

fm_set_rendering(ent, fx=kRenderFxNone, r=255, g=255, b=255, rend=kRenderNormal, amt=16)
{
    set_pev(ent, pev_renderfx, fx);
   
    new Float:rendColor[3];
    rendColor[0] = float(r);
    rendColor[1] = float(g);
    rendColor[2] = float(b);
    set_pev(ent, pev_rendercolor, rendColor);
   
    set_pev(ent, pev_rendermode, rend);
    set_pev(ent, pev_renderamt, float(amt));
}

public evntDeathMsg()
{
    new id = read_data(2);
   
    if( task_exists(id+100110, 0) )
    {
        remove_task(id+100110, 0);
        gTimes[id] = 0;
    }
}


star3stone 07-10-2007 21:09

Re: Need Help Coding BCM
 
upload the .sma

jageassyrian 07-12-2007 14:00

Re: Need Help Coding BCM
 
has anyone had any luck with this?

star3stone 07-16-2007 18:02

Re: Need Help Coding BCM
 
i tryed to copy the codes and put em in a .sma file and then i compiled em... didnt work.. i got 3 errors

invalid function or declaration
undefined symbol ¨IVecFVec¨
expected token ¨}¨ but found -end of file-

Micketorneus 07-16-2007 19:20

Re: Need Help Coding BCM
 
how do i move around boxes ?? like grabbing them?

KiimpaN 07-17-2007 09:51

Re: Need Help Coding BCM
 
It's Fatalis private plugins. ITS NOT ALLOWED TO RECREATE THEM! Understand, jageassyrian. You have been trying to copy all things kzm/my server has for a long time, stop it. Buy the plugins from Fatalis as it's supposed to do. I bought it, it's pretty lame if someone makes this so i lost money.

bwgrubbs1 07-17-2007 11:23

Re: Need Help Coding BCM
 
Don't worry guys....myself and necro are releasing a combination of each of our versions of bcm to the public...either on here, or on my, or necros site. SO just wait until that comes out. You might know me, I own the leet feet servers. :)

Micketorneus 07-17-2007 13:32

Re: Need Help Coding BCM
 
O.o


All times are GMT -4. The time now is 21:29.

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