AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Music Menu & Switching hands models (https://forums.alliedmods.net/showthread.php?t=224542)

Gasior 08-25-2013 12:37

Music Menu & Switching hands models
 
So I've got plugin for admin that allow him to turn on friendlyfire or to play music, but after turning music it doesn't play anything.
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#include <hamsandwich>
#include <fun>

#define PLUGIN "Event Box"
#define VERSION "0.1b"
#define AUTHOR "Gasior"

new name[32], steam[35]
new 
box_song[]  = "sound/event/box.mp3"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /admin""Menu_admina"ADMIN_BAN)
}

public 
plugin_precache()
{
    
precache_generic(box_song)
}

public 
Menu_admina(id)
{
    if(
get_user_flags(id) & ADMIN_BAN)
    {
        new 
menu menu_create("Menu Admina""Menu_admina_handler")
        
menu_additem(menu"\wBox""1"0)
        
menu_additem(menu"\wMuzyka""2"0)
        
menu_setprop(menuMPROP_EXITMEXIT_ALL)
        
menu_display(idmenu0)
    }
}

public 
Menu_admina_handler(idmenuitem)
{
    if(
get_user_flags(id) & ADMIN_BAN)
    {    
        if (
item == MENU_EXIT)
        {
            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:
            {
                
box(id)
            }
            case 
2:
            {
                
muzyka(id)    
            }
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}

public 
muzyka(id)
{
    if(
get_user_flags(id) & ADMIN_BAN)
    {
        new 
musicmenu menu_create("Muzyka""musicday_submenu")
        
menu_additem(musicmenu"\wWlacz muzyke""1"0)
        
menu_additem(musicmenu"\wWylacz muzyke""2"0)
        
menu_setprop(musicmenuMPROP_EXITMEXIT_ALL)
        
menu_display(idmusicmenu0)
    }
}

public 
musicday_submenu(idmusicmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(musicmenu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
Data[7], Name[64]
    new 
AccessCallback
    menu_item_getinfo
(musicmenuitemAccessData5Name63Callback)
    
    new 
key str_to_num(Data)
    

    switch(
key)
    {
            case 
1:
            {
                
client_cmd(0"mp3 play ^"%s^""box_song)
            }
        
            case 
2:
            {
                
client_cmd(0"mp3 stop")
            }
        }
        
    
menu_display(idmusicmenu0)
    return 
PLUGIN_CONTINUE
}

public 
box(id)
{
    if(
get_user_flags(id) & ADMIN_BAN)
    {
        new 
menu menu_create("Box""box_handler")
        
menu_additem(menu"\wWlacz walke""1"0)
        
menu_additem(menu"\wWylacz walke""2"0)
        
menu_setprop(menuMPROP_EXITMEXIT_ALL)
        
menu_display(idmenu0)
    }
}

public 
box_handler(idmenuitem)
{
    if(
get_user_flags(id) & ADMIN_BAN)
    {    
        if (
item == MENU_EXIT)
        {
            return 
PLUGIN_HANDLED
        
}
        new 
data[6], iName[64]
        new 
accesscallback
        get_user_name
(id,name,31
        
get_user_authid(id,steam,charsmax(steam))
        
menu_item_getinfo(menuitemaccessdata,5iName63callback)
        new 
key str_to_num(data)
        switch(
key)
        {
            case 
1:
            {
                
server_cmd("mp_friendlyfire 1")    
                
box(id)
                
ColorChat(0RED"%s Runda sie zaczyna! Do walki!")
            }
            case 
2:
            {
                
server_cmd("mp_friendlyfire 0")    
                
box(id)
                
ColorChat(0RED"%s Koniec Rundy!")
            }

        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED


and the 2nd thing is that I want to change models of hands to box gloves and instead of gloves I have no hands :) I changed only models from bk.amxx to mine
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <cstrike>
#define PA4_LOW  10.0
#define PA4_HIGH 20.0
new PLUGIN_NAME[] =    "Rekawice"
new PLUGIN_VERSION[] =     "1.0"
new PLUGIN_AUTHOR[] =    "Cheap_Suit"

public plugin_init() 
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
register_event("CurWeapon""Event_CurWeapon""be""1=1")
    
register_event("Damage""Event_Damage""be""2!0")
    
register_forward(FM_EmitSound"EmitSound")
}

public 
plugin_precache()
{
    
precache_model("models/p_rekawice.mdl")
    
precache_model("models/v_rekawice.mdl")
    
precache_sound("weapons/cbar_hitbod2.wav")
    
precache_sound("weapons/cbar_hitbod1.wav")
    
precache_sound("weapons/bullet_hit1.wav")
    
precache_sound("weapons/bullet_hit2.wav")
}

public 
Event_Damage(id)
{
    if(!
is_user_alive(id) || !is_user_connected(id)) 
        return 
PLUGIN_CONTINUE
    
    
new AttakerWeaponAttakerPartHit
    get_user_attacker
(idAttakerWeaponAttakerPartHit)
    
    if(
AttakerWeapon != CSW_KNIFE)
        return 
PLUGIN_CONTINUE
      
    
new Float:Random_Float[3]
    for(new 
03i++) Random_Float[i] = random_float(-100.0100.0)
    
Punch_View(idRandom_Float)

    return 
PLUGIN_CONTINUE
}

public 
Event_CurWeapon(id)
{
    if(!
is_user_alive(id) || !is_user_connected(id)) 
        return 
PLUGIN_CONTINUE
    
    
new temp[2], weapon get_user_weapon(idtemp[0], temp[1])
    if(
weapon == CSW_KNIFE)
    {
        
entity_set_string(idEV_SZ_viewmodel"models/v_rekawice.mdl")
        
entity_set_string(idEV_SZ_weaponmodel"models/p_rekawice.mdl")
    }
    return 
PLUGIN_CONTINUE
}


public 
EmitSound(idchannelsample[])
{
    if(!
is_user_alive(id) || !is_user_connected(id)) 
        return 
FMRES_IGNORED

    
new temp[2], weapon get_user_weapon(idtemp[0], temp[1])
    if(
weapon == CSW_KNIFE)
    {
            if(
equal(sample"weapons/knife_hit"17)) 
            {
                new 
pitch
                
switch(random_num(1,3))
                {
                    case 
1pitch PITCH_NORM
                    
case 2pitch PITCH_LOW
                    
case 3pitch PITCH_HIGH
                
}

                new 
Float:volume random_float(0.51.0)

                
emit_sound(idCHAN_WEAPON"weapons/bullet_hit2.wav"volumeATTN_NORM0pitch)
                return 
FMRES_SUPERCEDE
            
}
            else if(
equal(sample,"weapons/knife_stab.wav")) 
            {
                
emit_sound(idCHAN_WEAPON"weapons/cbar_hitbod2.wav"1.0ATTN_NORM0PITCH_NORM)    
                return 
FMRES_SUPERCEDE
            
}
            else if(
equal(sample,"weapons/knife_hitwall1.wav"))
            {
                
emit_sound(idCHAN_WEAPON"weapons/cbar_hitbod1.wav"1.0ATTN_NORM0PITCH_LOW)
                return 
FMRES_SUPERCEDE            
            
}
    }
    return 
FMRES_IGNORED
}

stock Punch_View(idFloat:ViewAngle[3])
{
    
entity_set_vector(idEV_VEC_punchangleViewAngle)


any ideas?

Gasior 08-27-2013 18:47

Re: Music Menu & Switching hands models
 
I've handled it by my own.


All times are GMT -4. The time now is 18:51.

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