Raised This Month: $ Target: $400
 0% 

Help for script..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Aleku.
Junior Member
Join Date: May 2019
Location: Botosani
Old 06-23-2020 , 03:11   Help for script..
Reply With Quote #1

Hey, I would like you to help me a little.. I would like the last 2 weapons to be just for VIP and if he doesn't have a vip, a message will come in chat... what code should i put?

Code:
menu_additem(Menu, "\rM4A1", "1", 0)
		menu_additem(Menu, "\rAK47", "2", 0)
		menu_additem(Menu, "M3", "3", 0)
		menu_additem(Menu, "Aug", "4", 0)
		menu_additem(Menu, "Famas", "5", 0)
		menu_additem(Menu, "\rMP5 Navy \w- \r[\yACCES V.I.P\r]", "6", VIP_LEVEL_ACCES)
		menu_additem(Menu, "\rXM1014 \w- \r[\yACCES V.I.P\r]", "7", VIP_LEVEL_ACCES)
		
		menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL);
		menu_display(id, Menu, 0);
Aleku. is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 06-23-2020 , 05:57   Re: Help for script..
Reply With Quote #2

Code:
        menu_additem(Menu, "\rM4A1", "1")         menu_additem(Menu, "\rAK47", "2")         menu_additem(Menu, "M3", "3")         menu_additem(Menu, "Aug", "4")         menu_additem(Menu, "Famas", "5")         if(get_user_flags(id) & VIP_LEVEL_ACCES)         {             menu_additem(Menu, "\rMP5 Navy \w- \r[\yACCES V.I.P\r]", "6")             menu_additem(Menu, "\rXM1014 \w- \r[\yACCES V.I.P\r]", "7")         }                 menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL);         menu_display(id, Menu, 0);
and you need to do the same thing in the menu handler.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 06-23-2020 at 05:57.
Shadows Adi is offline
Aleku.
Junior Member
Join Date: May 2019
Location: Botosani
Old 06-24-2020 , 07:32   Re: Help for script..
Reply With Quote #3

[QUOTE=Shadows Adi;2706923][pawn]
menu_additem(Menu, "\rM4A1", "1")
menu_additem(Menu, "\rAK47", "2")
menu_additem(Menu, "M3", "3")
menu_additem(Menu, "Aug", "4")
menu_additem(Menu, "Famas", "5")
if(get_user_flags(id) & VIP_LEVEL_ACCES)
{
menu_additem(Menu, "\rMP5 Navy \w- \r[\yACCES V.I.P\r]", "6")
menu_additem(Menu, "\rXM1014 \w- \r[\yACCES V.I.P\r]", "7")
}

menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, Menu, 0);


Sorry, but you could like that when you're not a VIP to show you the menu but can't you take it?

In this code, if you don't have a VIP, they don't show you the weapons from the VIP, I want them to appear but they can't take them.
Aleku. is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 06-24-2020 , 08:25   Re: Help for script..
Reply With Quote #4

Quote:
Originally Posted by Aleku. View Post
Sorry, but you could like that when you're not a VIP to show you the menu but can't you take it?

In this code, if you don't have a VIP, they don't show you the weapons from the VIP, I want them to appear but they can't take them.
Then put
Code:
if(get_user_flags(id) & VIP_LEVEL_ACCES)
in the handler of menu.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-24-2020 , 23:12   Re: Help for script..
Reply With Quote #5

Quote:
Originally Posted by Aleku. View Post
I want them to appear but they can't take them.
The proper way to handle this is to use callbacks like I said in my previous post. It should be quite simple actually. The callback function would only need to be a single line:

Code:
public menuitem_callback( id, menu, item )
{
	return (get_user_flags(id) & VIP_LEVEL_ACCESS) ? ITEM_IGNORE : ITEM_DISABLED;
}
Doing it this way will show the items but they will be grey and they can't be selected. So, it will be obvious that they exist but can't be chosen.
__________________

Last edited by fysiks; 06-24-2020 at 23:20.
fysiks is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 06-26-2020 , 09:18   Re: Help for script..
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
The proper way to handle this is to use callbacks like I said in my previous post. It should be quite simple actually. The callback function would only need to be a single line:

Code:
public menuitem_callback( id, menu, item )
{
	return (get_user_flags(id) & VIP_LEVEL_ACCESS) ? ITEM_IGNORE : ITEM_DISABLED;
}
Doing it this way will show the items but they will be grey and they can't be selected. So, it will be obvious that they exist but can't be chosen.
and btw dw bcs i didn't say about you about the thing with Wronger, you showed also another simple method that can be super simple used but not everytime is needed a callback
AnimalMonster is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-23-2020 , 20:28   Re: Help for script..
Reply With Quote #7

You can use a menu callback if you want to have the items shown but be disabled if they don't have the requisite flag. Callback example found here.

If you want them to see a chat message then you have to let them select the item and then check their flags in the handler and show the message if needed. Optionally, you can re-show the menu if you want.
__________________
fysiks is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 06-26-2020 , 09:10   Re: Help for script..
Reply With Quote #8

Aleku. they said wronger than you , you did good but did you define that value?
PHP Code:
#define VIP_LEVEL_ACCES ADMIN_.... 
If you did then idk, you can make in other way like in the handle
and if you didn't ,do it and your code will be working
PHP Code:
case x: if(get_user_flags(id) & VIP_LEVEL_ACCESS)
{
        
giveitem(id)
}
else 
client_print(id,print_chat,"Not Vip Member"
and btw for everyone is the next message
Every if(get_user_flags(id) & x) has to do a else after you wrote the code because then the code will let anyone use it bcs it's like without else it's creating a invisible one that does the same thing, i found out this thing when i was doing my menu. and btw you could also do like this
PHP Code:
if(get_user_flags(id) & VIP_LEVEL_ACCESS)
{
menu_additem(Menu,"lala","key")
}
else 
menu_additem(Menu,"\dlala",""
as you seen in the third param i didn't put anything else than "" so the item would do nothing and that /d will make the item look like it can't be accesed.

Last edited by AnimalMonster; 06-26-2020 at 09:12.
AnimalMonster is offline
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-26-2020 , 09:27   Re: Help for script..
Reply With Quote #9

Quote:
Originally Posted by AnimalMonster View Post
Every if(get_user_flags(id) & x) has to do a else after you wrote the code because then the code will let anyone use it bcs it's like without else it's creating a invisible one that does the same thing, i found out this thing when i was doing my menu.
This is the funniest thing I heard, I know that you are new in coding, and that you want to show yourself, but veterans in here have more than 5 years of coding experience, so you can't teach them, what you said is not true, it will just skip that action for player who doesn't have required flags. In this case it just won't show that 2 menu items.
__________________
Contact! || Discord:
Mr_Boopsy_#2066

Last edited by supertrio17; 06-26-2020 at 09:28.
supertrio17 is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 06-26-2020 , 09:34   Re: Help for script..
Reply With Quote #10

Quote:
Originally Posted by supertrio17 View Post
This is the funniest thing I heard, I know that you are new in coding, and that you want to show yourself, but veterans in here have more than 5 years of coding experience, so you can't teach them, what you said is not true, it will just skip that action for player who doesn't have required flags. In this case it just won't show that 2 menu items.
man, i made a menu in the new one and it showed the items but they couldn't be accesed and showed the name as can't be accesed when i made my first menu, and please, even if i'm new (3-4 weeks) i already make my own plugin and try use the message.inc natives or stock , what were them ,and the things i said is true bcs at me worked like that if you say that is not true let me go and try make a menu, put on my server that needa addons that i will make and we'll see about that, there are a lot of methods and btw the callbacks can be did in handle directly too and very simple. also im 14 years old.
SOON POSTING A NEW PLUGIN FOR ZP THAT WILL ADD XP AND AT THE SAME TIME MAKE A BUYMENU ON LEVELS

Last edited by AnimalMonster; 06-26-2020 at 09:36.
AnimalMonster 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 17:00.


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