Raised This Month: $ Target: $400
 0% 

[Help]Menu edit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 11-15-2010 , 22:31   [Help]Menu edit
Reply With Quote #1

Hi guys, i'm new on this forum (althoug i am a common guest for almost 2 years) and i have a little request if you might help me.

i have this plugin (attachment)


originaly it had 19 items to purchase, i did removed what i didn't need, but i have 2 little problems.

1) the menu it is like this:
1.item 1
2.item 2
...
7.item 7
8.back
9.next
0.exit

i tryed to remove some functions in shophandler but with no succes. when i removed the items i didn't need, i have only 9 .. so i don't realy need back si next. And i can't delete them from code.

2) in public give_respawn i did something like this

Code:
if (kills >= cost && !is_user_alive(id))
	{
                if(!(get_user_flags(id) & ADMIN_BAN))
                {
		if(cs_get_user_team(id) == CS_TEAM_T)
		{
			cs_user_spawn(id)
			cs_set_user_team(id, 1)
	         }
		 
		else if(cs_get_user_team(id) == CS_TEAM_CT)
		{
			cs_user_spawn(id)
			cs_set_user_team(id, 2)
		}
                }
		ColorChat(id, GREEN, "^x01[AMXX] ^x04%L", id, "GIVERESPAWN")
	}
i don't want admins to can buy this item when they are dead because when they are dead, they won't respawn corectly (they can see both teams so they are actualy a sort of spectators)

sorry for my bad english, please help if you can.
Cheers

edit: sorry fysiks, i edited my post, hope this is better
Attached Files
File Type: sma Get Plugin or Get Source (shop.sma - 523 views - 19.2 KB)

Last edited by EDUTz; 11-15-2010 at 23:21. Reason: attach sma.
EDUTz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-15-2010 , 23:11   Re: [Help]Menu edit
Reply With Quote #2

For 1), you would need to switch to back to the basic menu method.



Quote:
Originally Posted by EDUTz View Post
Hi guys, i'm new on this forum
Ok, so this is your warning, post a plugin as an attachment if it's more than a few hundred lines long (for the sake of my sanity).
__________________

Last edited by fysiks; 11-15-2010 at 23:14.
fysiks is offline
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 11-16-2010 , 01:16   Re: [Help]Menu edit
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
For 1), you would need to switch to back to the basic menu method.
easy to said than done, i am so noob in scripting. Although i learnead "pascal" language in school, c++ is a little different than what i do know. so i actualy don't realy know how to rebuild the menu. i just tried to remove some of the functions with no success ... i realize that i have to learn more, but for the moment this is my level. sorry for me it's 100 time harder to rebuild the menu than you guys. if you can help, please do so, else don't punish me 'cause i don't know scripting. i just want your help.

ps: i edited my first post, as fysiks said, i hope that's ok now
EDUTz is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-16-2010 , 16:39   Re: [Help]Menu edit
Reply With Quote #4

To remove pagination, use the following code:
Code:
menu_setprop(menu, MPROP_PERPAGE, 0);
Also, you should note that the plugin is really poorly coded.

A small edit of the give_respawn function, and I came up with this for you:
Code:
public give_respawn(id)
{
	if(is_user_alive(id))
	{
		ColorChat(id, GREEN, "^x01[AMXX] ^x04%L", id, "ALIVE")
		return;
	}

	new cost = get_pcvar_num(respawncost)
	
	if ( (get_user_flags(id) & ADMIN_BAN) && (kills >= cost || randomn[id] == true) )
	{
		if(cs_get_user_team(id) == CS_TEAM_T)
		{
			cs_user_spawn(id)
			cs_set_user_team(id, 1)
		}
		 
		else if(cs_get_user_team(id) == CS_TEAM_CT)
		{
			cs_user_spawn(id)
			cs_set_user_team(id, 2)
		}
		ColorChat(id, GREEN, "^x01[AMXX] ^x04%L", id, "GIVERESPAWN")

	}
	
	else
	{
		ColorChat(id, RED, "^x01[AMXX] ^x03%L", id, "NOBUY")
	}
}
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-16-2010 , 20:28   Re: [Help]Menu edit
Reply With Quote #5

Quote:
Originally Posted by Emp` View Post
To remove pagination, use the following code:
Code:
menu_setprop(menu, MPROP_PERPAGE, 0);
Wow, totally didn't think that worked for some reason. I guess that makes life easier .
__________________
fysiks is offline
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 11-17-2010 , 04:53   Re: [Help]Menu edit
Reply With Quote #6

thank you fo helping me.
It seem that does the trick, altough the exit menu doesn't show up.

Quote:
Also, you should note that the plugin is really poorly coded.
yes, i know. I noticed that when i'm dead and in free look, it respawns me but i'm still in free look and it says something like you're stuck ...
EDUTz is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-17-2010 , 13:37   Re: [Help]Menu edit
Reply With Quote #7

Quote:
Originally Posted by EDUTz View Post
It seem that does the trick, altough the exit menu doesn't show up.
A simple way you can add an exit item back would be to do:
Code:
menu_additem(hnsmenu, "Exit", "0", ADMIN_ALL)
And you wouldn't need to edit any of the menu handler function.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 11-18-2010 , 01:51   Re: [Help]Menu edit
Reply With Quote #8

Quote:
Originally Posted by Emp` View Post
A simple way you can add an exit item back would be to do:
Code:
menu_additem(hnsmenu, "Exit", "0", ADMIN_ALL)
And you wouldn't need to edit any of the menu handler function.
But wont it require an edition in the menu handler function
Code:
public menu_handler ( .... ) // ... Lots of code     case 0: menu_destroy( menu_id )
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 11-18-2010 , 03:34   Re: [Help]Menu edit
Reply With Quote #9

thank you for the help. i couldn't do it without you.
Thanks a lot again , you are my hero :*

Last edited by EDUTz; 11-18-2010 at 03:43.
EDUTz 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 11:23.


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