Raised This Month: $ Target: $400
 0% 

vip/admin models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-03-2020 , 13:52   Re: vip/admin models
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>


#define PLUGIN "Admin Model Menu"
#define VERSION "1.1"
#define AUTHOR "Mr. Boopsy"
#define ADMIN_LEVEL_Q    ADMIN_LEVEL_C

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

public 
plugin_precache() 
{
        
precache_model("models/player/Asasin/Asasin.mdl")
        
precache_model("models/player/Death/Death.mdl")
        
precache_model("models/player/Dobby/Dobby.mdl")
        
precache_model("models/player/Sonic/Sonic.mdl")
        
precache_model("models/player/Skeleton/Skeleton.mdl")
        
precache_model("models/player/Joker/Joker.mdl")
        
precache_model("models/player/Iron/Iron.mdl")
}
        
public 
admin(id)
{
    new 
CsTeams:Team cs_get_user_team(id);

    if (
Team == CS_TEAM_CT)
        {
            if (
get_user_flags(id) & ADMIN_LEVEL_H)
            {
                
model_menu_ct(id);
            }
            else
            {
                
ChatColor(id"!n>> !gYou don't have required flag!");
            }
        }
        else if (
Team == CS_TEAM_T)
        {
            if (
get_user_flags(id) & ADMIN_LEVEL_H)
            {
                
model_menu_tt(id);
            }
            else
            {
                
ChatColor(id"!n>> !gYou don't have required flag!");
            }
        }
        else if (
get_user_flags(id) & ADMIN_LEVEL_H)
        {
            if (!(
Team == CS_TEAM_CT) || !(Team == CS_TEAM_CT))
            {
                
ChatColor(id"!n>> !gYou have to be in valid team to use this command!");
            }
        }
}

public 
model_menu_ct(id)
{
    new 
menu_ct menu_create("\r[\wAdmin Models\r]\r""menu_ct_f")
    
    
menu_additem(menu_ct"\wDeath""1"0)
    
menu_additem(menu_ct"\wSonic""2"0)
    
menu_additem(menu_ct"\wSkeleton""3"0)

    
    
menu_setprop(menu_ctMPROP_EXITMEXIT_ALL)
    
    
menu_display(idmenu_ct0)
}

public 
model_menu_tt(id)
{
    new 
menu_tt menu_create("\r[\wAdmin Models\r]\r""menu_tt_f")
    
    
menu_additem(menu_tt"\wAsasin""1"0)
    
menu_additem(menu_tt"\wDobby""2"0)
    
menu_additem(menu_tt"\wJoker""3"0)
    
menu_additem(menu_tt"\wIron""4"0)

    
    
menu_setprop(menu_ttMPROP_EXITMEXIT_ALL)
    
    
menu_display(idmenu_tt0)
}

public 
menu_ct_f(idmenu_ctitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu_ct)
        return 
PLUGIN_HANDLED
    
}
    new 
data[6], iName[64]
    new 
accescallback
    menu_item_getinfo
(menu_ctitemaccesdata,5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key)
    { 
       case 
cs_set_user_model(id"Death")
       case 
cs_set_user_model(id"Sonic")
       case 
cs_set_user_model(id"Skeleton")
    }
    
menu_destroy(menu_ct)
    return 
PLUGIN_HANDLED
}  

public 
menu_tt_f(idmenu_ttitem_tt)
{
    if (
item_tt == MENU_EXIT)
    {
        
menu_destroy(menu_tt)
        return 
PLUGIN_HANDLED
    
}
    new 
data_tt[6], iName_tt[64]
    new 
acces_ttcallback_tt
    menu_item_getinfo
(menu_ttitem_ttacces_ttdata_tt,5iName_tt63callback_tt)
    
    new 
key_tt str_to_num(data_tt)
    
    switch(
key_tt)
    { 
       case 
cs_set_user_model(id"Asasin")
       case 
cs_set_user_model(id"Dobby")
       case 
cs_set_user_model(id"Joker")
       case 
cs_set_user_model(id"Iron")
    }
    
menu_destroy(menu_tt)
    return 
PLUGIN_HANDLED


stock ChatColor(const id, const input[], any:...) {
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^4"); // verde
    
replace_all(msg190"!n""^1"); // galben/alb/negru
    
replace_all(msg190"!t""^3"); // rosu/albastru/gri
    
replace_all(msg190"!t2""^0"); // rosu2/albastru2/gri2
    
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    {
        for (new 
0counti++)
            {
            if (
is_user_connected(players[i]))
                {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

I changed a few things in code. I added error message when people in SPEC try to use it, and translated error messages for people without "t" admin flag.

I found one error, that I have no time to fix, maybe tommorow when if I find some free time.

The error occurs when you change teams, so if admin already has for example Sonic model, and changes team to TT, he will have that model when spawned. You can compile that code or download .sma from here.

Edit:

Tested and working!
Attached Files
File Type: sma Get Plugin or Get Source (adminmodel.sma - 126 views - 4.3 KB)

Last edited by supertrio17; 06-03-2020 at 14:17. Reason: Tested!
supertrio17 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 17:08.


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