can someone add XP rewards?

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Заключена
Потребителски аватар

Автор на темата
cant be killed
Foreigner
Foreigner
Мнения: 3
Регистриран: 19 апр 2019, 10:48

can someone add XP rewards?

Мнение от cant be killed » 19 апр 2019, 10:54

Код: Избери всички

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <dhudmessage>
#include <colorchat>

#pragma semicolon 1
#pragma ctrlchar  '\'

#define PLUGIN "Fast Event"
#define VERSION "1.0"
#define AUTHOR "hackera457"

#define MAX_LENGTH  8

#define TASK_END_EVENT 111258

enum _:eSettings{
	
	EVENT_START_TIME,
	EVENT_REWARD_MONEY,
	EVENT_REWARD_HP,
	EVENT_REWARD_GRENADES,
	EVENT_HUD_COLOR,
	EVENT_HUD_COORDX,
	EVENT_HUD_COORDY,
	EVENT_HUD_HOLD_TIME
};

new g_szChars[] = "abcdefghijklmnopqrstuvwxyz0123456789.!@#$&=}{";

new g_szGrenades[]={
	
	"weapon_hegrenade",
	"weapon_flashbang",
	"weapon_smokegrenade"
};

new g_szRandomString[MAX_LENGTH];
new g_szCvarSettings[eSettings];

new bool:g_bIsEventStart;
new bool:g_bIsAnswered[33];

public plugin_init() {
	
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_clcmd( "say","cmdSay");
	register_clcmd("say_team","cmdSay");
	
	g_szCvarSettings[EVENT_START_TIME] = register_cvar("fastevent_start_time","120.0");
	g_szCvarSettings[EVENT_REWARD_MONEY] = register_cvar("fastevent_reward_money","2500");
	g_szCvarSettings[EVENT_REWARD_HP] = register_cvar("fastevent_reward_hp","100");
	g_szCvarSettings[EVENT_REWARD_GRENADES] = register_cvar("fastevent_reward_grenades","1");
	g_szCvarSettings[EVENT_HUD_COLOR] = register_cvar("fastevent_hud_color","0 255 0");
	g_szCvarSettings[EVENT_HUD_COORDX] = register_cvar("fastevent_hud_coordX","0.04");
	g_szCvarSettings[EVENT_HUD_COORDY] = register_cvar("fastevent_hud_coordY","0.73");
	g_szCvarSettings[EVENT_HUD_HOLD_TIME] = register_cvar("fastevent_hud_hold_time","12.0");
	
	
	set_task(get_pcvar_float(g_szCvarSettings[EVENT_START_TIME]),"StartEvent",_,_,_,"b");
	
}

public client_connect(id)
{
	g_bIsAnswered[id] = false;
}

public StartEvent()
{
	g_bIsEventStart = true;
	
	GenerateString(g_szChars, charsmax(g_szChars),g_szRandomString, charsmax(g_szRandomString));
	
	new szColors[16];
	new szRed[4], szGreen[4], szBlue[4]; 
	new iRed, iGreen, iBlue;
	
	get_pcvar_string(g_szCvarSettings[EVENT_HUD_COLOR], szColors, charsmax(szColors));
	parse(szColors, szRed, charsmax(szRed), szGreen, charsmax(szGreen), szBlue, charsmax(szBlue));
	
	iRed = str_to_num(szRed); 
	iGreen = str_to_num(szGreen); 
	iBlue = str_to_num(szBlue);
	
	set_task(15.0,"EndEvent",TASK_END_EVENT,_,_,"b");
	
	set_dhudmessage(iRed,iGreen,iBlue,get_pcvar_float(g_szCvarSettings[EVENT_HUD_COORDX]),get_pcvar_float(g_szCvarSettings[EVENT_HUD_COORDY]),1,6.0,get_pcvar_float(g_szCvarSettings[EVENT_HUD_HOLD_TIME]));
	show_dhudmessage(0,"[FastEvent] Type in the following symbols to win: %s",g_szRandomString);	
		
}

public cmdSay(id)
{

	if(g_bIsEventStart)
	{
		new szSaid[ 192 ], szName[32];
		read_args( szSaid, charsmax( szSaid ) );
		remove_quotes( szSaid );
		trim( szSaid );
	
		if( equali( szSaid, "" ) )
			return PLUGIN_HANDLED;
			
		if(g_bIsAnswered[id])
		{
			ColorChat(id,TEAM_COLOR,"\1[\4FastEvent\1] You already answered and you can answer again on the next event!");
			return PLUGIN_HANDLED;
		}
		else
		{
		
			if(equali(szSaid,g_szRandomString))
			{
				g_bIsAnswered[id] = true;
			
				get_user_name(id,szName,charsmax(szName));
			
				switch(random_num(0,2))
				{
					case 0: 
					{
						cs_set_user_money(id,cs_get_user_money(id)+get_pcvar_num(g_szCvarSettings[EVENT_REWARD_MONEY]));
						
						ColorChat(0,TEAM_COLOR,"\1[\4FastEvent\1] Player \4%s\1 won \4%i$\1!",szName,get_pcvar_num(g_szCvarSettings[EVENT_REWARD_MONEY]));
					}
					case 1: 
					{
						fm_set_user_health(id,fm_get_user_health(id)+get_pcvar_num(g_szCvarSettings[EVENT_REWARD_HP]));
						
						ColorChat(0,TEAM_COLOR,"\1[\4FastEvent\1] Player \4%s\1 won \4+%i HP\1!",szName,get_pcvar_num(g_szCvarSettings[EVENT_REWARD_HP]));
					}
					case 2:
					{
						if(!get_pcvar_num(g_szCvarSettings[EVENT_REWARD_GRENADES]))
							return PLUGIN_HANDLED;
						
						for(new j=0;j < sizeof(g_szGrenades);j++)
							give_item(id,g_szGrenades[j]);
							
						ColorChat(0,TEAM_COLOR,"\1[\4FastEvent\1] Player \4%s\1 won \4Full Grenade Pack\1!",szName);
					}
				}
				
			
			}
			else
			{
				g_bIsAnswered[id] = true;
			
				ColorChat(id,TEAM_COLOR,"\1[\4FastEvent\1] Your answer is incorrect! You can try again on the next event!");
			}
		
		}
	}
	
	return PLUGIN_CONTINUE;		
}

public EndEvent()
{
	if(task_exists(TASK_END_EVENT))
		remove_task(TASK_END_EVENT);
		
	g_bIsEventStart = false;
	
	new iPlayers[32],iNum;
	
	get_players(iPlayers,iNum,"ch");
	
	for(new i=0; i < iNum;i++)
		g_bIsAnswered[iPlayers[i]] = false;
}

stock GenerateString(const choices[], const num_choices, output[], const len)
{
    for(new i = 0; i < len; i++)
    {
        output[i] = choices[random(num_choices)];
    }
    
    return len;
}

stock fm_set_user_health(index, health)
{
   set_pev(index, pev_health, float(health));
   return 1;
}

stock fm_get_user_health(index)
{
   return pev(index, pev_health);
}
https://www.amxx-bg.info/viewtopic.php?f=21&t=4478

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5285
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 73 пъти
Получена благодарност: 541 пъти
Години: 21
Контакти:

can someone add XP rewards?

Мнение от OciXCrom TM » 19 апр 2019, 14:01

Add fastevent = 5 in the [XP Rewards] section in RankSystem.ini, where 5 is the amount of XP players will receive from the event.

Код: Избери всички

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <colorchat>
#include <crxranks>

#if AMXX_VERSION_NUM < 183
	#include <dhudmessage>
#endif

#pragma ctrlchar  '\'

#define PLUGIN "Fast Event"
#define VERSION "1.0"
#define AUTHOR "hackera457"

#define MAX_LENGTH  8

#define TASK_END_EVENT 111258

enum _:eSettings{

	EVENT_START_TIME,
	EVENT_REWARD_MONEY,
	EVENT_REWARD_HP,
	EVENT_REWARD_GRENADES,
	EVENT_HUD_COLOR,
	EVENT_HUD_COORDX,
	EVENT_HUD_COORDY,
	EVENT_HUD_HOLD_TIME
};

new g_szChars[] = "abcdefghijklmnopqrstuvwxyz0123456789.!@#$&=}{";

new g_szGrenades[]={

	"weapon_hegrenade",
	"weapon_flashbang",
	"weapon_smokegrenade"
};

new g_szRandomString[MAX_LENGTH];
new g_szCvarSettings[eSettings];

new bool:g_bIsEventStart;
new bool:g_bIsAnswered[33];

public plugin_init() {

	register_plugin(PLUGIN, VERSION, AUTHOR);

	register_clcmd( "say","cmdSay");
	register_clcmd("say_team","cmdSay");

	g_szCvarSettings[EVENT_START_TIME] = register_cvar("fastevent_start_time","120.0");
	g_szCvarSettings[EVENT_REWARD_MONEY] = register_cvar("fastevent_reward_money","2500");
	g_szCvarSettings[EVENT_REWARD_HP] = register_cvar("fastevent_reward_hp","100");
	g_szCvarSettings[EVENT_REWARD_GRENADES] = register_cvar("fastevent_reward_grenades","1");
	g_szCvarSettings[EVENT_HUD_COLOR] = register_cvar("fastevent_hud_color","0 255 0");
	g_szCvarSettings[EVENT_HUD_COORDX] = register_cvar("fastevent_hud_coordX","0.04");
	g_szCvarSettings[EVENT_HUD_COORDY] = register_cvar("fastevent_hud_coordY","0.73");
	g_szCvarSettings[EVENT_HUD_HOLD_TIME] = register_cvar("fastevent_hud_hold_time","12.0");


	set_task(get_pcvar_float(g_szCvarSettings[EVENT_START_TIME]),"StartEvent",_,_,_,"b");

}

public client_connect(id)
{
	g_bIsAnswered[id] = false;
}

public StartEvent()
{
	g_bIsEventStart = true;

	GenerateString(g_szChars, charsmax(g_szChars),g_szRandomString, charsmax(g_szRandomString));

	new szColors[16];
	new szRed[4], szGreen[4], szBlue[4];
	new iRed, iGreen, iBlue;

	get_pcvar_string(g_szCvarSettings[EVENT_HUD_COLOR], szColors, charsmax(szColors));
	parse(szColors, szRed, charsmax(szRed), szGreen, charsmax(szGreen), szBlue, charsmax(szBlue));

	iRed = str_to_num(szRed);
	iGreen = str_to_num(szGreen);
	iBlue = str_to_num(szBlue);

	set_task(15.0,"EndEvent",TASK_END_EVENT,_,_,"b");

	set_dhudmessage(iRed,iGreen,iBlue,get_pcvar_float(g_szCvarSettings[EVENT_HUD_COORDX]),get_pcvar_float(g_szCvarSettings[EVENT_HUD_COORDY]),1,6.0,get_pcvar_float(g_szCvarSettings[EVENT_HUD_HOLD_TIME]));
	show_dhudmessage(0,"[FastEvent] Type in the following symbols to win: %s",g_szRandomString);

}

public cmdSay(id)
{

	if(g_bIsEventStart)
	{
		new szSaid[ 192 ], szName[32];
		read_args( szSaid, charsmax( szSaid ) );
		remove_quotes( szSaid );
		trim( szSaid );

		if( equali( szSaid, "" ) )
			return PLUGIN_HANDLED;

		if(g_bIsAnswered[id])
		{
			ColorChat(id,TEAM_COLOR,"\1[\4FastEvent\1] You already answered and you can answer again on the next event!");
			return PLUGIN_HANDLED;
		}
		else
		{

			if(equali(szSaid,g_szRandomString))
			{
				g_bIsAnswered[id] = true;

				get_user_name(id,szName,charsmax(szName));

				switch(random_num(0,3))
				{
					case 0:
					{
						cs_set_user_money(id,cs_get_user_money(id)+get_pcvar_num(g_szCvarSettings[EVENT_REWARD_MONEY]));

						ColorChat(0,TEAM_COLOR,"\1[\4FastEvent\1] Player \4%s\1 won \4%i$\1!",szName,get_pcvar_num(g_szCvarSettings[EVENT_REWARD_MONEY]));
					}
					case 1:
					{
						fm_set_user_health(id,fm_get_user_health(id)+get_pcvar_num(g_szCvarSettings[EVENT_REWARD_HP]));

						ColorChat(0,TEAM_COLOR,"\1[\4FastEvent\1] Player \4%s\1 won \4+%i HP\1!",szName,get_pcvar_num(g_szCvarSettings[EVENT_REWARD_HP]));
					}
					case 2:
					{
						if(!get_pcvar_num(g_szCvarSettings[EVENT_REWARD_GRENADES]))
							return PLUGIN_HANDLED;

						for(new j=0;j < sizeof(g_szGrenades);j++)
							give_item(id,g_szGrenades[j]);

						ColorChat(0,TEAM_COLOR,"\1[\4FastEvent\1] Player \4%s\1 won \4Full Grenade Pack\1!",szName);
					}
					case 3:
					{
						ColorChat(0,TEAM_COLOR,"\1[\4FastEvent\1] Player \4%s\1 won \4%i XP\1!",szName,crxranks_give_user_xp(id, _, "fastevent"));
					}
				}


			}
			else
			{
				g_bIsAnswered[id] = true;

				ColorChat(id,TEAM_COLOR,"\1[\4FastEvent\1] Your answer is incorrect! You can try again on the next event!");
			}

		}
	}

	return PLUGIN_CONTINUE;
}

public EndEvent()
{
	if(task_exists(TASK_END_EVENT))
		remove_task(TASK_END_EVENT);

	g_bIsEventStart = false;

	new iPlayers[32],iNum;

	get_players(iPlayers,iNum,"ch");

	for(new i=0; i < iNum;i++)
		g_bIsAnswered[iPlayers[i]] = false;
}

stock GenerateString(const choices[], const num_choices, output[], const len)
{
    for(new i = 0; i < len; i++)
    {
        output[i] = choices[random(num_choices)];
    }

    return len;
}

stock fm_set_user_health(index, health)
{
   set_pev(index, pev_health, float(health));
   return 1;
}

stock fm_get_user_health(index)
{
   return pev(index, pev_health);
}

Потребителски аватар

Автор на темата
cant be killed
Foreigner
Foreigner
Мнения: 3
Регистриран: 19 апр 2019, 10:48

can someone add XP rewards?

Мнение от cant be killed » 19 апр 2019, 15:45

can someone change the limit of answer to no limit ?

Потребителски аватар

OciXCrom TM
Администратор
Администратор
Мнения: 5285
Регистриран: 06 окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 73 пъти
Получена благодарност: 541 пъти
Години: 21
Контакти:

can someone add XP rewards?

Мнение от OciXCrom TM » 19 апр 2019, 15:49

Код: Избери всички

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <colorchat>
#include <crxranks>

#if AMXX_VERSION_NUM < 183
	#include <dhudmessage>
#endif

#pragma ctrlchar  '\'

#define PLUGIN "Fast Event"
#define VERSION "1.0"
#define AUTHOR "hackera457"

#define MAX_LENGTH  8

#define TASK_END_EVENT 111258

enum _:eSettings{

	EVENT_START_TIME,
	EVENT_REWARD_MONEY,
	EVENT_REWARD_HP,
	EVENT_REWARD_GRENADES,
	EVENT_HUD_COLOR,
	EVENT_HUD_COORDX,
	EVENT_HUD_COORDY,
	EVENT_HUD_HOLD_TIME
};

new g_szChars[] = "abcdefghijklmnopqrstuvwxyz0123456789.!@#$&=}{";

new g_szGrenades[]={

	"weapon_hegrenade",
	"weapon_flashbang",
	"weapon_smokegrenade"
};

new g_szRandomString[MAX_LENGTH];
new g_szCvarSettings[eSettings];

new bool:g_bIsEventStart;
new bool:g_bIsAnswered[33];

public plugin_init() {

	register_plugin(PLUGIN, VERSION, AUTHOR);

	register_clcmd( "say","cmdSay");
	register_clcmd("say_team","cmdSay");

	g_szCvarSettings[EVENT_START_TIME] = register_cvar("fastevent_start_time","120.0");
	g_szCvarSettings[EVENT_REWARD_MONEY] = register_cvar("fastevent_reward_money","2500");
	g_szCvarSettings[EVENT_REWARD_HP] = register_cvar("fastevent_reward_hp","100");
	g_szCvarSettings[EVENT_REWARD_GRENADES] = register_cvar("fastevent_reward_grenades","1");
	g_szCvarSettings[EVENT_HUD_COLOR] = register_cvar("fastevent_hud_color","0 255 0");
	g_szCvarSettings[EVENT_HUD_COORDX] = register_cvar("fastevent_hud_coordX","0.04");
	g_szCvarSettings[EVENT_HUD_COORDY] = register_cvar("fastevent_hud_coordY","0.73");
	g_szCvarSettings[EVENT_HUD_HOLD_TIME] = register_cvar("fastevent_hud_hold_time","12.0");


	set_task(get_pcvar_float(g_szCvarSettings[EVENT_START_TIME]),"StartEvent",_,_,_,"b");

}

public client_connect(id)
{
	g_bIsAnswered[id] = false;
}

public StartEvent()
{
	g_bIsEventStart = true;

	GenerateString(g_szChars, charsmax(g_szChars),g_szRandomString, charsmax(g_szRandomString));

	new szColors[16];
	new szRed[4], szGreen[4], szBlue[4];
	new iRed, iGreen, iBlue;

	get_pcvar_string(g_szCvarSettings[EVENT_HUD_COLOR], szColors, charsmax(szColors));
	parse(szColors, szRed, charsmax(szRed), szGreen, charsmax(szGreen), szBlue, charsmax(szBlue));

	iRed = str_to_num(szRed);
	iGreen = str_to_num(szGreen);
	iBlue = str_to_num(szBlue);

	set_task(15.0,"EndEvent",TASK_END_EVENT,_,_,"b");

	set_dhudmessage(iRed,iGreen,iBlue,get_pcvar_float(g_szCvarSettings[EVENT_HUD_COORDX]),get_pcvar_float(g_szCvarSettings[EVENT_HUD_COORDY]),1,6.0,get_pcvar_float(g_szCvarSettings[EVENT_HUD_HOLD_TIME]));
	show_dhudmessage(0,"[FastEvent] Type in the following symbols to win: %s",g_szRandomString);

}

public cmdSay(id)
{

	if(g_bIsEventStart)
	{
		new szSaid[ 192 ], szName[32];
		read_args( szSaid, charsmax( szSaid ) );
		remove_quotes( szSaid );
		trim( szSaid );

		if( equali( szSaid, "" ) )
			return PLUGIN_HANDLED;

		if(equali(szSaid,g_szRandomString))
		{
			g_bIsAnswered[id] = true;

			get_user_name(id,szName,charsmax(szName));

			switch(random_num(0,3))
			{
				case 0:
				{
					cs_set_user_money(id,cs_get_user_money(id)+get_pcvar_num(g_szCvarSettings[EVENT_REWARD_MONEY]));

					ColorChat(0,TEAM_COLOR,"\1[\4FastEvent\1] Player \4%s\1 won \4%i$\1!",szName,get_pcvar_num(g_szCvarSettings[EVENT_REWARD_MONEY]));
				}
				case 1:
				{
					fm_set_user_health(id,fm_get_user_health(id)+get_pcvar_num(g_szCvarSettings[EVENT_REWARD_HP]));

					ColorChat(0,TEAM_COLOR,"\1[\4FastEvent\1] Player \4%s\1 won \4+%i HP\1!",szName,get_pcvar_num(g_szCvarSettings[EVENT_REWARD_HP]));
				}
				case 2:
				{
					if(!get_pcvar_num(g_szCvarSettings[EVENT_REWARD_GRENADES]))
						return PLUGIN_HANDLED;

					for(new j=0;j < sizeof(g_szGrenades);j++)
						give_item(id,g_szGrenades[j]);

					ColorChat(0,TEAM_COLOR,"\1[\4FastEvent\1] Player \4%s\1 won \4Full Grenade Pack\1!",szName);
				}
				case 3:
				{
					ColorChat(0,TEAM_COLOR,"\1[\4FastEvent\1] Player \4%s\1 won \4%i XP\1!",szName,crxranks_give_user_xp(id, _, "fastevent"));
				}
			}
		}
	}

	return PLUGIN_CONTINUE;
}

public EndEvent()
{
	if(task_exists(TASK_END_EVENT))
		remove_task(TASK_END_EVENT);

	g_bIsEventStart = false;

	new iPlayers[32],iNum;

	get_players(iPlayers,iNum,"ch");

	for(new i=0; i < iNum;i++)
		g_bIsAnswered[iPlayers[i]] = false;
}

stock GenerateString(const choices[], const num_choices, output[], const len)
{
    for(new i = 0; i < len; i++)
    {
        output[i] = choices[random(num_choices)];
    }

    return len;
}

stock fm_set_user_health(index, health)
{
   set_pev(index, pev_health, float(health));
   return 1;
}

stock fm_get_user_health(index)
{
   return pev(index, pev_health);
}

Потребителски аватар

Автор на темата
cant be killed
Foreigner
Foreigner
Мнения: 3
Регистриран: 19 апр 2019, 10:48

can someone add XP rewards?

Мнение от cant be killed » 19 апр 2019, 16:06

thx it works

Заключена

Върни се в “Заявки за плъгини”

Кой е на линия

Потребители, разглеждащи този форум: Google [Bot] и 1 гост