Raised This Month: $32 Target: $400
 8% 

OverHead Models


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff       
MapCreator
Junior Member
Join Date: Dec 2015
Location: Baku
Old 12-18-2015 , 14:48   OverHead Models
Reply With Quote #1

Update
Description
This plugin allows to set animated models over head. Models could be added from config file. It will be useful on JailBreak servers.

Requirements
#include <amxmodx>
#include <amxmisc>

Usage
Say "/hm" into the chat

Configs
"Bats" "models/jail/bats.mdl"
First peace is the name of model in menu, second one is path to model.

Here screenshots






Attached Files
File Type: zip head_models.zip (134.6 KB, 120 views)
File Type: sma Get Plugin or Get Source (head_models.sma - 607 views - 2.0 KB)

Last edited by MapCreator; 12-21-2015 at 08:48.
MapCreator is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 12-18-2015 , 14:52   Re: OverHead Models
Reply With Quote #2

Is very nice to share it, but Read before posting new plugins. - Updated 9-5-14
and Plugins, quantity, quality.

They are stickies at this sub-forum and explain this section.


Update:

You submitted the .amxx file inside "head_models.zip". Your plugin is too simple, but do not worry, it will probably just be unapproved.

But I am wring a suggestions list, then after those changes may be it could get approved.


Suggestions:

Use menu to choose the options like "say /setmodel".

Load the models from a file.

As you load then from a file, they have an id, so, use it to switch the models. Here at this plugin, you could use as an example about how to load multiples lines from file and create a multi-page menu using octal numbers, then use a switch to choose then using the menu as bellow:

As it is now:
Code:
public cmd_setmodel(id) {     if(!is_user_alive(id) || !is_user_connected(id))         return PLUGIN_HANDLED         new arg[64]     read_argv(1, arg, charsmax(arg))         if(equali(arg, "bategorka") || equali(arg, "butterflymap") || equali(arg, "jbfish"))     {         message_begin(MSG_ALL, SVC_TEMPENTITY)         write_byte(TE_PLAYERATTACHMENT)         write_byte(id)         write_coord(60)         if(equali(arg, "bategorka"))             write_short(spriteBat)         else if(equali(arg, "butterflymap"))             write_short(spriteButterfly)         else if(equali(arg, "jbfish"))             write_short(spriteFish)         write_short(30)         message_end()     }         return PLUGIN_CONTINUE }

As it would became: (This is partial, you need to code the rest learning from the plugin mentioned)
Code:
public cmd_setmodel(player_id, key_pressed) {     new model_id_index = get_model_index( g_menuPosition[player_id], key_pressed )     message_begin(MSG_ALL, SVC_TEMPENTITY)     write_byte(TE_PLAYERATTACHMENT)     write_byte(player_id)     write_coord(60)     write_short(g_models_loaded_ids[model_id_index])     write_short(30)     message_end()         return PLUGIN_CONTINUE } public get_model_index( current_menu_page, current_pressed_key ) {        new vote_mod_code = current_menu_page * 10 + current_pressed_key     return convert_octal_to_decimal( vote_mod_code ) } public convert_octal_to_decimal( octal_number ) {        new decimal = 0     new i = 0     new remainder     while( octal_number != 0 )     {            remainder = octal_number % 10         octal_number /= 10         decimal += remainder * power(8, i);         ++i     }     return decimal; }

If you want to, i can specificity better where to look up at that plugin or whatever.

Last edited by addons_zz; 12-18-2015 at 18:54. Reason: spelling fixes and new better info
addons_zz is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-19-2015 , 06:36   Re: OverHead Models
Reply With Quote #3

Please remove the amxx file from the archive. Also, this is not enough to be considered a new submission, try to do something more customizable, like allowing admins to set from a file the available models, etc.

Unapproved.
__________________
HamletEagle is offline
MapCreator
Junior Member
Join Date: Dec 2015
Location: Baku
Old 12-19-2015 , 06:51   Re: OverHead Models
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
Please remove the amxx file from the archive. Also, this is not enough to be considered a new submission, try to do something more customizable, like allowing admins to set from a file the available models, etc.

Unapproved.
Removed amxx file. Okey i will think something
MapCreator is offline
MapCreator
Junior Member
Join Date: Dec 2015
Location: Baku
Old 12-19-2015 , 06:54   Re: OverHead Models
Reply With Quote #5

Thanks for help. Code is not simple. I think thar there is easier way to do this. What about TrieArray or Array?
I have read from internet about TrieArray but can`t understand structure off this array. I think that it is possible to make this plugin with TrieArray
MapCreator is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-19-2015 , 06:56   Re: OverHead Models
Reply With Quote #6

What do you want to do ? How you want to redesign this ? I need to know this before suggesting something.
__________________
HamletEagle is offline
MapCreator
Junior Member
Join Date: Dec 2015
Location: Baku
Old 12-19-2015 , 09:07   Re: OverHead Models
Reply With Quote #7

want to create menu(menu items from config file) where player can set model. and of course models will be prechaed from config file. i am working on it

Last edited by MapCreator; 12-19-2015 at 09:08.
MapCreator is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 12-19-2015 , 12:53   Re: OverHead Models
Reply With Quote #8

Answering your PM, you do not need tries.

Now you can build a menu using g_models_names, and each menu item can have a number which can be associated to the index of g_models_ids, as I said earlier using the current menu page and pressed key and converting it from octal to a decimal number, which will be the model_index, as a did at this plugin.

Then the index can be used to set the model at setmodel(id, model_index).

Code:
#include <amxmodx> #include <amxmisc> #define MAX_MODELS_NUMBER 32 #define MAX_MODEL_NAME_SIZE 64 #define MAX_MODEL_PATH_SIZE 256 new g_models_ids         [MAX_MODELS_NUMBER] new g_models_paths    [MAX_MODELS_NUMBER]    [MAX_MODEL_PATH_SIZE] new g_models_names  [MAX_MODELS_NUMBER]    [MAX_MODEL_NAME_SIZE] new g_currrent_model_total = 0 public plugin_init() {     register_plugin("HeadModels", "0.9.5", "MapCreator")     register_clcmd("asd", "asd") } public asd(id) {     setmodel(id, 0) } public plugin_precache() {     new path[64]     get_configsdir(path, charsmax(path))     add(path, charsmax(path), "/head_models.cfg")         if(!file_exists(path))         pause("d")         new file = fopen(path, "rt")         new Buffer[128], ModelName[64], ModelPath[64]     while(!feof(file))     {         fgets(file, Buffer, charsmax(Buffer))         trim(Buffer)                 if(Buffer[0] == ';' || Buffer[0] == '/')             continue;                 parse(Buffer, ModelName, charsmax(ModelName), ModelPath, charsmax(ModelPath))         g_models_paths[g_currrent_model_total] = ModelPath         g_models_names[g_currrent_model_total] = ModelName         g_models_ids[g_currrent_model_total] = precache_model(ModelPath)         g_currrent_model_total++     }     fclose(file) } public setmodel(id, model_index) {     if(!is_user_alive(id) || !is_user_connected(id))         return PLUGIN_HANDLED     message_begin(MSG_ALL, SVC_TEMPENTITY)     write_byte(TE_PLAYERATTACHMENT)     write_byte(id)     write_coord(60)     write_short( g_models_ids[model_index] )     write_short(30)     message_end()         return PLUGIN_CONTINUE }

Last edited by addons_zz; 12-19-2015 at 15:23. Reason: spelling fixes
addons_zz is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-19-2015 , 13:26   Re: OverHead Models
Reply With Quote #9

You could probably use dynamic arrays, to have unlimited models. Then, making a menu with the items in array, and accessing the right entry by the item index from the menu.
__________________

Last edited by HamletEagle; 12-19-2015 at 13:28.
HamletEagle is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 12-19-2015 , 15:11   Re: OverHead Models
Reply With Quote #10

Quote:
Originally Posted by HamletEagle View Post
You could probably use dynamic arrays, to have unlimited models. Then, making a menu with the items in array, and accessing the right entry by the item index from the menu.
They are perfect to this job.

I missed that here and at my plugin where I shall update it at next version.

Last edited by addons_zz; 12-19-2015 at 16:36. Reason: spelling fixes
addons_zz 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 16:12.


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