Raised This Month: $319 Target: $400
 79%   Almost there!

[Awp+Knife] Menu Classic Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
RevCreww
Junior Member
Join Date: Jul 2021
Old 09-12-2021 , 09:21   Re: [Awp+Knife] Menu Classic Plugin
Reply With Quote #11

Quote:
Originally Posted by +ARUKARI- View Post
replace
Code:
precache_model(AWPModels[i])
work tnx you all
RevCreww is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-12-2021 , 09:43   Re: [Awp+Knife] Menu Classic Plugin
Reply With Quote #12

As ARUKARI said, the wrong array was used inside precache_model. Your models are inside AWPModels. AWP is used to tell you the index of the currently selected awp for each player.
I made a typo in my previous post, sorry for that. Try to read every line of code and ask if it is doing what it is supposed to do, try to understand the purpose of that particular line. This is the way to learn.

PHP Code:
if(cs_get_user_team(id) == CS_TEAM_CT)
    {
        
MenuAwp(id);
    }
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        
MenuAwp(id);
    } 
Instead of this, you could just check if the player is alive using is_user_alive. If he is alive then he has a team that will be either ct or terrorist.

Also use Ham_Item_Deploy instead of CurWeapon. CurWeapon is called many times, but you only need to apply the new model once - when the players switches to an awp(this is when Ham_Item_Deploy is called).
__________________

Last edited by HamletEagle; 09-12-2021 at 09:46.
HamletEagle is offline
RevCreww
Junior Member
Join Date: Jul 2021
Old 09-12-2021 , 10:24   Re: [Awp+Knife] Menu Classic Plugin
Reply With Quote #13

Quote:
Originally Posted by HamletEagle View Post
As ARUKARI said, the wrong array was used inside precache_model. Your models are inside AWPModels. AWP is used to tell you the index of the currently selected awp for each player.
I made a typo in my previous post, sorry for that. Try to read every line of code and ask if it is doing what it is supposed to do, try to understand the purpose of that particular line. This is the way to learn.

PHP Code:
if(cs_get_user_team(id) == CS_TEAM_CT)
    {
        
MenuAwp(id);
    }
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        
MenuAwp(id);
    } 
Instead of this, you could just check if the player is alive using is_user_alive. If he is alive then he has a team that will be either ct or terrorist.

Also use Ham_Item_Deploy instead of CurWeapon. CurWeapon is called many times, but you only need to apply the new model once - when the players switches to an awp(this is when Ham_Item_Deploy is called).
see now its work good tnx
Qustion !
if i want make it with XP or LEVEL
PHP Code:
        if(crxranks_get_user_xp(id) => 0) {
    
menu_additem(menu"\wAwp \r[DEFAUT]^n""1");
        }
        if(
crxranks_get_user_xp(id) => 500) {
    
menu_additem(menu"\wAwp \y""2");
        }
        .........
        if(
crxranks_get_user_xp(id) => 2000) {
        
menu_additem(menu"\wAwp \y""6");
        } 
like that if u have not xp, u cant see what is the next awp + how much xp next awp
so there is better idea ?
Attached Files
File Type: sma Get Plugin or Get Source (awp.sma - 13 views - 1.5 KB)

Last edited by RevCreww; 09-12-2021 at 10:25.
RevCreww is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-12-2021 , 10:49   Re: [Awp+Knife] Menu Classic Plugin
Reply With Quote #14

Of course there is. Adding the same code over and over again is NEVER the answer.

Before going into the whole XP thing, using the same ideas we used for models we can improve your menu creation:

Define an array where you will store the menu items:
PHP Code:
new cost AWPMenuNames[][] =
{
    
"\wAwp [DEFAUT]",
    
"\wAwp \yMalaysya",
    ...
    
"\wAwp \yBow Fade"

And then, just like you precached the models using a for loop, add them in the menu.

PHP Code:
public MenuAwp(id)
{
    new 
menu menu_create ("\y>>> \rAwp Menu \y<<<^n\d>>\rRevCrew\d<<    \r|    \w","AwpCase");

    for(new 
isizeof(AWPMenuNames); i++)
    {
        
menu_additem(menuAWPMenuNames[i])
    }

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu);

    return 
1;

Now, it is trivial to add a cost for each item. I am not going to just give you the code because you should be able to come up with it by now, by following what I did previously.
You need to define an array where you store the XP cost for each awp and then inside the for loop above check if the required XP for the current awp(for the current index "i") is higher than the current xp the player has. If so, add the menu item. If you can't figure out, make sure to show what you tried. Saying "it didn't work" is not helpful, always provide details: what you tried, what is confusing you, where are you stuck, etc. This helps force you to think about the issue and helps you figure things out on your own, ultimately learning.

I also want to mention that we are starting to go a bit off-topic, so if you need help adding other features(unrelated to what we discussed so far) you should open a topic in scripting help forum.
__________________

Last edited by HamletEagle; 09-12-2021 at 10:54.
HamletEagle is offline
RevCreww
Junior Member
Join Date: Jul 2021
Old 09-12-2021 , 12:22   Re: [Awp+Knife] Menu Classic Plugin
Reply With Quote #15

Quote:
Originally Posted by HamletEagle View Post
Of course there is. Adding the same code over and over again is NEVER the answer.

Before going into the whole XP thing, using the same ideas we used for models we can improve your menu creation:

Define an array where you will store the menu items:
PHP Code:
new cost AWPMenuNames[][] =
{
    
"\wAwp [DEFAUT]",
    
"\wAwp \yMalaysya",
    ...
    
"\wAwp \yBow Fade"

And then, just like you precached the models using a for loop, add them in the menu.

PHP Code:
public MenuAwp(id)
{
    new 
menu menu_create ("\y>>> \rAwp Menu \y<<<^n\d>>\rRevCrew\d<<    \r|    \w","AwpCase");

    for(new 
isizeof(AWPMenuNames); i++)
    {
        
menu_additem(menuAWPMenuNames[i])
    }

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu);

    return 
1;

Now, it is trivial to add a cost for each item. I am not going to just give you the code because you should be able to come up with it by now, by following what I did previously.
You need to define an array where you store the XP cost for each awp and then inside the for loop above check if the required XP for the current awp(for the current index "i") is higher than the current xp the player has. If so, add the menu item. If you can't figure out, make sure to show what you tried. Saying "it didn't work" is not helpful, always provide details: what you tried, what is confusing you, where are you stuck, etc. This helps force you to think about the issue and helps you figure things out on your own, ultimately learning.

I also want to mention that we are starting to go a bit off-topic, so if you need help adding other features(unrelated to what we discussed so far) you should open a topic in scripting help forum.
i want use Oxcicrom RankSystem because i like it
can u just tell me how i can put xp in awps pls ?
Attached Files
File Type: sma Get Plugin or Get Source (awp.sma - 15 views - 2.3 KB)
RevCreww is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-12-2021 , 12:40   Re: [Awp+Knife] Menu Classic Plugin
Reply With Quote #16

No, I can not. If you are not willing to put in the effort and at least try to do it then I'm not going to keep wasting my time. I clearly explained the idea multiple times and gave examples, you should be able to adapt them.

Read my previous explanations again and this:
"You need to define an array where you store the XP cost for each awp and then inside the for loop above check if the required XP for the current awp(for the current index "i") is higher than the current xp the player has. If so, add the menu item. If you can't figure out, make sure to show what you tried. Saying "it didn't work" is not helpful, always provide details: what you tried, what is confusing you, where are you stuck, etc. This helps force you to think about the issue and helps you figure things out on your own, ultimately learning".

I repeat, if you aren't going to at least try don't bother replying.
__________________

Last edited by HamletEagle; 09-12-2021 at 12:40.
HamletEagle is offline
RevCreww
Junior Member
Join Date: Jul 2021
Old 09-12-2021 , 16:10   Re: [Awp+Knife] Menu Classic Plugin
Reply With Quote #17

Quote:
Originally Posted by HamletEagle View Post
No, I can not. If you are not willing to put in the effort and at least try to do it then I'm not going to keep wasting my time. I clearly explained the idea multiple times and gave examples, you should be able to adapt them.

Read my previous explanations again and this:
"You need to define an array where you store the XP cost for each awp and then inside the for loop above check if the required XP for the current awp(for the current index "i") is higher than the current xp the player has. If so, add the menu item. If you can't figure out, make sure to show what you tried. Saying "it didn't work" is not helpful, always provide details: what you tried, what is confusing you, where are you stuck, etc. This helps force you to think about the issue and helps you figure things out on your own, ultimately learning".

I repeat, if you aren't going to at least try don't bother replying.
ok, tnx
__________________
---

The answer to an idiot is silence
Join My Discord server
RevCreww is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-13-2021 , 06:57   Re: [Awp+Knife] Menu Classic Plugin
Reply With Quote #18

Basically what you're trying to do already exists - AWP / Knife.
I guess it's fine if you're trying to learn but posting a new plugin in this section requires a lot more than something that has already been done.
__________________


Dear admins. If somehow you managed to read this, plz fix.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
CryWolf
Senior Member
Join Date: Jul 2008
Location: Romania
Old 09-18-2021 , 18:31   Re: [Awp+Knife] Menu Classic Plugin
Reply With Quote #19

I'd use precache_generic to avoid model loss from folder, since precache_model dosn't go out of models folder, and the models folder it's predefined. just saing, avoided a lot of problems in the past with such non sense

Hi.
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-19-2021 , 07:31   Re: [Awp+Knife] Menu Classic Plugin
Reply With Quote #20

Quote:
Originally Posted by CryWolf View Post
I'd use precache_generic to avoid model loss from folder, since precache_model dosn't go out of models folder, and the models folder it's predefined. just saing, avoided a lot of problems in the past with such non sense

Hi.
You can't do that with weapon models, only with player models because they are set client-side.
__________________


Dear admins. If somehow you managed to read this, plz fix.

Last edited by OciXCrom; 09-19-2021 at 07:32.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

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 07:44.


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