AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   AWP Models [XP System Support] (https://forums.alliedmods.net/showthread.php?t=293454)

OciXCrom 02-01-2017 08:15

AWP Models [XP System Support]
 
2 Attachment(s)

Description

  • A simple plugin that adds a menu from which you can choose your AWP skin. The menu can be accessed by typing /awp in the chat.


Cvars

  • am_open_at_spawn "0" -- whether the menu will be automatically opened on first spawn
  • am_save_choice "0" -- whether the selected skin will be saved via SteamID after leaving the server


Adding skins

  • The skins can be added in configs/AWPModels.ini by following the example:

    PHP Code:

    [Skin Name]
    V_MODEL path to v_ model
    P_MODEL 
    path to p_ model 

  • If the skin doesn't have a p_ model, you can choose not to add the P_MODEL field.
  • You can also add a sound when selected, assign a admin flag or a level from the rank system:

    PHP Code:

    [Skin Name]
    V_MODEL path to v_ model
    P_MODEL 
    path to p_ model
    FLAG 
    = if you want the skin to be for VIP users/adminsenter the flag here
    LEVEL 
    required level (requires OciXCrom's Rank System)
    SHOW_RANK = if set to 1, the rank name will be displayed instead of the level number (requires OciXCrom'
    s Rank System)
    XP required XP (requires OciXCrom's Rank System)
    SELECT_SOUND = sound when selecting the skin from the menu 

  • Example:

    PHP Code:

    [My Cool AWP]
    V_MODEL models/v_coolawp.mdl
    P_MODEL 
    models/p_coolawp.mdl
    FLAG 
    b
    LEVEL 
    15
    SHOW_RANK 
    1
    XP 
    5000
    SELECT_SOUND 
    coolawp/select.wav 


https://raw.githubusercontent.com/Oc...using_this.png
https://raw.githubusercontent.com/Oc...plugin_lab.png
https://raw.githubusercontent.com/Oc...ad_default.png

EFFx 02-01-2017 08:20

Re: AWP Models
 
I think adding a cvar for put a message in the menu is not a good idea, do you? Will be better users change them in the .ini file.

I like this, most of users here will like aswell. Will be good with more weapons.

OciXCrom 02-01-2017 08:46

Re: AWP Models
 
Why is it a bad idea? It's usually a bad idea when the message is supposed to be long, but in this case it's only one word with a few colors that needs to fit in one line in the menu, so I don't think that's a problem.

I made this especially for an AWP server, so that's why I didn't add an option for all the other weapons, plus I don't really feel like doing such a big plugin. I also have another one for a knife server with knife models, but I don't know if it is a good idea to post both.

EFFx 02-01-2017 13:59

Re: AWP Models
 
If you think that it can be how its right now, just do what your mind says.

Yea, the code will be so much long, but just use your knowledge with enumerates and arrays, you know so much things with these formats. You can minimize so much lines with this.

Here's my changes:

1. In ColorChat():

You can cache the value of iPlayers[i] with an interger.
You need not start the iCount with 1
is_user_connected() is not needed

Here:

PHP Code:

message_begin(MSG_ONE_UNRELIABLEg_iSayText_iPlayers[i]) 

You can do .player = Player or your interger's name. Just for skip this '_,'. Just a small thing.

And you're using the g_iSayText just one time, you can cache only if you use a native more than one time. Just add get_user_msgid("SayText").

OciXCrom 02-01-2017 15:10

Re: AWP Models
 
I don't want to make this code complicated and use .ini files for settings. The least I can do is add a lang file and put all the messages there.

That ColorChat is not even mine, I have been using it since forever and approvers don't have a problem with it. But now that you mention it, you're right, maybe it should be fixed, but I really don't want to experiment with it, since I haven't had any problems with it. It starts from 0 with a reason, take a look at the beginning of the function. However, you're wrong about the SayText part. The code is used every time when ColorChat is called, aka every time a message is sent, so it will search the msgid every time it is used. Caching it in plugin_init will is totally correct.

EFFx 02-01-2017 15:13

Re: AWP Models
 
Okay.

Yea yea, I was wrong, I've searched and everyone use like this, you're totally right, my mistake. And I knew its not your ColorChat.

OciXCrom 02-05-2017 13:01

Re: AWP Models
 
Update v1.3 @ 05.02.2017
  • Added a lang file from where you can change the text.
  • Removed text cvars.

EFFx 02-05-2017 16:07

Re: AWP Models
 
PHP Code:

format(szMessage[0], charsmax(szMessage), "%L %s"id id LANG_PLAYER"AM_CHAT_PREFIX"szMessage

I think is something wrong here, do you?

You doesn't make all changes I said on ColorChat().

OciXCrom 02-05-2017 16:19

Re: AWP Models
 
What's wrong? I didn't do any changes because you said you're wrong, or did you change your mind now?

EFFx 02-05-2017 16:23

Re: AWP Models
 
I said i was wrong about the MsgSayText ._.
And, why would you add a ML for the tag prefix? Or I've readed it wrong?


All times are GMT -4. The time now is 09:50.

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