Raised This Month: $ Target: $400
 0% 

Help for [ZP]Reward menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Abiss32
Junior Member
Join Date: Dec 2018
Old 01-22-2019 , 17:31   Re: Help for [ZP]Reward menu
Reply With Quote #5

Ok it actually works but I don't know how to set the reward to be taken only once and the 2nd thing is the i put a messages if have the requirements and if you don't have them... but if you have 0 kills left the both messages pop up how to prevent the false trigger to happen?

Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#include <zombieplague>
#include <zp_buymenu>

#define PLUGIN "[ZP]Mission Rewards"
#define VERSION "1.0"
#define AUTHOR "real<Abiss>"


new const g_szrewardsMenuItems[][] =
{

	"\y[5 Kills][+3 Exp]",

	"\y[7 Kills][+5 Exp]",

	"\y[10 Kills][+35000$]^n",

	"\y[20 Kills][+20 Gold]"
}
public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)

	register_concmd("Reward_Menu", "rewards")
}

public rewards(id)
{

	new iMenuID = menu_create("\rRewards Menu \w:", "rewardsMenuHandle")

	for(new i=0; i<sizeof(g_szrewardsMenuItems); i++) menu_additem(iMenuID, g_szrewardsMenuItems[i])

	menu_display(id, iMenuID)

}
public rewardsMenuHandle(id, iMenuID, iItem)
{
	switch(iItem)
	{
		case 0:
		{
			new iNum = 5
			new iFrags = get_user_frags(id);
			if(iFrags == iNum)
			{
				new current = zp_get_user_exp(id)
				zp_set_user_exp(id, current+3)
				ColorChat(id, TEAM_COLOR, "Mission Completed!")
			}
			if(iFrags > iNum)
			{
				new current = zp_get_user_exp(id)	
				zp_set_user_exp(id, current+3)
				ColorChat(id, TEAM_COLOR, "Mission Completed!")
			}
			else
			{
				new iFragsLeft = iFrags-iNum;
				ColorChat(id, TEAM_COLOR, "Mission requierments not faced %i kills left!", iFragsLeft)
			}
		}
		case 1:
		{
			new iNum = 7
			new iFrags = get_user_frags(id);
			new current = zp_get_user_exp(id)
			if(iFrags == iNum)
			{
				zp_set_user_exp(id, current+5)
				ColorChat(id, TEAM_COLOR, "Mission Completed!")
			}
			if(iFrags > iNum)
			{
				zp_set_user_exp(id, current+5)
				ColorChat(id, TEAM_COLOR, "Mission Completed!")
			}
			else
			{
				new iFragsLeft = iFrags-iNum;
				ColorChat(id, TEAM_COLOR, "Mission requierments not faced %i kills left!", iFragsLeft)
			}
		}
		case 2: 
		{
			new iNum = 10
			new iFrags = get_user_frags(id);
			new current = zp_cs_get_user_money(id)
			if(iFrags == iNum)
			{
				zp_cs_set_user_money(id, current+35000)
				ColorChat(id, TEAM_COLOR, "Mission Completed!")
			}
			if(iFrags > iNum)
			{
				zp_cs_set_user_money(id, current+35000)
				ColorChat(id, TEAM_COLOR, "Mission Completed!")
			}
			else
			{
				new iFragsLeft = iFrags-iNum;
				ColorChat(id, TEAM_COLOR, "Mission requierments not faced %i kills left!", iFragsLeft)
			}
		}
		case 3:
		{
			new iNum = 20
			new iFrags = get_user_frags(id);
			new current = zp_get_user_ammo_packs(id)
			if(iFrags == iNum)
			{
				zp_set_user_ammo_packs(id, current+20)
				ColorChat(id, TEAM_COLOR, "Mission Completed!")
			}
			if(iFrags > iNum)
			{
				zp_set_user_ammo_packs(id, current+20)
				ColorChat(id, TEAM_COLOR, "Mission Completed!")
			}
			else
			{
				new iFragsLeft = iFrags-iNum;
				ColorChat(id, TEAM_COLOR, "Mission requierments not faced %i kills left!", iFragsLeft)
			}
		}
	}
	return PLUGIN_HANDLED

}
And also thanks for helping!

Last edited by Abiss32; 01-22-2019 at 17:33.
Abiss32 is offline
 



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:31.


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