help with models menu

Въпроси и проблеми свързани с AMXModX.
Аватар
BloodyPro
Извън линия
Foreigner
Foreigner
Мнения: 26
Регистриран на: 26 Юли 2020, 16:28
Местоположение: Palestine
Се отблагодари: 1 път
Обратна връзка:

help with models menu

Мнение от BloodyPro » 26 Юли 2020, 22:09

hey,
i have this plugin , but the player chooses his model it disappears when he's transfered too another team (Deathrun Mod Server)
so how i can make it stays for all the map without changing

Код за потвърждение: Избери целия код

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


#define PLUGIN "Model Menu"
#define VERSION "1.0"
#define AUTHOR "BloodyPro"

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /model", "model_menu")
}

public plugin_precache() 
{
        precache_model("models/player/sonic/sonic.mdl")
        precache_model("models/player/spiderman/spiderman.mdl")
        precache_model("models/player/trollman/trollman.mdl")
        precache_model("models/player/man/man.mdl")
        precache_model("models/player/horse/horse.mdl")
        precache_model("models/player/vip/vip.mdl")
}
		

public model_menu(id)
{
    new menu = menu_create("\rModel Menu", "menu_wybierz")
    
    menu_additem(menu, "\wSonic \y(Admins)", "1", 0)
    menu_additem(menu, "\wSpiderMan \y(Level30)", "2", 0)
    menu_additem(menu, "\wTrollMan \y(Level30)", "3", 0)
    menu_additem(menu, "\wMan \y(Level30)", "4", 0)
    menu_additem(menu, "\wHorse \y(Level30)", "5", 0)
    menu_additem(menu, "\wSexy \y(VIPS)", "6", 0)

    
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
    
    menu_display(id, menu, 0)
}

public menu_wybierz(id, menu, item)
{
    if (item == MENU_EXIT)
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }
    new data[6], iName[64]
    new acces, callback
    menu_item_getinfo(menu, item, acces, data,5, iName, 63, callback)
    
    new key = str_to_num(data)
    
    switch(key)
    { 
case 1 :
       {
	if (get_user_flags(id) & ADMIN_VOTE)
		{
			cs_set_user_model(id, "sonic")
		}
		else
        {
               ColorChat(id, GREEN, "**You must be an admin to use this Model.**")
        }
	
}
       case 2 :
       {
	if (get_user_flags(id) & ADMIN_LEVEL_G)
		{
			cs_set_user_model(id, "spiderman")
		}
		else
        {
               ColorChat(id, GREEN, "**You must be Level 30 to use this Model.**")
        }
	
}
       case 3 : 
             {
	if (get_user_flags(id) & ADMIN_LEVEL_G)
		{
			cs_set_user_model(id, "trollman")
		}
		else
        {
               ColorChat(id, GREEN, "**You must be Level 30 to use this Model.**")
        }
	
}
       case 4 :
             {
	if (get_user_flags(id) & ADMIN_LEVEL_G)
		{
			cs_set_user_model(id, "man")
		}
		else
        {
               ColorChat(id, GREEN, "**You must be Level 30 to use this Model.**")
        }
	
}
       case 5 : cs_set_user_model(id, "horse")
             {
	if (get_user_flags(id) & ADMIN_LEVEL_G)
		{
			cs_set_user_model(id, "horse")
		}
		else
        {
               ColorChat(id, GREEN, "**You must be Level 30 to use this Model.**")
        }
	
}
       case 6 : cs_set_user_model(id, "vip")
             {
	if (get_user_flags(id) & ADMIN_LEVEL_H)
		{
			cs_set_user_model(id, "vip")
		}
		else
        {
               ColorChat(id, GREEN, "**You must be VIP to use this Model.**")
        }
	
}


    }
    menu_destroy(menu)
    return PLUGIN_HANDLED
}
Последно промяна от thoughtz на 27 Юли 2020, 12:26, променено общо 1 път.
Причина: Use [code] tag

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

help with models menu

Мнение от OciXCrom » 27 Юли 2020, 13:41

You should save the model in a variable, hook the TeamInfo event to detect when the player's team was changed and reapply it when that happens.

Аватар
BloodyPro
Извън линия
Foreigner
Foreigner
Мнения: 26
Регистриран на: 26 Юли 2020, 16:28
Местоположение: Palestine
Се отблагодари: 1 път
Обратна връзка:

help with models menu

Мнение от BloodyPro » 27 Юли 2020, 17:41

OciXCrom написа: 27 Юли 2020, 13:41 You should save the model in a variable, hook the TeamInfo event to detect when the player's team was changed and reapply it when that happens.
and how to do that ? im not that good with coding , its my first plugin , can u do it for me ? or just give me what's the code for that

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

help with models menu

Мнение от OciXCrom » 27 Юли 2020, 20:50

First I'll suggest you to use a better coded plugin - https://forums.alliedmods.net/showpost. ... ostcount=6

There's no need to hardcode the values and change them in 5 different places in the code if you want to add/edit something.
The above plugin also sets the model on player spawn, so I believe it will do the job. Not sure why you would want to have the same model for both teams.

Аватар
BloodyPro
Извън линия
Foreigner
Foreigner
Мнения: 26
Регистриран на: 26 Юли 2020, 16:28
Местоположение: Palestine
Се отблагодари: 1 път
Обратна връзка:

help with models menu

Мнение от BloodyPro » 27 Юли 2020, 21:49

OciXCrom написа: 27 Юли 2020, 20:50 First I'll suggest you to use a better coded plugin - https://forums.alliedmods.net/showpost. ... ostcount=6

There's no need to hardcode the values and change them in 5 different places in the code if you want to add/edit something.
The above plugin also sets the model on player spawn, so I believe it will do the job. Not sure why you would want to have the same model for both teams.
so its not possible to edit my plugin ? to make it how i want it to be ?

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

help with models menu

Мнение от OciXCrom » 28 Юли 2020, 03:10

I gave you a better version of your plugin that does the same thing. Editing it will end up transforming it in what I gave you, so I don't see the difference.

Публикувай отговор
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Поддръжка / Помощ”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 10 госта