AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Subplugin Submission [ZP43Fix5a|ZP50] Addon: Human Player Model Menu (https://forums.alliedmods.net/showthread.php?t=260452)

yokomo 03-25-2015 14:00

[ZP43Fix5a|ZP50] Addon: Human Player Model Menu
 
1 Attachment(s)
I'm not sure this kind of plugin exist or not for ZP43Fix5a and ZP50, so i create my own Human Player Model Menu. Please note it's only for Human (not Zombie, Nemesis, Survivor).

So what does this plugin do?

Simple, it create a menu to humans to choose which model they want to use. :fox:
Player model will automatically set on player spawn / humanized. Also it's real-time model changes, that means instant model change every time you choose your new model.

See the .sma file and customize your models as want.

Client Chat Commands:
/model -- Display custom models menu.

ZP version:
- ZP43Fix5a & ZP50.

Screenshots:
http://cloud-4.steamusercontent.com/...2DDFC53CC5303/
http://cloud-2.steamusercontent.com/...9ACD26A882B36/

Changes Log:
Spoiler

wicho 04-02-2015 19:08

Re: [ZP43Fix5a] Addon: Human Player Model Menu
 
Nice idea, to 5.0 but not tested, someone test it and confirm me..

PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <cs_player_models_api> 
native zp_core_is_zombie(id)
native zp_class_survivor_get(id)

//Uncomment this to enable player modelindex
//#define USE_PLAYER_MODELINDEX

//player model name: edit as you want
new const szModelName[][] = 
{
    
"arctic",
    
"gign",
    
"gsg9",
    
"guerilla",
    
"leet",
    
"sas",
    
"terror",
    
"urban",
    
"vip"
}

//player model name in menu: edit as you want
new const szModelMenuName[][] = 
{
    
"Arctic Munkey",
    
"GIGN",
    
"GSG9",
    
"Guerillaz",
    
"1337",
    
"SAS",
    
"Tellolist",
    
"Urban Chaos",
    
"VVIP"
}

new 
bool:bIsNewModel[33], szNewModel[33][32], bool:bIsNewRound

public plugin_precache()
{
    new 
jszText[64]
    for(
j=0sizeof szModelNamej++)
    {
        
formatex(szText63"models/player/%s/%s.mdl"szModelName[j], szModelName[j])
        
precache_model(szText)
    }
}

public 
plugin_init()
{
    
register_plugin("ZP Models Menu""0.0.1""wbyokomo")
    
    
register_event("HLTV""OnNewRound""a""1=0""2=0")
    
register_logevent("OnStartRound",2"1=Round_Start")
    
    
RegisterHam(Ham_Spawn"player""OnPlayerSpawnPost"1)
    
    
register_clcmd("say /model""CmdNewModels")
}

public 
client_disconnect(id)
{
    
bIsNewModel[id] = false
}

public 
OnNewRound()
{
    
bIsNewRound true
}

public 
OnStartRound()
{
    
bIsNewRound false
}

public 
OnPlayerSpawnPost(id)
{
    if(!
is_user_alive(id) || !bIsNewModel[id]) return;
    
    
//spawn as zombie in deathmatch, no need to change model.
    
if(!bIsNewRound && zp_core_is_zombie(id)) return;
    
    
//new szCurModel[32]; get_user_info(id, "model", szCurModel, 31);
    //if(!equali(szCurModel, szNewModel[id])) zp_override_user_model(id, szNewModel[id]);
    #if defined USE_PLAYER_MODELINDEX
    
cs_set_player_model(idszNewModel[id], 1)
    
#else
    
cs_set_player_model(idszNewModel[id])
    
#endif
}

public 
zp_fw_core_cure_post(id)
{
    if(!
bIsNewModel[id] || zp_class_survivor_get(id)) return;
    
    
//new szCurModel[32]; get_user_info(id, "model", szCurModel, 31);
    //if(!equali(szCurModel, szNewModel[id])) zp_override_user_model(id, szNewModel[id]);
    #if defined USE_PLAYER_MODELINDEX
    
cs_set_player_model(idszNewModel[id], 1)
    
#else
    
cs_set_player_model(idszNewModel[id])
    
#endif
}

public 
CmdNewModels(id)
{
    if(!
is_user_connected(id))
    {
        
log_amx("Unconnected player [%d] tried to use /model command."id)
        return 
PLUGIN_HANDLED;
    }
    
    if(
zp_core_is_zombie(id) || zp_class_survivor_get(id))
    {
        
client_print(idprint_chat"[MODEL] Sorry! Zombie, Nemesis, Survivor can't use custom model.")
        return 
PLUGIN_HANDLED;
    }
    
    new 
menu menu_create("Human Models:""mh_CustomModel")
    
    new 
j
    
for(j=0sizeof szModelMenuNamej++)
    {
        
menu_additem(menuszModelMenuName[j], ""0)
    }
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
    
    return 
PLUGIN_HANDLED;
}

public 
mh_CustomModel(idmenuitem)
{
    if(!
is_user_connected(id))
    {
        
menu_destroy(id)
        return 
PLUGIN_HANDLED;
    }
    
    if(
zp_core_is_zombie(id) || zp_class_survivor_get(id))
    {
        
menu_destroy(id)
        
client_print(idprint_chat"[MODEL] Sorry! Zombie, Nemesis, Survivor can't use custom model.")
        return 
PLUGIN_HANDLED;
    }
    
    if(
item == MENU_EXIT)
    {
        
menu_destroy(id)
        return 
PLUGIN_HANDLED;
    }

    new 
command[6], name[64], accesscallback

    menu_item_getinfo
(menuitemaccesscommandsizeof command 1namesizeof name 1callback)
    
    
bIsNewModel[id] = true
    
//new szCurModel[32]; get_user_info(id, "model", szCurModel, 31);
    //if(!equali(szCurModel, szModelName[item])) zp_override_user_model(id, szModelName[item]);
    #if defined USE_PLAYER_MODELINDEX
    
cs_set_player_model(idszModelName[item], 1)
    
#else
    
cs_set_player_model(idszModelName[item])
    
#endif
    
copy(szNewModel[id], 31szModelName[item])
    
client_print(idprint_chat"[MODEL] You've chosen '%s' as your new player model."szModelName[item])

    
menu_destroy(menu)

    return 
PLUGIN_HANDLED;




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

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