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!