Официалният форум на iPlay.bg 

Форумът е предназначен за всякакви заявки свързани с Counter-Strike или AMX Mod X. Заявки за редакции на плъгини също може да се пускат тук.
Правила на форума: ПРОЧЕТИ ПРЕДИ ДА ПУСНЕШ ТЕМА!!!

Не ползвай този раздел ако заявката ти съответства с някой от под-разделите най-отгоре!
Заявки за изработка на плъгини, заявки за преработка на плъгини и заявки за ресурси за играта не се пускат в този раздел!
 #410100  от dbnZ ``
 пет фев 24, 2017 2:06 am
Код: Избери всички
#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[] = "[email protected]#$&=}{";

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);
}
1.При печалба на евент даването на пари да бъде премахнато.
2.Да не дава "Full Pack Grenadas" а по единично гранатата оделно, флашката оделно и смока (frost-a) също.
3.При печалба даването на кръв да е +50 живот(hp)
 #410104  от OciXCrom™
 пет фев 24, 2017 2:14 am
Кваровете за украса ли са сложени? Видя ли какво пише горе или не е достатъчно голям шрифтът?