Modificare schimbare nick in joc

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
sammi1
Membru, skill 0
Membru, skill 0
Posts: 49
Joined: 30 Jan 2021, 22:38
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: Zm.CsPower.Ro
Fond eXtream: 0
Has thanked: 23 times

05 Feb 2021, 04:30

Am un plugin de vip care cand intra un player cu vip arata mesaj cu Vip-ul x s-a conectat pe Server, si vipul daca intra cu alt nick pe sv de exemplu "asd", si in timpul jocului isi schimba numele pe care are vip, in chat scrie Vip-ul asd s-a conectat pe Server, in loc sa scrie numele pe care are vip, scrie numele care-l avea inainte, sper ca s-a inteles la ce ma refer.
Asta e functia de mesaj cand se conecteaza un vip:

if(is_user_vip[id])
{
new namev[32];
get_user_name(id, namev, 31);
ColorChat(0, "!4[BIO-VIP]!1 VIP-ul!3 %s!1 s-a conectat pe server.", namev);
}
else
{
existsInFile[id] = false;
}
}
lexz
Membru, skill +1
Membru, skill +1
Posts: 279
Joined: 02 Nov 2020, 01:57
Detinator Steam: Da
SteamID: profiles/76561198070
Fond eXtream: 0
Discord: lexzor#0630
Has thanked: 19 times
Been thanked: 34 times

05 Feb 2021, 10:59

nu avem ce sa facem cu partea aia de cod.

trimite toata sursa folosind code
CSGO Classy Enhanced V4.1 [400 SKINS | GLOVES | AGENTS | NAME-TAGS] - anunturi/csgo-classy-t373604.html

CSGO Agents - amxmodx/csgo-agents-t372455.html
sammi1
Membru, skill 0
Membru, skill 0
Posts: 49
Joined: 30 Jan 2021, 22:38
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: Zm.CsPower.Ro
Fond eXtream: 0
Has thanked: 23 times

05 Feb 2021, 12:26

Code: Select all

 /*
credite: uclip https://forums.alliedmods.net/showthread.php?p=848357
norecoil: https://www.extreamcs.com/forum/cereri-pluginuri/plugin-norecoil-t291343.html
longjump: from zp40
*/

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <xs>
#include <cstrike>
#include <fun>
#include <biohazard>
#include <dhudmessage>

native set_user_infection_nade(id);

#pragma compress 1

// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------
new const tag[] = "[Biohazard Vip]";	// tagul in chat
new const SOUND_BLINK[] = {"weapons/flashbang-1.wav"};	// sunetul la teleportare
#define ADMIN_ACCES_ADD	ADMIN_IMMUNITY	// accesul de a da vip prin comanda amx_addvip
// --------------------------------------------
//   ------------- DE EDITAT ---------------
// --------------------------------------------

#define PLUGIN_NAME "BIO VIP System"
#define PLUGIN_NAME_PAUSED "BIO VIP System [OPRIT]"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "YONTU"

#define is_user_valid(%1) (1 <= %1 <= max_players)
#define MAX_MONEY 16000
#define MAX_PLAYERS 32
#define TASK_TELEPORT 2718
#define TASK_MADNESS 2781

// weapons offsets
#define OFFSET_CLIPAMMO        51
#define OFFSET_LINUX_WEAPONS    4
#define fm_cs_set_weapon_ammo(%1,%2)    set_pdata_int(%1, OFFSET_CLIPAMMO, %2, OFFSET_LINUX_WEAPONS)

// players offsets
#define m_pActiveItem 373

const DMG_HEGRENADE = (1<<24);
const NOCLIP_WPN_BS = ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4));

enum _:vip_data
{
	name[32],
	password[32]
}

enum cvars
{
	hp_spawn = 0,
	ap_spawn,
	show_vip_tab,
	show_bullet_dmg,
	money_infection,
	health_infection,
	teleport_cd,
	multidamage,
	madness_time,
	leap_cooldown,
	leap_force,
	leap_height,
	admin_show_bullet_dmg,
	model
}

new cvar[cvars];
new max_players;
new g_iPlayerPos[MAX_PLAYERS+1], g_iPlayerCol[MAX_PLAYERS+1];
new cvar_password_field;
new Array:vip_array;
new bool:is_user_vip[MAX_PLAYERS+1], vips_number = 0;
new itemIsChosen[MAX_PLAYERS+1][2];
new g_PowerDelay[33];
new ShockWave, BlueFlare, g_msgBarTime;
new Float:cl_pushangle[33][3], weaponname[32];
new Float:g_lastleaptime[33];

// NU SCHIMBA
new const g_name[] = "name";

new const Float:g_flCoords[][] =  
{ 
	{0.50, 0.40}, 
	{0.56, 0.44}, 
	{0.60, 0.50}, 
	{0.56, 0.56}, 
	{0.50, 0.60}, 
	{0.44, 0.56}, 
	{0.40, 0.50}, 
	{0.44, 0.44} 
}

new const g_iColors[][] = 
{ 
	{0, 127, 255}, // blue 
	{255, 127, 0}, // orange 
	{127, 0, 255}, // purple 
	{255, 0, 0}, // red 
	{255, 100, 150}, // pink
	{0, 255, 0} // green
}

new const g_MaxClipAmmo[] = 
{
    0,
    13, //CSW_P228
    0,
    10, //CSW_SCOUT
    0,  //CSW_HEGRENADE
    7,  //CSW_XM1014
    0,  //CSW_C4
    30,//CSW_MAC10
    30, //CSW_AUG
    0,  //CSW_SMOKEGRENADE
    15,//CSW_ELITE
    20,//CSW_FIVESEVEN
    25,//CSW_UMP45
    30, //CSW_SG550
    35, //CSW_GALIL
    25, //CSW_FAMAS
    12,//CSW_USP
    20,//CSW_GLOCK18
    10, //CSW_AWP
    30,//CSW_MP5NAVY
    100,//CSW_M249
    8,  //CSW_M3
    30, //CSW_M4A1
    30,//CSW_TMP
    20, //CSW_G3SG1
    0,  //CSW_FLASHBANG
    7,  //CSW_DEAGLE
    30, //CSW_SG552
    30, //CSW_AK47
    0,  //CSW_KNIFE
    50//CSW_P90
}

public plugin_init()
{	
	new path[64];
	get_localinfo("amxx_configsdir", path, charsmax(path));
	formatex(path, charsmax(path), "%s/vip_maps.ini", path);
	
	new file = fopen(path, "r+");
	
	if(!file_exists(path))
	{
		write_file(path, "; VIP-UL ESTE DEZACTIVAT PE URMATOARELE HARTI: ");
		write_file(path, "; Exemplu de adaugare HARTA:^n; ^"harta^"^n^nfy_snow^ncss_bycastor");
	}
	
	new mapname[32];
	get_mapname(mapname, charsmax(mapname));
	
	new text[121], maptext[32], bool:remove_vip = false;
	while(!feof(file))
	{
		fgets(file, text, charsmax(text));
		trim(text);
		
		if(text[0] == ';' || !strlen(text)) 
		{
			continue; 
		}
		
		parse(text, maptext, charsmax(maptext));
		
		if(equal(maptext, mapname))
		{
			log_amx("Am dezactivat pluginul 'VIP' pe harta %s.", maptext);
			remove_vip = true;
			break;
		}
		
	}
	fclose(file);

	if(!remove_vip)
	{
		register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);

		register_event("Damage", "event_Damage", "b", "2>0", "3=0");
		register_event("HLTV", "event_NewRound", "a", "1=0", "2=0");
		register_event("DeathMsg", "event_DeathMsg", "a");
		register_event("CurWeapon", "event_CurWeapon", "be", "1=1");
		register_event("ResetHUD", "event_ResetModel", "b");

		RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawnPost", 1);
		RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamagePre");

		for(new i = 1; i <= CSW_P90; i++)
		{
			if(!(NOCLIP_WPN_BS & (1<<i)) && get_weaponname(i, weaponname, 31))
			{
				RegisterHam(Ham_Weapon_PrimaryAttack, weaponname, "fw_PrimaryAttack");
				RegisterHam(Ham_Weapon_PrimaryAttack, weaponname, "fw_PrimaryAttackPost", 1);
			}
		}

		register_forward(FM_PlayerPreThink, "fw_PlayerPreThink");
		register_forward(FM_ClientUserInfoChanged, "fw_Userinfochanged");
		
		register_message(get_user_msgid("ScoreAttrib"), "msg_ScoreAttrib");
		g_msgBarTime = get_user_msgid("BarTime");

		register_clcmd("say /vips", "CmdVipsOnline");
		register_clcmd("say_team /vips", "CmdVipsOnline");
		register_clcmd("say vips", "CmdVipsOnline");
		register_clcmd("say_team vips", "CmdVipsOnline");
		
		register_clcmd("say vip", "CmdPrintAttributes");
		register_clcmd("say_team vip", "CmdPrintAttributes");
		register_clcmd("say /vip", "CmdPrintAttributes");
		register_clcmd("say_team /vip", "CmdPrintAttributes");
		register_clcmd("say wantvip", "CmdPrintAttributes2");
		register_clcmd("say_team wantvip", "CmdPrintAttributes2");
		register_clcmd("say /wantvip", "CmdPrintAttributes2");
		register_clcmd("say_team /wantvip", "CmdPrintAttributes2");

		register_clcmd("say admbenefits", "CmdPrintAttributes3");
		register_clcmd("say_team admbenefits", "CmdPrintAttributes3");
		register_clcmd("say /admbenefits", "CmdPrintAttributes3");
		register_clcmd("say_team /admbenefits", "CmdPrintAttributes3");
		
		register_clcmd("say /boost", "CmdPrintAttributes4");
		register_clcmd("say_team /boost", "CmdPrintAttributes4");

		register_clcmd("say /vm", "cmd_vipmenu");
		register_clcmd("say_team /vm", "cmd_vipmenu");
		register_clcmd("say vm", "cmd_vipmenu");
		register_clcmd("say_team vm", "cmd_vipmenu");
		register_clcmd("say /vipmenu", "cmd_vipmenu");
		register_clcmd("say_team /vipmenu", "cmd_vipmenu");
		register_clcmd("say vipmenu", "cmd_vipmenu");
		register_clcmd("say_team vipmenu", "cmd_vipmenu");

		register_clcmd("drop", "cmd_use_ability");
		
		register_concmd("amx_addvip", "cmd_add_vip", ADMIN_ACCES_ADD, "<nume> <parola> <comentariu>");

		max_players = get_maxplayers();
	}
	else
	{
		register_plugin(PLUGIN_NAME_PAUSED, PLUGIN_VERSION, PLUGIN_AUTHOR);
		pause("ade");
	}
	
	register_cvar("vip_", PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER);
	set_cvar_string("vip_", PLUGIN_VERSION);
}

public plugin_precache()
{
	cvar_password_field = register_cvar("amxx_password_field", "_pw");
	cvar[hp_spawn] = register_cvar("bh_vip_hp_spawn", "200");			// 0 = dezactivat
	cvar[ap_spawn] = register_cvar("bh_vip_ap_spawn", "1");			// 0/1
	cvar[show_vip_tab] = register_cvar("bh_vip_show_tab", "0");			// 0/1
	cvar[show_bullet_dmg] = register_cvar("bh_vip_show_bullet_dmg", "1");	// 0/1
	cvar[money_infection] = register_cvar("bh_vip_infection_money", "200");	// 0 = dezactivat
	cvar[health_infection] = register_cvar("bh_vip_infection_hp", "10");	// 0 = dezactivat
	cvar[teleport_cd] = register_cvar("bh_vip_teleport_cd", "10");
	cvar[multidamage] = register_cvar("bh_vip_multidamage", "50");	// 50 = 0.5, 100 = 1.0, etc
	cvar[madness_time] = register_cvar("bh_vip_madness_time", "3");
	cvar[leap_cooldown] = register_cvar("bh_vip_leap_cd", "5");
	cvar[leap_force] = register_cvar("bh_vip_leap_force", "500");
	cvar[leap_height] = register_cvar("bh_vip_leap_height", "300");
	cvar[admin_show_bullet_dmg] = register_cvar("bh_admin_show_bullet_dmg", "1");
	cvar[model] = register_cvar("bh_vip_model", "vipMDL");

	precache_sound(SOUND_BLINK);
	ShockWave = precache_model("sprites/shockwave.spr");
	BlueFlare = precache_model("sprites/blueflare2.spr");

	static buffer[64], cvar_mdl[64];
	get_pcvar_string(cvar[model], cvar_mdl, 63);
	format(buffer, 63, "models/player/%s/%s.mdl", cvar_mdl, cvar_mdl);
	precache_model(buffer);

	read_vip_file();
}

public cmd_add_vip(id, level, cid)
{
	if(!cmd_access(id, level, cid, 4))
		return 1;

	new target[32], target_password[32], comment[256];
	read_argv(1, target, 31);
	read_argv(2, target_password, 31);
	read_argv(2, comment, 255);
	
	new player = cmd_target(id, target, 8);
	
	if(!player)
		return PLUGIN_HANDLED;
	
	new playername[32], adminame[32];
	get_user_name(player, playername, 31);
	get_user_name(id, adminame, 31);
	
	new configsDir[64];
	get_configsdir(configsDir, 63);
	format(configsDir, 63, "%s/vips.ini", configsDir);

	if(!file_exists(configsDir))
	{
		console_print(id, "%s File ^"%s^" doesn't exist.", tag, configsDir);
		return PLUGIN_HANDLED;
	}

	new line = 0, textline[256], len, vip_info[vip_data];
	while((line = read_file(configsDir, line, textline, 255, len)))
	{
		if(len == 0 || equal(textline, ";", 1))
			continue;
		
		if(parse(textline, vip_info[name], 31, vip_info[password], 31) != 2)
			continue;
		
		if(equal(vip_info[name], playername))
		{
			console_print(id, "%s %s este deja vip si exista in fisier.", tag, playername);
			return PLUGIN_HANDLED;
		}
	}
	
	new linetoadd[256];
	if(comment[0] == 0)
		formatex(linetoadd, 511, "^r^n^"%s^" ^"%s^"", playername, target_password);
	else
		formatex(linetoadd, 511, "^r^n^"%s^" ^"%s^" ; %s", playername, target_password, comment);
	
	console_print(id, "Adding: %s", linetoadd);
	
	if(!write_file(configsDir, linetoadd))
		console_print(id, "%s Failed writing to %s!", tag, configsDir);
	
	console_print(id, "%s %s a fost adaugat in vips.ini!", tag, playername);
	read_vip_file();
	is_user_vip[player] = true;

	ColorChat(0, "!4%s!1 Adminul!3 %s!1 l-a adaugat VIP pe!3 %s!1!", tag, adminame, playername);
	ColorChat(player, "!4%s!1 Felicitari! Ai fost adaugat ca membru!3 VIP!1!", tag);

	return PLUGIN_HANDLED;
}

read_vip_file()
{
	new path[64];
	get_localinfo("amxx_configsdir", path, charsmax(path));
	format(path, charsmax(path), "%s/vips.ini", path);
	
	new file = fopen(path, "r+");
	
	if(!file_exists(path))
	{
		new format_txt[128];
		log_to_file("vip_errors.txt", "Nu am gasit fisierul '%s'. Il creez acum!", path);

		format(format_txt, charsmax(format_txt), ";------------ | %s - Configuration file | ------------", PLUGIN_NAME);
		write_file(path, format_txt);
		format(format_txt, charsmax(format_txt), ";-------------------------- | by %s | --------------------------^n^n", PLUGIN_AUTHOR);
		write_file(path, format_txt);
		write_file(path, "; Exemplu de adaugare VIP:^n; ^"NUME^" ^"PAROLA^"^n^n^n");
	}
	
	if(vips_number)
	{
		ArrayClear(vip_array);
		vips_number = 0;
	}
	
	new text[121], p_name[32], p_password[32], vip_infos[vip_data];
	while(!feof(file))
	{
		fgets(file, text, charsmax(text));
		trim(text);
		
		if(text[0] == ';' || !strlen(text)) 
		{
			continue; 
		}
		
		if(parse(text, p_name, charsmax(p_name), p_password, charsmax(p_password)) != 2)
		{
			log_to_file("vip_errors.txt", "[AMXX] Nu am putut delimita linia (%s). Este scrisa gresit.", text);
			continue;
		}
		
		copy(vip_infos[name], charsmax(vip_infos), p_name);
		copy(vip_infos[password], charsmax(vip_infos), p_password);
		ArrayPushArray(vip_array, vip_infos);
		vips_number++;
	}
	
	fclose(file);
	
	switch(vips_number)
	{
		case 0: server_print("[AMXX] Nu am gasit nici un VIP in fisier.");
		default: server_print("[AMXX] Am incarcat %d VIP%s din fisier.", vips_number, vips_number == 1 ? "" : "I");
	}
}

public plugin_natives()
{
	vip_array = ArrayCreate(vip_data);
	
	register_native("is_user_vip", "native_is_user_vip", 1);
	register_native("set_user_vip", "native_set_user_vip", 1);
}

public plugin_end()
{
	ArrayDestroy(vip_array);
}

public native_is_user_vip(id)
{
	return is_user_vip[id];
}

public native_set_user_vip(id, bool:value)
{
	return is_user_vip[id] = (value == true) ? true : false;
}

public client_disconnect(id)
{
	is_user_vip[id] = false;
}

public client_putinserver(id)
{
	new p_name[32], p_password_field[32], p_password[32];
	get_user_info(id, "name", p_name, charsmax(p_name));
	get_pcvar_string(cvar_password_field, p_password_field, charsmax(p_password_field));
	get_user_info(id, p_password_field, p_password, charsmax(p_password));
	
	is_user_vip[id] = false;
	new vip_infos[vip_data], i;
	
	for(i = 0; i < vips_number; i++)
	{
		ArrayGetArray(vip_array, i, vip_infos);
		
		if(equal(vip_infos[name], p_name))
		{
			if(equal(vip_infos[password], p_password))
			{
				is_user_vip[id] = true;
			}
			else
			{
				server_cmd("kick #%d ^"Parola gresita...^"", get_user_userid(id));
			}
			
			break;
		}
	}

	if(is_user_vip[id])
	{
		new namev[32];
		get_user_name(id, namev, 31);
		
		ColorChat(0, "!4[BIO-VIP]!1 VIP-ul!3 %s!1 s-a conectat pe server.", namev);
	}
}

public CmdVipsOnline(id)
{
	if(!is_user_connected(id))
		return PLUGIN_CONTINUE;

	new adminnames[33][32], message[512], i, count, len;
	len = format(message, charsmax(message), "!4%s!3 VIPS ONLINE: ", tag);
	for(i = 1; i <= max_players; i++)
	{
		if(is_user_connected(i) && is_user_vip[i])
			get_user_name(i, adminnames[count++], charsmax(adminnames[]));
	}
	
	if(count > 0)
	{
		for(i = 0; i < count; i++)
		{
			len += format(message[len], charsmax(message)-len, "!4%s!1%s", adminnames[i], i < (count - 1) ? " | " : "");
			if(len > 96)
			{
				ColorChat(id, message);
				len = format(message, charsmax(message), "");
			}
		}
		ColorChat(id, message);
	}
	else
	{
		len += format(message[len], charsmax(message)-len, "!4No one !")
		ColorChat(id, message);
	}

	return PLUGIN_CONTINUE;
}

public CmdPrintAttributes(id)
{
	if(!is_user_connected(id)) return;
	show_motd(id, "vip.txt", "Beneficii VIP");
}

public CmdPrintAttributes2(id)
{
	if(!is_user_connected(id)) return;
	show_motd(id, "wantvip.txt", "VIP Benefits");
}

public CmdPrintAttributes3(id)
{
	if(!is_user_connected(id)) return;
	show_motd(id, "adminsbenefits.txt", "Beneficii ADMINI");
}

public CmdPrintAttributes4(id)
{
	if(!is_user_connected(id)) return;
	show_motd(id, "boost.txt", "Boost SMS");
}

public cmd_vipmenu(id) {
	if (!is_user_vip[id]) {
		ColorChat(id, "!4%s!3[RO]!1 Nu esti !4Membru VIP!1. Tasteaza !3/vip!1 pentru a vedea Beneficiile Vip.", tag);
		ColorChat(id, "!4%s!3[EN]!1 You are not a !4VIP Member!1. Type !3/wantvip!1 for further information.", tag);
		return PLUGIN_HANDLED;
	}
	if(!game_started()) {
		ColorChat(id, "!4%s!3[RO]!4 VIPMENU !1poate fi folosit dupa infectie.", tag);
		ColorChat(id, "!4%s!3[EN]!4 VIPMENU !1can be used after infection.", tag);
		return PLUGIN_HANDLED;
	}
	if ((is_user_zombie(id) && itemIsChosen[id][1] != -1) || (!is_user_zombie(id) && itemIsChosen[id][0] != -1)) {
		ColorChat(id, "!4%s!3[RO]!1 Ai folosit o data runda aceasta !4VIPMENU, !1incearca runda viitoare!", tag);
		ColorChat(id, "!4%s!3[EN]!1 You already use this round !4VIPMENU, !1try next round!", tag);
		return PLUGIN_HANDLED;
	}
	static menu;
	static item_info[256];
	if (!is_user_zombie(id)) {
		menu = menu_create("\rSurvivors VIP Menu", "HumansHandler");
		
		formatex(item_info, 255, "\yMareste Damage-ul cu \r%d%", get_pcvar_num(cvar[multidamage]));
		menu_additem(menu, item_info);
		
		formatex(item_info, 255, "\yTeleport (\r%d Secunde\y)", get_pcvar_num(cvar[teleport_cd]));
		menu_additem(menu, item_info);
		
		formatex(item_info, 255, "\yGloante Infinite");
		menu_additem(menu, item_info);
		
		formatex(item_info, 255, "\yNo Recoil");
		menu_additem(menu, item_info);

		menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
		menu_display(id, menu, 0);
	} else {
		menu = menu_create("\rZombies VIP Menu", "ZombiesHandler");
		
		formatex(item_info, 255, "\yGodMode (\r%d Seconde\y)", get_pcvar_num(cvar[madness_time]));
		menu_additem(menu, item_info);
		
		formatex(item_info, 255, "\yLongjump");
		menu_additem(menu, item_info);

		formatex(item_info, 255, "\yInfection Nade");
		menu_additem(menu, item_info);

		menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
		menu_display(id, menu, 0);
	}
	return PLUGIN_CONTINUE;
}

public HumansHandler(id, menu, item) {
	if(item == MENU_EXIT) {
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}

	itemIsChosen[id][0] = item;
	
	switch(item) {
		case 0: {
			ColorChat(id, "!4%s!3[RO]!1 Damage-ul tau a crescut cu!3 %d%%!1. !4Have Fun!", tag, get_pcvar_num(cvar[multidamage]));
			ColorChat(id, "!4%s!3[EN]!1 Your damage has been incresed by!3 %d%%!1. !4Have Fun!", tag, get_pcvar_num(cvar[multidamage]));
		}
		case 1: {
			ColorChat(id, "!4%s!3[RO]!1 Ai primit Teleport, te poti teleporta apsand!4 Tasta [G] !1.", tag);
			ColorChat(id, "!4%s!3[RO]!1 Poti folosi o data la:!3 %d secunde", tag, get_pcvar_num(cvar[teleport_cd]));
			ColorChat(id, "!4%s!3[EN]!1 You can teleport to cursor position by pressing!4 [G] key!1.", tag);
			ColorChat(id, "!4%s!3[EN]!1 Cooldown ability:!3 %d seconds", tag, get_pcvar_num(cvar[teleport_cd]));
		}
		case 2: {
			ColorChat(id, "!4%s!3[RO]!1 Ai primit!3 Gloante Infinite. !4Enjoy!", tag);
			ColorChat(id, "!4%s!3[EN]!1 You got!3 Unlimited Clip. !4Enjoy!", tag);
		}
		case 3: {
			ColorChat(id, "!4%s!3[RO]!1 Ai primit!3 No Recoil. !4Good Luck!", tag);
			ColorChat(id, "!4%s!3[EN]!1 You got!3 No Recoil. !4Good Luck!", tag);
		}
	}
	
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public ZombiesHandler(id, menu, item) {
	if(item == MENU_EXIT) {
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}

	itemIsChosen[id][1] = item;
	
	switch(item) {
		case 0: {
			ColorChat(id, "!4%s!3[RO]!1 Ai primit GodMode, pentru!3 %d secunde!1 apasa!4 Tasta [G]!1.", tag, get_pcvar_num(cvar[madness_time]));
			ColorChat(id, "!4%s!3[EN]!1 You got GodMode, for!3 %d seconds!1 pressing!4 [G] key!1.", tag, get_pcvar_num(cvar[madness_time]));
		}
		case 1: {
			ColorChat(id, "!4%s!3[RO]!1 Ai primit!3 Long Jump. !4Enjoy!", tag);
			ColorChat(id, "!4%s!3[RO]!1 Poti folosi o data la:!3 %d secunde!1.", tag, get_pcvar_num(cvar[leap_cooldown]));
			ColorChat(id, "!4%s!3[EN]!1 You got!3 Long Jump. !4Enjoy!", tag);
			ColorChat(id, "!4%s!3[EN]!1 Cooldown ability:!3 %d seconds!1.", tag, get_pcvar_num(cvar[leap_cooldown]));
		}
		case 2: {
			set_user_infection_nade(id);
			ColorChat(id, "!4%s!3[RO]!1 Ai primit !3Grenade Infection. !4Have Fun!", tag);
			ColorChat(id, "!4%s!3[RO]!1 Atentie, la ultimul !3Om !1ramas in !3viata !1nu v-a avea efect.", tag);
			ColorChat(id, "!4%s!3[EN]!1 You got !3Grenade Infection. !4Have Fun!", tag);
			ColorChat(id, "!4%s!3[EN]!1 Attention the last !3Human !1left !3alive !1will no have effect.", tag);
		}
	}
	
	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public cmd_use_ability(id) {
	if (!is_user_vip[id])
		return PLUGIN_CONTINUE;

	if (is_user_alive(id)) {
		if (g_PowerDelay[id] > 0) {
			set_dhudmessage(0, 255, 255, -1.0, 0.88, 0, _, 1.0);
			show_dhudmessage(id, "Incarcare.^n(%d secunde%s ramase)", g_PowerDelay[id], g_PowerDelay[id] == 1 ? "a" : "e");
			return PLUGIN_HANDLED_MAIN;
		} else {
			if (!is_user_zombie(id)) {
				if (itemIsChosen[id][0] == 1) {
					if (teleport(id)) {
						g_PowerDelay[id] = max(get_pcvar_num(cvar[teleport_cd]), 1);
						PowerDelay(id);
						return PLUGIN_HANDLED_MAIN;
					} else {
						ColorChat(id, "!4%s!3[RO]!1 Pozitie !3invalida!1.", tag);
						ColorChat(id, "!4%s!3[EN]!1 Invalid !3position.", tag);
						return PLUGIN_HANDLED_MAIN;
					}
				}
			} else {
				if (itemIsChosen[id][1] == 0) {
					itemIsChosen[id][1] = 2; // bug fix (ca sa nu spameze g de 10000000 mil ori)
					static madnessDuration;
					madnessDuration = get_pcvar_num(cvar[madness_time]);

					message_begin(MSG_ONE_UNRELIABLE, g_msgBarTime, _, id);
					write_byte(madnessDuration);
					write_byte(0);
					message_end();
					
					set_user_godmode(id, 1);
					set_task(float(madnessDuration), "stop_madness", id+TASK_MADNESS);
				}
			}
		}
	}
	return PLUGIN_CONTINUE;
}

public stop_madness(taskid) {
	new id = taskid - TASK_MADNESS;
	set_user_godmode(id);
	remove_bartime(id);
	ColorChat(id, "!4%s!3[RO]!1 GodMode-ul a !3expirat!1.", tag);
	ColorChat(id, "!4%s!3[EN]!1 GodMode-ul has !3expired!1.", tag);
}

public PowerDelay(id) {
	if (id >= TASK_TELEPORT)
		id -= TASK_TELEPORT;
	
	if (is_user_alive(id)) {
		if (g_PowerDelay[id] > 1) {
			g_PowerDelay[id]--;
			set_task(1.0, "PowerDelay", id+TASK_TELEPORT);
		} else if (g_PowerDelay[id] <= 1) {
			g_PowerDelay[id] = 0;
			
			set_dhudmessage(255, 255, 0, -1.0, 0.88, 0, _, 2.0);
			show_dhudmessage(id, "Teleport-ul este gata.^nApasa G pentru a folosi.");
		}
	}
}

public PowerReset(id) {
	task_exists(TASK_TELEPORT + id) ? remove_task(TASK_TELEPORT + id) : 0;
	g_PowerDelay[id] = 0;
}

public event_infect(victim, attacker) {
	if (victim != attacker && is_user_alive(attacker) && is_user_vip[attacker]) {
		cs_set_user_money(attacker, min(cs_get_user_money(attacker) + get_pcvar_num(cvar[money_infection]), MAX_MONEY));
		set_user_health(attacker, get_user_health(attacker) + get_pcvar_num(cvar[health_infection]));
	}
}

public event_Damage(victim)
{
	new id = get_user_attacker(victim);
	if(is_user_valid(id))
	{
		if(is_user_alive(id) && (is_user_vip[id] && get_pcvar_num(cvar[show_bullet_dmg]) == 1) || (is_user_admin(id) && get_pcvar_num(cvar[admin_show_bullet_dmg]) == 1))
		{
			if(read_data(4) || read_data(5) || read_data(6))
			{		
				new iPos = ++g_iPlayerPos[id];
				if(iPos == sizeof(g_flCoords))
					iPos = g_iPlayerPos[id] = 0;
				
				new iCol = ++g_iPlayerCol[id];
				if(iCol == sizeof(g_iColors))
					iCol = g_iPlayerCol[id] = 0;
				
				set_hudmessage(g_iColors[iCol][0], g_iColors[iCol][1], g_iColors[iCol][2], Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 0, 0.1, 2.5, 0.02, 0.02, -1);
				show_hudmessage(id, "%d", read_data(2));
			}
		}
	}
	
	return PLUGIN_CONTINUE;
}

public event_NewRound()
{
	static i;
	for (i = 0; i < max_players; i++) {
		itemIsChosen[i][0] = -1;
		itemIsChosen[i][1] = -1;
		PowerReset(i);
		remove_bartime(i);
	}
}

public event_CurWeapon(id)
{
	if (!is_user_alive(id))
		return PLUGIN_HANDLED;

	if (!is_user_vip[id])
		return PLUGIN_CONTINUE;

	if (itemIsChosen[id][0] != 2)
		return PLUGIN_HANDLED;

	new weapon = read_data(2);
	if (!(NOCLIP_WPN_BS & (1<<weapon))) {
		fm_cs_set_weapon_ammo(get_pdata_cbase(id, m_pActiveItem), g_MaxClipAmmo[weapon]);
	}
	return PLUGIN_CONTINUE;
}

public event_DeathMsg()
{
	PowerReset(read_data(2));
}

public event_ResetModel(id)
{
	if(!is_user_connected(id))
		return PLUGIN_CONTINUE;

	if(is_user_alive(id) && !is_user_vip[id])
		return PLUGIN_CONTINUE;

	new mdl_buffer[64];
	get_pcvar_string(cvar[model], mdl_buffer, 63);

	new CsTeams:userTeam = cs_get_user_team(id);
	if(userTeam == CS_TEAM_T || userTeam == CS_TEAM_CT)
	{
		cs_set_user_model(id, mdl_buffer);
		return PLUGIN_HANDLED;
	}
	else
	{
		cs_reset_user_model(id);
	}

	return PLUGIN_CONTINUE;
}

public fw_PlayerSpawnPost(id)
{
	if(is_user_vip[id] && is_user_alive(id))
	{
		set_task(0.25, "give_items", id);
		return HAM_IGNORED;
	}
	
	return HAM_IGNORED;
}

public give_items(id)
{
	new cache = get_pcvar_num(cvar[hp_spawn])
	if(cache != 0) set_user_health(id, cache);

	cache = get_pcvar_num(cvar[ap_spawn]);
	if(cache != 0) give_item(id, "item_assaultsuit");
}

public fw_TakeDamagePre(victim, iInflictor, attacker, Float:fDamage, iDmgType)
{
	if(victim == attacker || !is_user_valid(attacker) || !is_user_alive(attacker) || !is_user_zombie(victim))
		return HAM_HANDLED;

	if (!is_user_vip[attacker])
		return HAM_IGNORED;

	if (itemIsChosen[attacker][0] == 0) {
		static Float:current_damage;
		current_damage = fDamage;
		fDamage = fDamage + fDamage * (get_pcvar_num(cvar[multidamage]) / 100.0);

		if(iDmgType & DMG_HEGRENADE)
			fDamage = current_damage;
		
		SetHamParamFloat(4, fDamage);
		return HAM_HANDLED;
	}
	return HAM_IGNORED;
}

public fw_PrimaryAttack(ent)
{
	new id = pev(ent, pev_owner);
	if(is_user_alive(id) && is_user_vip[id] && itemIsChosen[id][0] == 3)
		pev(id, pev_punchangle, cl_pushangle[id]);

	return HAM_IGNORED;
}

public fw_PrimaryAttackPost(ent)
{
	new id = pev(ent, pev_owner);
	if(is_user_alive(id) && is_user_vip[id] && itemIsChosen[id][0] == 3)
	{
		new Float:fPush[3];
		pev(id, pev_punchangle, fPush);

		xs_vec_sub(fPush, cl_pushangle[id], fPush );
		xs_vec_mul_scalar(fPush, random_float(0.0, 0.2), fPush);
		xs_vec_add(fPush, cl_pushangle[id], fPush );

		set_pev(id, pev_punchangle, fPush);
	}
	
	return HAM_IGNORED;
}

public fw_PlayerPreThink(id)
{	
	// --- Check if player should leap ---
	if (is_user_alive(id) && is_user_zombie(id) && is_user_vip[id] && itemIsChosen[id][1] == 1) {
		// Check if proper CVARs are enabled and retrieve leap settings
		static Float:cooldown, Float:current_time;
		cooldown = 5.0;
		current_time = get_gametime()
		
		// Cooldown not over yet
		if (current_time - g_lastleaptime[id] < cooldown)
			return;
		
		// Not doing a longjump (don't perform check for bots, they leap automatically)
		if (!is_user_bot(id) && !(pev(id, pev_button) & (IN_JUMP | IN_DUCK) == (IN_JUMP | IN_DUCK)))
			return;

		// Not on ground or not enough speed
		if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
			return;
		
		static Float:velocity[3];
		
		// Make velocity vector
		velocity_by_aim(id, get_pcvar_num(cvar[leap_force]), velocity);
		
		// Set custom height
		velocity[2] = float(get_pcvar_num(cvar[leap_height]));
		
		// Apply the new velocity
		set_pev(id, pev_velocity, velocity);
		
		// Update last leap time
		g_lastleaptime[id] = current_time;
	}
}

public fw_Userinfochanged(id, buffer)
{
	if (!is_user_connected(id))
		return FMRES_IGNORED;

	static oldname[32], newname[32]
	get_user_name(id, oldname, 31);
	engfunc(EngFunc_InfoKeyValue, buffer, g_name, newname, 31);

	if (equal(newname, oldname))
		return FMRES_IGNORED;

	client_putinserver(id);
	return FMRES_IGNORED;
}

public msg_ScoreAttrib(msgid, dest, id)
{
	if(!get_pcvar_num(cvar[show_vip_tab]))
		return PLUGIN_CONTINUE;
		
	new id = get_msg_arg_int(1);
	if(is_user_connected(id) && is_user_vip[id])
		set_msg_arg_int(2, ARG_BYTE, is_user_alive(id) ? (1<<2) : (1<<0));
	
	return PLUGIN_CONTINUE;
}

stock ColorChat(id, String[], any:...) 
{
	static szMesage[192];
	vformat(szMesage, charsmax(szMesage), String, 3);
	
	replace_all(szMesage, charsmax(szMesage), "!1", "^1");
	replace_all(szMesage, charsmax(szMesage), "!3", "^3");
	replace_all(szMesage, charsmax(szMesage), "!4", "^4");
	
	static g_msg_SayText = 0;
	if(!g_msg_SayText)
		g_msg_SayText = get_user_msgid("SayText");
	
	new Players[32], iNum = 1, i;

 	if(id) Players[0] = id;
	else get_players(Players, iNum, "ch");
	
	for(--iNum; iNum >= 0; iNum--) 
	{
		i = Players[iNum];
		
		message_begin(MSG_ONE_UNRELIABLE, g_msg_SayText, _, i);
		write_byte(i);
		write_string(szMesage);
		message_end();
	}
}

public remove_bartime(id)
{
	if(task_exists(id+TASK_MADNESS))
	{
		message_begin(MSG_ONE_UNRELIABLE, g_msgBarTime, _, id);
		write_byte(0);
		write_byte(0);
		message_end();
		
		remove_task(id+TASK_MADNESS);
	}
}

// Get entity's speed (from fakemeta_util)
stock fm_get_speed(entity)
{
	static Float:velocity[3]
	pev(entity, pev_velocity, velocity)
	
	return floatround(vector_length(velocity));
}

bool:teleport(id)
{
	new Float:vOrigin[3], Float:vNewOrigin[3], Float:vNormal[3], Float:vTraceDirection[3], Float:vTraceEnd[3];
	
	pev(id, pev_origin, vOrigin);
	
	velocity_by_aim(id, 99999, vTraceDirection);
	xs_vec_add(vTraceDirection, vOrigin, vTraceEnd);
	
	engfunc(EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0);
	
	new Float:flFraction;
	get_tr2(0, TR_flFraction, flFraction);

	if(flFraction < 1.0)
	{
		get_tr2(0, TR_vecEndPos, vTraceEnd);
		get_tr2(0, TR_vecPlaneNormal, vNormal);
	}
	
	xs_vec_mul_scalar(vNormal, 40.0, vNormal);
	xs_vec_add(vTraceEnd, vNormal, vNewOrigin);
	
	if(is_player_stuck(id, vNewOrigin))
		return false;
	
	emit_sound(id, CHAN_STATIC, SOUND_BLINK, 1.0, ATTN_NORM, 0, PITCH_NORM);
	tele_effect(vOrigin);
	
	engfunc(EngFunc_SetOrigin, id, vNewOrigin);
	
	tele_effect2(vNewOrigin);

	return true;
}
User avatar
L E V I N
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 3454
Joined: 24 Aug 2011, 12:24
Detinator Steam: Da
CS Status:
Detinator server CS: ☯∴
SteamID: riseofevo
Reputatie: Scripter eXtreamCS
Nume anterior: Adryyy
Location: ҳ̸Ҳ̸ҳ
Discord: Levin#0061
Has thanked: 41 times
Been thanked: 534 times
Contact:

05 Feb 2021, 19:26

nu are cum să facă așa ceva dacă în putinserver se apelează mereu un nou(new) string pentru name...(din ce ai tu)
modifică așa
new namev[32];
get_user_name(id, namev, 31);
în
new namev[33];
get_user_info(id,"name", namev, charsmax(namev));
Faceți cerere bine detaliată, aici, și respectând modelul dacă vreți ajutor.
Nu-mi mai dați add doar pentru a mă avea în lista de prieteni.
Dacă te ajut, și mă ignori/etc > te adaug la lista de „ignore”.
Aveți grijă la cei ce încearcă să mă copieze sau să dea drept mine..Puteți lua legătura cu mine prin STEAM dacă aveți o problemă/nelămurire în acest caz! (am cont doar aici!!)
În cazul în care utilizați ceva din ce am postat(ex: aici), e bine să fiți la curent cu modificările aduse și de aici, iar dacă sunt ceva probleme nu ezitați să luați legătura cu mine. Actualizarea unor coduri nu se va posta la actual, doar dacă se găsește ceva critic/urgent de remediat, unele fiind coduri vechi, iar unele refăcute recent.
* Nume pe cs1.6: eVoLuTiOn \ Nume vechi: eVo
* Atelierul meu - post2819572.html#p2819572 (închis,click link ca să vedeți de ce)
sammi1
Membru, skill 0
Membru, skill 0
Posts: 49
Joined: 30 Jan 2021, 22:38
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: Zm.CsPower.Ro
Fond eXtream: 0
Has thanked: 23 times

06 Feb 2021, 00:02

L E V I N wrote:
05 Feb 2021, 19:26
nu are cum să facă așa ceva dacă în putinserver se apelează mereu un nou(new) string pentru name...
modifică așa
new namev[32];
get_user_name(id, namev, 31);
în
new namev[33];
get_user_info(id,"name", namev, charsmax(namev));
Mersi din nou levin, merge perfect
Lexz, nu stiu de ce ai avut nevoie de toata sursa, se pare ca a fost suficient doar partea aceea de cod, mersi oricum
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests