Raised This Month: $51 Target: $400
 12% 

Solved Confusing menu codes >.<


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xExperienced
Member
Join Date: Jun 2017
Location: USA
Old 09-09-2017 , 22:46   Confusing menu codes >.<
Reply With Quote #1

I'm creating a code for weapons.
On round start all players should get a menu to select weapon.
But if client is "T" he should get AK & AWP these 2 choices in menu whereas in "CT" he should get M4A1 & Awp .

I tried but , couldnt create proper plugin.

Here's my code :

Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>

public plugin_init()
{
  
	register_event("HLTV", "show_weapon", "a")  
	#define Keysrod (1<<0)|(1<<1)|(1<<9) // Keys: 1234567890
}

public Showrod(id) 
{
	new CsTeams:Team = cs_get_user_team(id)
	switch (Team)
	{
	case CS_TEAM_T:
		{ 
    show_menu(id, Keysrod, "Select Your Weapon^n\w1.AK47 + Pack ^n\w2. Awp + Pack^n0. Exit^n", 15, "rod") // Display menu
		} 

    case CS_TEAM_CT: 
		{ 
    show_menu(id, Keysrod, "Select Your Weapon^n\w1. M4A1 + Pack ^n\w2. Awp + Pack^n0. Exit^n", 15, "rod") // Display menu
		} 
    case CS_TEAM_SPECTATOR: 
		{ 
		return PLUGIN_HANDLED
		}
	}
}
public Pressedrod(id, key) 
{
	new CsTeams:Team = cs_get_user_team(id) 
	
	if (Team = CS_TEAM_T && key = 1)
		{
			give_item(id,"weapon_ak47")
			give_item(id,"ammo_556nato")
			give_item(id,"ammo_556nato")
			give_item(id,"ammo_556nato")
			give_item(id,"weapon_deagle")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"weapon_knife")
			give_item(id,"weapon_hegrenade")
			give_item(id, "weapon_flashbang");
			give_item(id, "weapon_flashbang");
			give_item(id, "item_assaultsuit");
			give_item(id, "item_thighpack");
		}
	if (Team = CS_TEAM_T && key = 2)
		{
			give_item(id,"weapon_awp")
			give_item(id,"ammo_556nato")
			give_item(id,"ammo_556nato")
			give_item(id,"ammo_556nato")
			give_item(id,"weapon_deagle")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"weapon_knife")
			give_item(id,"weapon_hegrenade")
			give_item(id, "weapon_flashbang");
			give_item(id, "weapon_flashbang");
			give_item(id, "item_assaultsuit");
			give_item(id, "item_thighpack");
		}
	
	if (Team = CS_TEAM_CT && key = 1)
		{
		give_item(id,"weapon_m4a1")
			give_item(id,"ammo_556nato")
			give_item(id,"ammo_556nato")
			give_item(id,"ammo_556nato")
			give_item(id,"weapon_deagle")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"weapon_knife")
			give_item(id,"weapon_hegrenade")
			give_item(id, "weapon_flashbang");
			give_item(id, "weapon_flashbang");
			give_item(id, "item_assaultsuit");
			give_item(id, "item_thighpack");
		}
	
	if (Team = CS_TEAM_CT && key = 2)
		{
		give_item(id,"weapon_awp")
			give_item(id,"ammo_556nato")
			give_item(id,"ammo_556nato")
			give_item(id,"ammo_556nato")
			give_item(id,"weapon_deagle")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"ammo_50ae")
			give_item(id,"weapon_knife")
			give_item(id,"weapon_hegrenade")
			give_item(id, "weapon_flashbang");
			give_item(id, "weapon_flashbang");
			give_item(id, "item_assaultsuit");
			give_item(id, "item_thighpack");
		}
	
	if ( key = 0)
	{
	menu_destroy(Pressedrod);
	}
}

Last edited by xExperienced; 09-11-2017 at 14:15.
xExperienced is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-09-2017 , 22:56   Re: Confusing menu codes >.<
Reply With Quote #2

So, what part doesn't work?
__________________
fysiks is offline
xExperienced
Member
Join Date: Jun 2017
Location: USA
Old 09-09-2017 , 23:03   Re: Confusing menu codes >.<
Reply With Quote #3

menu.sma(12) : warning 217: loose indentation
menu.sma(35) : warning 209: function "Showrod" should return a value
menu.sma(40) : warning 211: possibly unintended assignment
menu.sma(40) : warning 211: possibly unintended assignment\
menu.sma(40) : error 022: mustbe lvalue (non-constant)
menu.sma(40) : warning 215: expression has no effect
menu.sma(40) : error 001: expected token: ";", but found ")"
menu.sma(40) : error 029: invalid expression, assumed zero
menu.sma(40) : fatal error 107: too many error messages on one line


This is the 40th Line
Code:
if (Team = CS_TEAM_T && key = 1)

Last edited by xExperienced; 09-09-2017 at 23:04.
xExperienced is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-09-2017 , 23:44   Re: Confusing menu codes >.<
Reply With Quote #4

Take a look at this.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-10-2017 , 05:06   Re: Confusing menu codes >.<
Reply With Quote #5

To evaluate equality, you must use "==". However, I do recommend wickedd's suggestion because it will allow you to make the logic a bit more straight forward.
__________________
fysiks is offline
xExperienced
Member
Join Date: Jun 2017
Location: USA
Old 09-10-2017 , 07:18   Re: Confusing menu codes >.<
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
To evaluate equality, you must use "==". However, I do recommend wickedd's suggestion because it will allow you to make the logic a bit more straight forward.
I know I should have used "Switch". Since there are 2 conditions to be checked before calling function , Switch can't be used.

See how can I use switch for 2 conditions :

Code:
if (Team = CS_TEAM_T && key = 1)
xExperienced is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-10-2017 , 07:28   Re: Confusing menu codes >.<
Reply With Quote #7

It's ==, not =
__________________
HamletEagle is offline
xExperienced
Member
Join Date: Jun 2017
Location: USA
Old 09-10-2017 , 07:34   Re: Confusing menu codes >.<
Reply With Quote #8

Yes. I made changes but still there are 4 errors.
xExperienced is offline
xExperienced
Member
Join Date: Jun 2017
Location: USA
Old 09-10-2017 , 07:38   Re: Confusing menu codes >.<
Reply With Quote #9

menu.sma(12) : warning 217: loose indentation
menu.sma(35) : warning 209: function "Showrod" should return a value
menu.sma(86) : warning 217: loose indentation
menu.sma(108 ) : warning 217: loose indentation
menu.sma(129) : error 029: invalid expression, assumed zero
menu.sma(129) : error 035: argument type mismatch (argument 1)


129 th Line :
Code:
menu_destroy(Pressedrod);

Last edited by xExperienced; 09-10-2017 at 07:38.
xExperienced is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-10-2017 , 09:55   Re: Confusing menu codes >.<
Reply With Quote #10

Do you really think the code you posted will work? It's obvious you copied and pasted it together. So I suggest you go back to the VIP plugin where you got the code and start over.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd 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 09:08.


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