AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   vip/admin models (https://forums.alliedmods.net/showthread.php?t=324973)

baly222 06-03-2020 05:26

vip/admin models
 
hi, can someone help me with this plugin ? its admin or vip models but I don't want it allowed to be used in both teams .

for example:
Te: Asasin , Iron , Joker, dobby
CT: Death , sonic, Skeleton



PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>


#define PLUGIN "Admin Model Menu"
#define VERSION "1.0"
#define AUTHOR "Dimision"
#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)
{
    if (
get_user_flags(id) & ADMIN_LEVEL_H)
        {
            
model_menu(id)
        }
        else
        {
               
ChatColor(id"!g>> !nAceste modele sunt doar pentru !gAdmini !n!")
        }
    
}
public 
model_menu(id)
{
    new 
menu menu_create("\r[\wAdmin Models\r]\r""menu_wybierz")
    
    
menu_additem(menu"\wAsasin""1"0)
    
menu_additem(menu"\wDeath""2"0)
    
menu_additem(menu"\wDobby""3"0)
    
menu_additem(menu"\wSonic""4"0)
    
menu_additem(menu"\wSkeleton""5"0)
    
menu_additem(menu"\wJoker""6"0)
    
menu_additem(menu"\wIron""7"0)

    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
    
menu_display(idmenu0)
}

public 
menu_wybierz(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    new 
data[6], iName[64]
    new 
accescallback
    menu_item_getinfo
(menuitemaccesdata,5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key)
    { 
       case 
cs_set_user_model(id"Asasin")
       case 
cs_set_user_model(id"Death")
       case 
cs_set_user_model(id"Dobby")
       case 
cs_set_user_model(id"Sonic")
       case 
cs_set_user_model(id"Skeleton")
       case 
cs_set_user_model(id"Joker")
       case 
cs_set_user_model(id"Iron")
    }
    
menu_destroy(menu)
    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();
            }
        }
    }



supertrio17 06-03-2020 13:52

Re: vip/admin models
 
1 Attachment(s)
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!

OciXCrom 06-03-2020 14:11

Re: vip/admin models
 
Check this - https://forums.alliedmods.net/showpo...77&postcount=6

It doesn't require you to make 10 changes just to edit a single model.

supertrio17 06-03-2020 14:16

Re: vip/admin models
 
I started Pawning like 7 days ago, so sorry if my code is unusual or something :(

baly222 06-04-2020 06:49

Re: vip/admin models
 
Quote:

Originally Posted by supertrio17 (Post 2703827)
I started Pawning like 7 days ago, so sorry if my code is unusual or something :(

It Working bud need help with team changing, because I useing hns mod on server..when ct wins teams will change, and they still have skin from last round , and why can see only steam players ?

baly222 06-04-2020 07:41

Re: vip/admin models
 
Quote:

Originally Posted by OciXCrom (Post 2703825)
Check this - https://forums.alliedmods.net/showpo...77&postcount=6

It doesn't require you to make 10 changes just to edit a single model.

sorry I dont understand the code. where I can edit weys for models ?

OciXCrom 06-04-2020 08:08

Re: vip/admin models
 
The paths to the models are always the same. Just change the model names in the beginning of the code and set their team.

supertrio17 06-04-2020 11:21

Re: vip/admin models
 
Yeah, I could add check for teams, but I can't do it right now, sorry but you will need to wait a bit :)

supertrio17 06-05-2020 03:54

Re: vip/admin models
 
Quote:

why can see only steam players ?
Can you explain this one to me, I don't quite understand

mahbodsr 06-05-2020 09:12

Re: vip/admin models
 
Quote:

Originally Posted by baly222 (Post 2703909)
It Working bud need help with team changing, because I useing hns mod on server..when ct wins teams will change, and they still have skin from last round , and why can see only steam players ?

Explain more ,
What Skins Do You want to set when Ct/T wins?


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

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