Raised This Month: $ Target: $400
 0% 

[SOLVED]Fix CM


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-14-2009 , 06:14   Re: Fix CM
Reply With Quote #1

It should be that, so it will not ignored when you press severals key including IN_SCORE.

Code:
if(button & IN_SCORE)
{
    client_cmd(id,"-showscores")
}
Arkshine is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-14-2009 , 06:17   Re: Fix CM
Reply With Quote #2

oh, i think i tried this. idk. i cant remember what i tried. i tried around 1000000 ways. iŽll try this. i hope this willbe work then so i cant release this
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-14-2009 , 08:07   Re: Fix CM
Reply With Quote #3

Use switch in this... also i dont see any IN_SCORE in your code so i cant help u.
PHP Code:
public setview(idkeymenu)
{
    if(
key == 0
    {
        
set_view(idCAMERA_3RDPERSON);
        return 
PLUGIN_HANDLED;
    }
    if(
key == 1
    {
        
set_view(idCAMERA_TOPDOWN);
        return 
PLUGIN_HANDLED;
    }

    if(
key == 2
    {
        
set_view(idCAMERA_NONE);
        return 
PLUGIN_HANDLED;
    }

    else 
    {
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;

PHP Code:
public setviewidiKeyiMenu ) {
    switch( 
iKey ) {
        case 
0set_view(idCAMERA_3RDPERSON);
        case 
1set_view(idCAMERA_TOPDOWN);
        case 
2set_view(idCAMERA_NONE);
    }
    
    return 
PLUGIN_HANDLED;

__________________
xPaw is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-14-2009 , 08:36   Re: Fix CM
Reply With Quote #4

Quote:
Originally Posted by xPaw View Post
Use switch in this... also i dont see any IN_SCORE in your code so i cant help u.
PHP Code:
public setview(idkeymenu)
{
    if(
key == 0
    {
        
set_view(idCAMERA_3RDPERSON);
        return 
PLUGIN_HANDLED;
    }
    if(
key == 1
    {
        
set_view(idCAMERA_TOPDOWN);
        return 
PLUGIN_HANDLED;
    }

    if(
key == 2
    {
        
set_view(idCAMERA_NONE);
        return 
PLUGIN_HANDLED;
    }

    else 
    {
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;

PHP Code:
public setviewidiKeyiMenu ) {
    switch( 
iKey ) {
        case 
0set_view(idCAMERA_3RDPERSON);
        case 
1set_view(idCAMERA_TOPDOWN);
        case 
2set_view(idCAMERA_NONE);
    }
    
    return 
PLUGIN_HANDLED;

ty xpaw, but what i here attached, is the mod that i writed. i thinked the mod is done but after test, i saw that i have the score bug &...

here i attach the sma, what i tried. i have of this plugin, 10000 versions )

Attached Files
File Type: sma Get Plugin or Get Source (to test mit status msg.sma - 325 views - 19.6 KB)
File Type: sma Get Plugin or Get Source (goood last mit gamename mit beer.sma - 261 views - 20.4 KB)
File Type: sma Get Plugin or Get Source (fixed strip mit nobuy.sma - 281 views - 18.8 KB)
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-14-2009 , 10:50   Re: Fix CM
Reply With Quote #5

for start make this
Quote:
Should be & not == in button things..

you have

button == IN_FORWARD
should be
button & IN_FORWARD

hope you understand what i mean..
when you make this, please provide latest version.
__________________
xPaw is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 04-14-2009 , 17:12   Re: Fix CM
Reply With Quote #6

One ffs, the code is a friggin mess dude...


Code:
 
#include <fakemeta_const>
Code:
new g_Bar[ ][ ] =
{
 "lol"
};
Code:
public plugin_init() 
{
 unregister_forward(FM_KeyValue, g_iFhKeyValue);
Code:
public Event_PlayerTakeDamage ( Victim, Inflictor, Attacker, Float:Damage, Damagebits )
{
        return IsPlayer( Attacker ) && get_user_weapon( Attacker ) == CSW_KNIFE
                                    && Damagebits & ( DMG_NEVERGIB | DMG_BULLET )  ? HAM_SUPERCEDE : HAM_IGNORED;
}

etc etc etc. at least clean it up just bit.... cmon!
__________________
Dr.G is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-14-2009 , 18:12   Re: Fix CM
Reply With Quote #7

i gived up to write... ill try that what xpaw said, if this work, sure!! ill clean it up but if not, ill forget this mod.3 weeks on one mini mod working are toooooooooooooooo long!
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-15-2009 , 07:42   Re: Fix CM
Reply With Quote #8

Ok, its done, but a new bug.

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_const>
#include <hamsandwich>
#include <engine>
#include <colorchat>
#include <fun>


#define TASK_MENU_DISLPAY_TIME 3.0
#define m_pPlayer    41
#pragma semicolon 1
#define DISTANCE 120


new EnableHudHelp;
new const 
CUSTOM_KNIFE_MODEL[] =  "models/CM/v_beer.mdl";
new 
bool:moving[512] = true;
new 
Level 1;
new 
msgDrug;
new 
maxplayers;
new 
speed_pcvar;
new 
toggle_pcvar;
new 
gMaxClients;
new 
g_iTeam[33];
new 
bool:g_bSolid[33];
new 
bool:g_bHasSemiclip[33];
new 
Float:g_fOrigin[33][3];
new 
bool:g_bSemiclipEnabled;
new 
g_iForwardId[3];
new 
g_iMaxPlayers;
new 
g_iCvar[3];
new 
g_iFhKeyValue;
    
#define IsPlayer(%1)  ( 1 <= %1 <= gMaxClients )
new g_Bar[ ][ ] =                 //Background Music
{
    
"lol"
};
new const 
gMovementlevel1[8][1024] =     // Dont change 1024!!
{
    
"+back;wait;+moveright;wait;wait;wait;wait;wait;wait;-moveright;wait;-back",
    
"+moveleft;wait;wait;wait;wait;wait;wait;wait;-moveleft",
    
"+moveright;wait;wait;wait;wait;wait;wait;wait;-moveright",
    
"+forward;wait;wait;wait;wait;-forward",
    
"-forward",
    
"-back",
    
"-moveleft",
    
"-moveright"
};
new const 
gMovementlevel2[8][1024] =     // Dont change 1024!!
{
    
"+back;wait;+moveleft;wait;wait;wait;wait;wait;wait;-moveleft;wait;wait;wait;-back",
    
"+moveleft;wait;+back;wait;wait;wait;wait;wait;wait;-back;wait;wait;wait;-moveleft",
    
"+moveright;wait;wait;wait;wait;-moveright",
    
"+forward;wait;wait;wait;wait;wait;wait;wait;-forward",
    
"-forward",
    
"-back",
    
"-moveleft",
    
"-moveright"
};
new const 
gMovementlevel3[8][1024] =     // Dont change 1024!!
{
    
"+back;wait;wait;wait;wait;wait;wait;wait;wait;wait;wait;-back",
    
"+moveleft;wait;wait;wait;wait;wait;wait;wait;wait;wait;wait;-moveleft",
    
"+moveright;wait;wait;wait;wait;wait;wait;wait;wait;wait;wait;-moveright",
    
"+forward;wait;wait;+moveright;;wait;wait;wait;wait;wait;wait;-moveright;wait;wait;-forward",
    
"-forward",
    
"-back",
    
"-moveleft",
    
"-moveright"
};
/*new const gMousecmds1[6][1024] =        //Active to add mouse manipolization to level 1 or 2
{
    "+lookdown;wait;+right;wait;-right;-lookdown",
    "+lookup;wait;+left;wait;-lookup;wait;+lookdown;wait;wait;-left;wait;-lookdown",
    "-lookup",
    "-lookdown",
    "-left",
    "-right"
}*/
/*new const gMousecmds2[6][1024] =
{
    "+lookdown;wait;+right;wait;-right;-lookdown",
    "+lookup;wait;+left;wait;-lookup;wait;+lookdown;wait;wait;-left;wait;-lookdown",
    "-lookup",
    "-lookdown",
    "-left",
    "-right"
}*/
new const gMousecmds3[6][1024] =
{
    
"+left;wait;wait;-right",
    
"+right;wait;wait;-right",
    
"-lookup",
    
"-lookdown",
    
"-left",
    
"-right"
};
new 
CM_time;
public 
plugin_init() 
{
    
register_plugin("Crazy Mazy""1.6""One");
    
register_forwardFM_PlayerPreThink"client_prethink" );
    
register_clcmd"CM_Menu","Level_menu");
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
    
msgDrug=get_user_msgid("SetFOV");
    new 
map32 ];
    
get_mapnamemap31 );
    if( 
strcmpmap"CM_Acer" ) )
    
set_task45.0"sounds"___"b" );
    
register_menucmd(register_menuid("Choose Camera View"), 1023"setview");
    
register_clcmd("say /camera""chooseview");
    
register_clcmd("say_team /camera""chooseview");
    
register_clcmd("say /cam""chooseview");
    
register_clcmd("say_team /cam""chooseview");   
    
CM_time register_cvar("CMs_time","60");
    
set_task(float(get_pcvar_num(CM_time)), "CMDS");
    
register_clcmd("say /menu""Level_menu");
    
register_clcmd("say_team /menu""Level_menu");
    
register_clcmd("say /level""show_level");
    
register_clcmd("say_team /level""show_level");
    
register_clcmd("say /lvl""show_level");
    
register_clcmd("say_team /lvl""show_level");
    
register_clcmd("say /help""mod_help");
    
register_clcmd("say_team /help""mod_help");
    
speed_pcvar register_cvar("FW_speed","25.0");
    
toggle_pcvar register_cvar("FW_enabled","1");
    
register_forward(FM_SetModel,"W_Model_Hook",1);
    
register_touch("weaponbox","worldspawn","touch");
    
set_task(1.0,"newgame");
    
set_task(0.1,"force_spin",0,"",0,"b");
    
maxplayers get_maxplayers();
    
RegisterHamHam_TakeDamage"player""Event_PlayerTakeDamage" );
    
gMaxClients get_maxplayers();
    
/*unregister_forward(FM_KeyValue, g_iFhKeyValue)        //Crash ???
    set_cvar_float("sv_restart", 1.0)
    */
    
RegisterHam(Ham_Item_Deploy"weapon_knife""Knife_Deploy"1);
    
g_iCvar[0] = register_cvar"semiclip_enabled""1" );
    
g_iCvar[1] = register_cvar"semiclip_teamclip""0" );
    
g_iCvar[2] = register_cvar"semiclip_transparancy""1" );
    
register_forwardFM_ClientCommand"fwdClientCommand" );
    if( 
get_pcvar_numg_iCvar[0] ) )
    {
        
g_iForwardId[0] = register_forwardFM_PlayerPreThink"fwdPlayerPreThink" );
        
g_iForwardId[1] = register_forwardFM_PlayerPostThink"fwdPlayerPostThink" );
        
g_iForwardId[2] = register_forwardFM_AddToFullPack"fwdAddToFullPack_Post");
        
g_bSemiclipEnabled true;
    }
    else
        
g_bSemiclipEnabled false;
    
g_iMaxPlayers get_maxplayers( );
    
EnableHudHelp register_cvar("enablehud_help""1");
    
set_task(1.0"modInfo"0""0"b");
}
public 
modInfo()
{
    if(
get_pcvar_num(EnableHudHelp) == 1)
    {
        
set_hudmessage(255,255,255,0.75,0.05,01.01.00.10.213);
        
show_hudmessage(1"This server runs: Crazy Mazy Mod by One^nType /help to know how to play");
    }
    return 
PLUGIN_CONTINUE;
}
public 
plugin_modules()
{
    
require_module("engine");
}
public 
Level_menu(id)
{
    new 
menu menu_create("\rCrazy-Mazy Main menu:""menu_handler");
    
menu_additem(menu"\wNormal""1"0);
    
menu_additem(menu"\wMedium""2"0);
    
menu_additem(menu"\whigh^n""3"0);
    
menu_additem(menu"\whelp^n""4"0);
    
menu_display(idmenu0);
}
public 
show_level()
{
    switch(
Level)
    {
        case 
1:
        {
            
ColorChat(0GREY"        Your Level = 1!");
        }
        case 
2:
        {
            
ColorChat(0GREY"        Your Level = 2!");
        }
        case 
3:
        {
            
ColorChat(0GREY"        Your Level = 3!");
        }
    }
}
public 
plugin_precache()
{
    
/*new iEnt

    iEnt = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString , "player_weaponstrip" ) )
    SetKeyValue(iEnt, "origin", "9999 9999 9999", "player_weaponstrip")
    SetKeyValue(iEnt, "targetname", "stripper", "player_weaponstrip")
    dllfunc(DLLFunc_Spawn, iEnt)

    iEnt = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString , "game_player_equip" ) )
    SetKeyValue(iEnt, "weapon_knife", "1", "game_player_equip")
    SetKeyValue(iEnt, "ammo_buckshot", "4", "game_player_equip")
    SetKeyValue(iEnt, "targetname", "equipment", "game_player_equip")
    dllfunc(DLLFunc_Spawn, iEnt)

    iEnt = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString , "multi_manager" ) )
    SetKeyValue(iEnt, "stripper", "0", "multi_manager")
    SetKeyValue(iEnt, "equipment", "1", "multi_manager")
    SetKeyValue(iEnt, "targetname", "game_playerspawn", "multi_manager")
    SetKeyValue(iEnt, "spawnflags", "1", "multi_manager")
    dllfunc(DLLFunc_Spawn, iEnt)

    iEnt = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString , "info_map_parameters" ) )
    SetKeyValue(iEnt, "buying", "3", "info_map_parameters")
    dllfunc(DLLFunc_Spawn, iEnt)

    g_iFhKeyValue = register_forward(FM_KeyValue, "KeyValue")*/

    
for( new isizeof g_Bari++ )
    
precache_soundg_Bar] );
    
precache_model("models/rpgrocket.mdl");
    
precache_model(CUSTOM_KNIFE_MODEL);
}
public 
fwdPlayerPreThinkplr )
{
    static 
idlast_think;

    if( 
last_think plr )
    {
        for( 
id id <= g_iMaxPlayers id++ )
        {
            if( 
is_user_aliveid ) )
            {
                if( 
get_pcvar_numg_iCvar[1] ) )
                    
g_iTeam[id] = get_user_teamid );
                
                
g_bSolid[id] = pevidpev_solid ) == SOLID_SLIDEBOX true false;
                
pevidpev_origing_fOrigin[id] );
            }
            else
                
g_bSolid[id] = false;
        }
    }

    
last_think plr;

    if( 
g_bSolid[plr] )
    {
        for( 
id id <= g_iMaxPlayers id++ )
        {
            if( 
g_bSolid[id] && get_distance_fg_fOrigin[plr], g_fOrigin[id] ) <= DISTANCE && id != plr )
            {
                if( 
get_pcvar_numg_iCvar[1] ) && g_iTeam[plr] != g_iTeam[id] )
                    return 
FMRES_IGNORED;
    
                
set_pevidpev_solidSOLID_NOT );
                
g_bHasSemiclip[id] = true;
            }
        }
    }

    return 
FMRES_IGNORED;
}
public 
fwdPlayerPostThinkplr )
{
    static 
id;

    for( 
id id <= g_iMaxPlayers id++ )
    {
        if( 
g_bHasSemiclip[id] )
        {
            
set_pevidpev_solidSOLID_SLIDEBOX );
            
g_bHasSemiclip[id] = false;
        }
    }
}
public 
fwdAddToFullPack_Postes_handleeenthosthostflagsplayerpset )
{
    if( 
player )
    {
        if( 
g_bSolid[host] && g_bSolid[ent] && get_distance_fg_fOrigin[host], g_fOrigin[ent] ) <= DISTANCE )
        {
            if( 
get_pcvar_numg_iCvar[1] ) && g_iTeam[host] != g_iTeam[ent] )
                return 
FMRES_IGNORED;
                
            
set_eses_handleES_SolidSOLID_NOT ); // makes semiclip flawless
            
            
if( get_pcvar_numg_iCvar[2] ) == )
            {
                
set_eses_handleES_RenderModekRenderTransAlpha );
                
set_eses_handleES_RenderAmt85 );
            }
            else if( 
get_pcvar_numg_iCvar[2] ) == )
            {
                
set_eses_handleES_EffectsEF_NODRAW );
                
set_eses_handleES_SolidSOLID_NOT );
            }
        }
    }
    
    return 
FMRES_IGNORED;
}
public 
fwdClientCommandplr )
{
    if( !
get_pcvar_numg_iCvar[0] ) && g_bSemiclipEnabled )
    {
        
unregister_forwardFM_PlayerPreThinkg_iForwardId[0] );
        
unregister_forwardFM_PlayerPostThinkg_iForwardId[1] );
        
unregister_forwardFM_AddToFullPackg_iForwardId[2], );
        
        
g_bSemiclipEnabled false;
    }
    else if( 
get_pcvar_numg_iCvar[0] ) && !g_bSemiclipEnabled )
    {
        
g_iForwardId[0] = register_forwardFM_PlayerPreThink"fwdPlayerPreThink" );
        
g_iForwardId[1] = register_forwardFM_PlayerPostThink"fwdPlayerPostThink" );
        
g_iForwardId[2] = register_forwardFM_AddToFullPack"fwdAddToFullPack_Post");
        
        
g_bSemiclipEnabled true;
    }
}
public 
CMDS()
{
    switch(
random_num(1,4))
    {
        case 
1//Red
        
{
            
ColorChat(0RED"Say /menu to enter to Main menu!");
            
set_task(float(get_pcvar_num(CM_time)), "CMDS");
        }
        case 
2//Green
        
{
            
ColorChat(0GREEN"Say /level to see youŽr Level!");
            
set_task(float(get_pcvar_num(CM_time)), "CMDS");
        }
        case 
3//Blue
        
{
            
ColorChat(0BLUE"Say /cam to change youŽr view!");
            
set_task(float(get_pcvar_num(CM_time)), "CMDS");
        }
        case 
4//Grey
        
{
            
ColorChat(0GREY"Say /help to see the validable Commands to you!");
            
set_task(float(get_pcvar_num(CM_time)), "CMDS");
        }
    }
}  
/*SetKeyValue(iEnt, const szKey[], const szValue[], const szClassName[])
{
    set_kvd(0, KV_ClassName, szClassName)
    set_kvd(0, KV_KeyName, szKey)
    set_kvd(0, KV_Value, szValue)
    set_kvd(0, KV_fHandled, 0)
    dllfunc(DLLFunc_KeyValue, iEnt, 0)
}
public KeyValue(iEnt, kvd_handle)
{
    if( pev_valid(iEnt) )
    {
        static szClassName[20]
        get_kvd(kvd_handle, KV_ClassName, szClassName, charsmax(szClassName))
        if(    equal(szClassName, "game_player_equip")
        ||    equal(szClassName, "info_map_parameters")
        ||    equal(szClassName, "player_weaponstrip")    )
        {
            engfunc( EngFunc_RemoveEntity, iEnt )
            return FMRES_SUPERCEDE
        }
    }
    return FMRES_IGNORED
}*/
public Event_PlayerTakeDamage VictimInflictorAttackerFloat:DamageDamagebits )
{
        return 
IsPlayerAttacker ) && get_user_weaponAttacker ) == CSW_KNIFE
                                    
&& Damagebits & ( DMG_NEVERGIB DMG_BULLET )  ? HAM_SUPERCEDE HAM_IGNORED;
}
public 
W_Model_Hook(ent,model[])
{
    if(
get_pcvar_num(toggle_pcvar) && pev_valid(ent))
    {
        static 
classname[32];
        
pev(ent,pev_classname,classname,31);
        if(
equali(classname,"weaponbox"))
        {
            
set_pev(ent,pev_renderfx,kRenderFxGlowShell);
            switch(
random_num(1,4))
            {
                case 
1set_pev(ent,pev_rendercolor,Float:{0.0,0.0,255.0});
                case 
2set_pev(ent,pev_rendercolor,Float:{0.0,255.0,0.0});
                case 
3set_pev(ent,pev_rendercolor,Float:{255.0,0.0,0.0});
                case 
4set_pev(ent,pev_rendercolor,Float:{255.0,255.0,255.0});
            }
            static 
Float:angles[3];
            
pev(ent,pev_angles,angles);
            
angles[0] -= 90.0;
            
angles[1] += 45.0;
            
set_pev(ent,pev_angles,angles);
        }
    }
}
public 
Knife_DeployiKnife )
{
    new 
id get_pdata_cbase(iKnifem_pPlayer4);
    
set_pev(idpev_viewmodel2CUSTOM_KNIFE_MODEL);

public 
touch(weaponbox,worldspawn)
{
    if(
get_pcvar_num(toggle_pcvar) && pev_valid(weaponbox))
    {
        
set_pev(weaponbox,pev_movetype,MOVETYPE_FLY);
        static 
Float:origin[3];
        
pev(weaponbox,pev_origin,origin);
        
origin[2] += 30.0;
        
set_pev(weaponbox,pev_origin,origin);
    }
}
public 
force_spin()
{
    if(
get_pcvar_num(toggle_pcvar))
    {
        static 
entclassname[16], Float:angles[3];
        
ent engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0);
        while(
ent)
        {
            if(
pev_valid(ent))
            {
                
pev(ent,pev_classname,classname,15);
                if(
containi(classname,"armoury")!=-|| containi(classname,"weaponbox")!=-1)
                {
                    
pev(ent,pev_angles,angles);
                    
angles[1] += get_pcvar_float(speed_pcvar) / 10.0;
                    
                    if(
angles[1]>=180.0)
                    {
                        
angles[1] -= 360.0;
                    }
                    
                    
set_pev(ent,pev_angles,angles);
                }
            }
            
ent engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0);
        }
    }
}
public 
newgame()
{
    if(
get_pcvar_num(toggle_pcvar))
    {
        static 
entclassname[8], Float:angles[3];
        
ent engfunc(EngFunc_FindEntityInSphere,maxplayers,Float:{0.0,0.0,0.0},4800.0);
        while(
ent)
        {
            if(
pev_valid(ent))
            {
                
pev(ent,pev_classname,classname,7);
                if(
containi(classname,"armoury")!=-1)
                {
                    
set_pev(ent,pev_renderfx,kRenderFxGlowShell);
                    
                    switch(
random_num(1,4))
                    {
                        case 
1set_pev(ent,pev_rendercolor,Float:{0.0,0.0,255.0});
                        case 
2set_pev(ent,pev_rendercolor,Float:{0.0,255.0,0.0});
                        case 
3set_pev(ent,pev_rendercolor,Float:{255.0,0.0,0.0});
                        case 
4set_pev(ent,pev_rendercolor,Float:{255.0,255.0,255.0});
                    }
                    
                    
pev(ent,pev_angles,angles);
                    
angles[0] -= 90.0;
                    
angles[1] += 45.0;
                    
set_pev(ent,pev_angles,angles);
                    
touch(ent,0);
                }
            }
            
ent engfunc(EngFunc_FindEntityInSphere,ent,Float:{0.0,0.0,0.0},4800.0);
        }
    }
}
public 
sounds()
{
    new 
random_num0sizeof g_Bar-);
    
emit_sound,CHAN_ITEMg_Bar], 1.0ATTN_NORM0PITCH_NORM );
}
public 
fwHamPlayerSpawnPost(id)
{
    
set_task(TASK_MENU_DISLPAY_TIME"Level_menu"id);
    return 
HAM_IGNORED;
}
public 
menu_handler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    } 
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    new 
key str_to_num(data);
    switch(
key)
    {
        case 
1:
        {
            
Level=1;
            
ColorChat(0GREEN"        You choosed Level 1! Level 1 = 5 Glasses.");
        }
        case 
2:
        {
            
Level=2;
            
ColorChat(0BLUE"        You choosed Level 2! Level 2 = 8 Glasses.");
        }
        case 
3:
        {
            
Level=3;
            
ColorChat(0RED"        You choosed Level 3! Level 3 = 12 Glasses.");
        }
        case 
4:
        {
            
mod_help(id);
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED
}
public 
client_prethink(id)
{
    
Action(id);
}
public 
Action(id)
{
    switch(
Level)
    {
        case 
1:
        {
            if (
moving[id]) return;
            new 
button pev(id,pev_button);
            
            if (
button IN_FORWARD || button IN_BACK || button IN_MOVELEFT || button IN_MOVERIGHT)
            {
                
client_cmd(id,"%s"gMovementlevel1random_num1charsmaxgMovementlevel1 ) ) ]);
            }
            
/*if(button == IN_RIGHT)
            {
                client_cmd(id, "%s", gMousecmds1[ random_num( 1, charsmax( gMousecmds1 ) ) ]);
            }
            if ( button == IN_LEFT)
            {
                client_cmd(id, "%s", gMousecmds1[ random_num( 1, charsmax( gMousecmds1 ) ) ]);
            }*/
            
moving[id] = true;
            
set_task(0.4,"reset",id,"",0,"ab"1);  // Never change this. if change = Channel flood!
            //set_task(0.4,"reset",id,"",0,"ab", 1) 
            
set_vision(id90);
            
set_view(idCAMERA_NONE);
        }
        case 
2:
        {
            if (
moving[id]) return;
            new 
button pev(id,pev_button);
            
            if (
button IN_FORWARD || button IN_BACK || button IN_MOVELEFT || button IN_MOVERIGHT)
            {
                
client_cmd(id,"%s"gMovementlevel2random_num1charsmaxgMovementlevel2 ) ) ]);
            }
            
/*if(button == IN_RIGHT)
            {
                client_cmd(id, "%s", gMousecmds2[ random_num( 1, charsmax( gMousecmds2 ) ) ]);
            }
            if ( button == IN_LEFT)
            {
                client_cmd(id, "%s", gMousecmds2[ random_num( 1, charsmax( gMousecmds2 ) ) ]);
            }*/
            
moving[id] = true;
            
set_task(0.4,"reset",id,"",0,"ab"1);  // Never change this. if change = Channel flood!
            //set_task(0.4,"reset",id,"",0,"ab", 1) 
            
set_vision(id90);
            
set_view(idCAMERA_3RDPERSON);
        }
        case 
3:
        {
            if (
moving[id]) return;
            new 
button pev(id,pev_button);
            if (
button IN_FORWARD || button IN_BACK || button IN_MOVELEFT || button IN_MOVERIGHT)
            {
                
client_cmd(id,"%s"gMovementlevel3random_num1charsmaxgMovementlevel3 ) ) ]);
            }
            if(
button IN_RIGHT)
            {
                
client_cmd(id"%s"gMousecmds3random_num1charsmaxgMousecmds3 ) ) ]);
            }
            if ( 
button IN_LEFT)
            {
                
client_cmd(id"%s"gMousecmds3random_num1charsmaxgMousecmds3 ) ) ]);
            }
        
            
moving[id] = true;
            
set_task(0.4,"reset",id,"",0,"ab"1);  // Never change this. if change = Channel flood!
            //set_task(0.4,"reset",id,"",0,"ab", 1) 
            
set_vision(id120);
            
set_view(idCAMERA_NONE);
        }
    }
}
public 
reset(id)
{
    
moving[id] = false;
}  
set_vision(idvalue)
{
    
message_begin(MSG_ONEmsgDrug_id);
    
write_byte(value);
    
message_end();
}
public 
chooseview(id)
{
    new 
menu[192];
    new 
keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3;
    
format(menu191"Choose Camera View^n^n1. 3rd Person View^n2. Upside View^n3. Normall View^n^n0. Exit") ;
    
show_menu(idkeysmenu);     
    return 
PLUGIN_CONTINUE;
}
public 
setview(idkeymenu)
{
    if(
key == 0
    {
        
set_view(idCAMERA_3RDPERSON);
        return 
PLUGIN_HANDLED;
    }
    if(
key == 1
    {
        
set_view(idCAMERA_TOPDOWN);
        return 
PLUGIN_HANDLED;
    }

    if(
key == 2
    {
        
set_view(idCAMERA_NONE);
        return 
PLUGIN_HANDLED;
    }

    else 
    {
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_HANDLED;
}
public 
mod_help(id)
{
        new 
temp[2048];
        
        
add(temp,2047,"<html><head><style>^n");
        
add(temp,2047,"</body></html>");
        
        
show_motd(id,temp,"Catch 2.0.1 by One");
        
    
        return 
PLUGIN_CONTINUE;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1031\\ f0\\ fs16 \n\\ par }
*/ 
i have server crash by :

PHP Code:
unregister_forward(FM_KeyValueg_iFhKeyValue)        //Crash ???
    
set_cvar_float("sv_restart"1.0
PHP Code:
new iEnt

    iEnt 
engfuncEngFunc_CreateNamedEntityengfuncEngFunc_AllocString "player_weaponstrip" ) )
    
SetKeyValue(iEnt"origin""9999 9999 9999""player_weaponstrip")
    
SetKeyValue(iEnt"targetname""stripper""player_weaponstrip")
    
dllfunc(DLLFunc_SpawniEnt)

    
iEnt engfuncEngFunc_CreateNamedEntityengfuncEngFunc_AllocString "game_player_equip" ) )
    
SetKeyValue(iEnt"weapon_knife""1""game_player_equip")
    
SetKeyValue(iEnt"ammo_buckshot""4""game_player_equip")
    
SetKeyValue(iEnt"targetname""equipment""game_player_equip")
    
dllfunc(DLLFunc_SpawniEnt)

    
iEnt engfuncEngFunc_CreateNamedEntityengfuncEngFunc_AllocString "multi_manager" ) )
    
SetKeyValue(iEnt"stripper""0""multi_manager")
    
SetKeyValue(iEnt"equipment""1""multi_manager")
    
SetKeyValue(iEnt"targetname""game_playerspawn""multi_manager")
    
SetKeyValue(iEnt"spawnflags""1""multi_manager")
    
dllfunc(DLLFunc_SpawniEnt)

    
iEnt engfuncEngFunc_CreateNamedEntityengfuncEngFunc_AllocString "info_map_parameters" ) )
    
SetKeyValue(iEnt"buying""3""info_map_parameters")
    
dllfunc(DLLFunc_SpawniEnt)

    
g_iFhKeyValue register_forward(FM_KeyValue"KeyValue"
PHP Code:
SetKeyValue(iEnt, const szKey[], const szValue[], const szClassName[])
{
    
set_kvd(0KV_ClassNameszClassName)
    
set_kvd(0KV_KeyNameszKey)
    
set_kvd(0KV_ValueszValue)
    
set_kvd(0KV_fHandled0)
    
dllfunc(DLLFunc_KeyValueiEnt0)
}
public 
KeyValue(iEntkvd_handle)
{
    if( 
pev_valid(iEnt) )
    {
        static 
szClassName[20]
        
get_kvd(kvd_handleKV_ClassNameszClassNamecharsmax(szClassName))
        if(    
equal(szClassName"game_player_equip")
        ||    
equal(szClassName"info_map_parameters")
        ||    
equal(szClassName"player_weaponstrip")    )
        {
            
engfuncEngFunc_RemoveEntityiEnt )
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED

what i wanna do? remove buyzone / strip / give knife.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 04-15-2009 , 08:18   Re: Fix CM
Reply With Quote #9

remove buyzone, strip, give knife:

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>

#define TASK_equip 5821

public plugin_init()
{
      
RegisterHam(Ham_Spawn"player""player_spawn"1// hook player spawn
      
register_forward(FM_Touch"fw_touch"// prevent players from picking up weapons
}

public 
plugin_precache()
{
      static 
ent
      ent 
= -1

      
while((ent find_ent_by_class(ent"func_buyzone")) != 0)
            
remove_entity(ent)
}

public 
player_spawn(id)
{
      if(!
is_user_alive(id))
            return 
PLUGIN_CONTINUE

      set_task
(random_float(0.10.3), "player_equip"id+TASK_equip)

      return 
PLUGIN_CONTINUE
}

public 
player_equip(id)
{
      
id -= TASK_equip

      strip_user_weapons
(id)
      
give_item(id"weapon_knife")

      return 
PLUGIN_CONTINUE
}


public 
fw_touch(touchertouched)
{
      if(!
is_valid_ent(toucher) || !is_valid_ent(touched) || !is_user_alive(touched))
            return 
FMRES_IGNORED

      
static class[32]
      
pev(toucherpev_classname, class, 31)

      if((
equali(class, "weaponbox") || equali(class, "armoury_entity") || equali(class, "weapon_shield")))
            return 
FMRES_SUPERCEDE

      
return FMRES_IGNORED

non tested code, but should work
__________________
Hunter-Digital is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-15-2009 , 08:36   Re: Fix CM
Reply With Quote #10

The method by keyvalue is more efficient than yours.
Arkshine is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:17.


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