Modificare plugin Clase CT

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
X-D3$[T]Ro!
Membru, skill 0
Membru, skill 0
Posts: 70
Joined: 13 Aug 2018, 19:19
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: NU
Fond eXtream: 0
Has thanked: 4 times
Been thanked: 1 time
Contact:

24 Jun 2020, 12:08

Bună ziua, doresc și eu o modificare la pluginul de mai jos, acea modificare este să-i afișeze meniul de "Alege-ti rasa" în timpul de pregătire pentru modul BaseBuilder!

Asta
| Afiseaza codul
public cmdrace(id) { 
	if(cs_get_user_team(id) == CS_TEAM_CT) {
	menu = menu_create("\r[BB.ServerulTau.Ro] \wAlege-ti \yRasa", "SetRace");
	
	menu_additem(menu, "\yNero \w- \y500 \rHp \wsi \y500 \rArmura", "1", 0);
	menu_additem(menu, "\yDanTe \w- \rGloate infinite", "2", 0);
	menu_additem(menu, "\yPredator \w- \rDamage \yx3", "3", 0);
	menu_additem(menu, "\yElf  \w- \rInvizibilitate", "4", 0);
	menu_additem(menu, "\rVIP  \w- \yHealth \w/ \yDamage \rX3 \w/ \rUnlimited Ammo \w/ \rMultiJump", "5", 0);   
	
	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, menu, 0);
	return PLUGIN_CONTINUE;
	}
	return PLUGIN_CONTINUE;
	}
-------------------------------------------------------------
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta_util>
#include <hamsandwich>

#pragma semicolon 1;
#define VIP_LEVEL ADMIN_IMMUNITY
new menu;
new jumpznum[33] = 0;
new bool:dozjump[33] = false;
new ReloadTime[33];
new Mesaj, CvarHealth, CvarArmor, CvarDamage,CvarInvis, CvarInvisKnife, CvarVipJumps, CvarVipHealth;
new Race[33];

public plugin_init() {
	register_plugin("KnifeMod", "1.0", "Aragon*");
	register_clcmd("changerace","cmdrace");
	register_clcmd("say /changerace","cmdrace");
	register_clcmd("say_team /changerace","cmdrace");
	register_clcmd("say changerace","cmdrace");
	register_clcmd("say_team changerace","cmdrace");
	register_clcmd("race","cmdrace");
	register_clcmd("say /race","cmdrace");
	register_clcmd("say_team /race","cmdrace");
	register_clcmd("say race","cmdrace");
	register_clcmd("say_team race","cmdrace");
	register_event( "Damage", "Damage", "be" );
	register_event("CurWeapon","CurWeapon","be","1=1");
	RegisterHam(Ham_Spawn, "player", "Spawm");
	Mesaj = register_cvar("race_hudmessage_delay", "420");		//| Intervarul de timp la care sa apara mesajul HUD Deffault:420 |//
	CvarHealth = register_cvar("race_human_health","500");		//| Human Health Deffault: 250 |//
	CvarArmor = register_cvar("race_human_armor","500");		//| Human Armor Deffault: 250 |//
	CvarDamage = register_cvar("race_predator_damage", "3");		//| Damage Deffault: 3 |//
	CvarInvis = register_cvar("race_efl_invis","100");		//| 0 Total Invizibility -> 255 Total Vizibility Deffault:30 |//
	CvarInvisKnife = register_cvar("race_efl_invis_knife","100");	//| 0 Total Invizibility -> 255 Total Vizibility white Knife Deffault:20 |//
	CvarVipJumps = register_cvar("race_vip_multijump","2");		//| De cate ori poate sari VIP +1 |//
	CvarVipHealth = register_cvar("race_vip_health","250");		//| VIP Health Deffault:; 150 |//

	}
public plugin_precache() { 
	precache_model("models/player/dnthuman/dnthuman.mdl");
	precache_model("models/player/dntsurv/dntsurv.mdl");
	precache_model("models/player/dntpredator/dntpredator.mdl");
	precache_model("models/player/dntinv/dntinv.mdl");
	precache_model("models/player/dntvip/dntvip.mdl");
	} 
public cmdrace(id) { 
	if(cs_get_user_team(id) == CS_TEAM_CT) {
	menu = menu_create("\r[BB.ServerulTau.Ro] \wAlege-ti \yRasa", "SetRace");
	
	menu_additem(menu, "\yNero \w- \y500 \rHp \wsi \y500 \rArmura", "1", 0);
	menu_additem(menu, "\yDanTe \w- \rGloate infinite", "2", 0);
	menu_additem(menu, "\yPredator \w- \rDamage \yx3", "3", 0);
	menu_additem(menu, "\yElf  \w- \rInvizibilitate", "4", 0);
	menu_additem(menu, "\rVIP  \w- \yHealth \w/ \yDamage \rX3 \w/ \rUnlimited Ammo \w/ \rMultiJump", "5", 0);   
	
	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_display(id, menu, 0);
	return PLUGIN_CONTINUE;
	}
	return PLUGIN_CONTINUE;
	}
	
public SetRace(id, menu, item) {
	if (item == MENU_EXIT) {
	menu_destroy(menu);
	return PLUGIN_HANDLED;
	}
	new data[6], iName[64];
	new access, callback;
	menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
	new key = str_to_num(data);
	switch(key) {
	case 1: {
	Race[id] = 1;
	if(is_user_alive(id)) {
	fm_set_user_health(id, get_pcvar_num(CvarHealth));
	set_user_invizibility(id,0);
	cs_set_user_model(id, "dnthuman");
	}
	}
	case 2: {
	Race[id] = 2;
	if(is_user_alive(id)) {
	fm_set_user_health(id, 100);
	set_user_invizibility(id,0);
	cs_set_user_model(id, "dntsurv");
	}
	}
	case 3: {
	Race[id] = 3;
	if(is_user_alive(id)) {
	fm_set_user_health(id, 100);
	set_user_invizibility(id,0);
	cs_set_user_model(id, "dntpredator");
	}
	}
	case 4: {
	Race[id] = 4;
	if(is_user_alive(id)) {
	fm_set_user_health(id, 100);
	set_user_invizibility(id,1);
	cs_set_user_model(id, "dntinv");
	}
	}
	case 5: {
	if(get_user_flags(id) & VIP_LEVEL) {
	Race[id] = 5;
	if(is_user_alive(id)) {
	set_user_invizibility(id,0);
	fm_set_user_health(id, get_pcvar_num(CvarVipHealth));
	cs_set_user_model(id, "dntvip");
	}
	}
	}
	}
	menu_destroy(menu);
	return PLUGIN_HANDLED;
	}
	
public Damage(id) {
	if(cs_get_user_team(id) == CS_TEAM_CT) {
	new victim_id = id;
	if( !is_user_connected( victim_id ) ) return PLUGIN_CONTINUE;
	new dmg_take = read_data(2);
	new Float:multiplier = get_pcvar_float(CvarDamage);
	new Float:damage = dmg_take * multiplier;
	new health = get_user_health( victim_id );
	new iWeapID, attacker_id = get_user_attacker( victim_id, iWeapID );
	
	if( !is_user_connected( attacker_id ) || !is_user_alive( victim_id ) ) {
	return PLUGIN_HANDLED;
	}
	if(Race[attacker_id] == 3 || Race[attacker_id] == 5 && get_user_flags(id) & VIP_LEVEL) {
	if( floatround(damage) >= health ) {
	if( victim_id == attacker_id ) {
	return PLUGIN_CONTINUE;
	}   
	else {
	log_kill( attacker_id, victim_id, "weaponbox", 0 );
	}   
	return PLUGIN_CONTINUE;
	}
	}
	return PLUGIN_CONTINUE;
	}
	return PLUGIN_CONTINUE;
	}

public Spawm(id) {
	if(get_user_team(id) == 2) {
	//1.Human
	if(Race[id] == 1) {
	fm_set_user_health(id, get_pcvar_num(CvarHealth));
	fm_set_user_armor(id, get_pcvar_num(CvarArmor));
	set_user_invizibility(id,0);
	cs_set_user_model(id, "dnthuman");
	}
	//2.Surviver
	if (Race[id] == 2) {
	set_user_invizibility(id,0);
	cs_set_user_model(id, "dntsurv");
	fm_set_user_health(id, 100);
	}
	//3.Predator
	if (Race[id] == 3) {
	set_user_invizibility(id,0);
	cs_set_user_model(id, "dntpredator");
	fm_set_user_health(id, 100);
	}
	//4.Elf
	if (Race[id] == 4) {
	set_user_invizibility(id,1);
	cs_set_user_model(id, "dntinv");
	fm_set_user_health(id, 100);
	}
	//5.VIP
	if (Race[id] == 5 && get_user_flags(id) & VIP_LEVEL) {
	set_user_invizibility(id,0);
	fm_set_user_health(id, get_pcvar_num(CvarVipHealth));
	cs_set_user_model(id, "dntvip");
	}
	if(Race[id] == 0) {
	cmdrace(id);
	}
	}
	else {
	set_user_invizibility(id,0);
	set_task(0.1, "reset_model",id);
	Race[id] = 0;
	}
	}

public CurWeapon(id) {
	if(cs_get_user_team(id) == CS_TEAM_CT) {
	new wpnid = read_data(2);
	new clip = read_data(3);
	
	//2.Surviver
	if (Race[id] == 2 || Race[id] == 5  && get_user_flags(id) & VIP_LEVEL) {
	if (wpnid == CSW_C4 || wpnid == CSW_KNIFE) {}
	if (wpnid == CSW_HEGRENADE || wpnid == CSW_SMOKEGRENADE || wpnid == CSW_FLASHBANG) {}
	if (clip == 0) reloadAmmo(id);
	}
	//4.Elf
	if (Race[id] == 4) {
	static iInvisLevel;
	if(!IsHoldingKnife(id)) {
	iInvisLevel = get_pcvar_num(CvarInvis);
	fm_set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransTexture, iInvisLevel);
	}
	else if(IsHoldingKnife(id)) {
	InvKnife(id);
	}
	}
	else {
	fm_set_user_rendering(id);
	}
	if(Race[id] == 0) {
	cmdrace(id);
	}
	return PLUGIN_HANDLED;
	}
	return PLUGIN_HANDLED;
	}

stock log_kill(killer, victim, weapon[],headshot) {
	user_silentkill( victim );
	message_begin( MSG_ALL, get_user_msgid( "DeathMsg" ), {0,0,0}, 0 );
	write_byte( killer );
	write_byte( victim );
	write_byte( headshot );
	write_string( weapon );
	message_end();
	new kfrags = get_user_frags( killer );
	fm_set_user_frags( killer, kfrags++ );
	new vfrags = get_user_frags( victim );
	fm_set_user_frags( victim, vfrags++ );
	return  PLUGIN_CONTINUE;
	} 

stock set_user_invizibility(id, invizibility = 1) {
	static iInvisLevel;
	if(invizibility){
	if(IsHoldingKnife(id)) {
	InvKnife(id);
	}
	if(is_user_alive(id)) {
	iInvisLevel = get_pcvar_num(CvarInvis);
	fm_set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransTexture, iInvisLevel);
	}
	}
	else {
	fm_set_user_rendering(id);
	}
	}

public IsHoldingKnife(id) {
	new iClip, iAmmo, iWeapon;
	iWeapon = get_user_weapon(id, iClip, iAmmo);
	if(iWeapon == CSW_KNIFE) {
	return true;
	}
	return false;
	}

public InvKnife(id) {
	static iInvisLevel;
	if(IsHoldingKnife(id)) {
	iInvisLevel = get_pcvar_num(CvarInvisKnife);
	fm_set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransTexture, iInvisLevel);
	}
	else {
	iInvisLevel = get_pcvar_num(CvarInvis);
	fm_set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransTexture, iInvisLevel);
	}
	}

public reloadAmmo(id) {
	if (!is_user_connected(id)) return;
	if (ReloadTime[id] >= get_systime() - 1) return;
	ReloadTime[id] = get_systime();
	
	new clip, ammo, wpn[32];
	new wpnid = get_user_weapon(id, clip, ammo);
	
	if (wpnid == CSW_C4 || wpnid == CSW_KNIFE || wpnid == 0) return;
	if (wpnid == CSW_HEGRENADE || wpnid == CSW_SMOKEGRENADE || wpnid == CSW_FLASHBANG) return;
	
	if (clip == 0) {
	get_weaponname(wpnid,wpn,31);
	new iWPNidx = -1;
	while((iWPNidx = fm_find_ent_by_class(iWPNidx, wpn)) != 0) {
	if(id == pev(iWPNidx, pev_owner)) {
	cs_set_weapon_ammo(iWPNidx, getMaxClipAmmo(wpnid));
	break;
	}
	}
	}
	}

stock getMaxClipAmmo(wpnid) {
	new clipammo = 0;
	switch (wpnid) {
	case CSW_P228 : clipammo = 13;
	case CSW_SCOUT : clipammo = 10;
	case CSW_HEGRENADE : clipammo = 0;
	case CSW_XM1014 : clipammo = 7;
	case CSW_C4 : clipammo = 0;
	case CSW_MAC10 : clipammo = 30;
	case CSW_AUG : clipammo = 30;
	case CSW_SMOKEGRENADE : clipammo = 0;
	case CSW_ELITE : clipammo = 15;
	case CSW_FIVESEVEN : clipammo = 20;
	case CSW_UMP45 : clipammo = 25;
	case CSW_SG550 : clipammo = 30;
	case CSW_GALI : clipammo = 35;
	case CSW_FAMAS : clipammo = 25;
	case CSW_USP : clipammo = 12;
	case CSW_GLOCK18 : clipammo = 20;
	case CSW_AWP : clipammo = 10;
	case CSW_MP5NAVY : clipammo = 30;
	case CSW_M249 : clipammo = 100;
	case CSW_M3 : clipammo = 8;
	case CSW_M4A1 : clipammo = 30;
	case CSW_TMP : clipammo = 30;
	case CSW_G3SG1 : clipammo = 20;
	case CSW_FLASHBANG : clipammo = 0;
	case CSW_DEAGLE : clipammo = 7;
	case CSW_SG552 : clipammo = 30;
	case CSW_AK47 : clipammo = 30;
	case CSW_KNIFE : clipammo = 0;
	case CSW_P90 : clipammo = 50;
	}
	return clipammo;
	}
	
public client_PreThink(id) {
	if(!is_user_alive(id) || Race[id] != 5) return PLUGIN_CONTINUE;
    
	new nzbut = get_user_button(id);
	new ozbut = get_user_oldbutton(id);
	if((nzbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(ozbut & IN_JUMP)) {
	if (jumpznum[id] < get_pcvar_num(CvarVipJumps)) {
	dozjump[id] = true;
	jumpznum[id]++;
	return PLUGIN_CONTINUE;
	}
	}
	if((nzbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND)) {
	jumpznum[id] = 0;
	return PLUGIN_CONTINUE;
	}    
	return PLUGIN_CONTINUE;
	}

public client_PostThink(id) {
	if(!is_user_alive(id) || Race[id] != 5) return PLUGIN_CONTINUE;
    
	if(dozjump[id] == true) {
	new Float:vezlocityz[3];
	entity_get_vector(id,EV_VEC_velocity,vezlocityz);
	vezlocityz[2] = random_float(265.0,285.0);
	entity_set_vector(id,EV_VEC_velocity,vezlocityz);
	dozjump[id] = false;
	return PLUGIN_CONTINUE;
	}    
	return PLUGIN_CONTINUE;
	}  
	
public reset_model(id) cs_reset_user_model(id);

public client_disconnect(id) {  
	Race[id] = 0;
	set_user_invizibility(id,0);
	}

public client_putinserver(id) {
	set_task(get_pcvar_float(Mesaj), "MesajHud", 0, _, _, "b");
	Race[id] = 0;
	set_user_invizibility(id,0);
	}
	
public MesajHud(id) {
	set_hudmessage(0, 100, 200, -1.0, 0.17, 0, 6.0, 12.0, 0.01, 0.1, 10);
	show_hudmessage(id, "Acest server ii multumeste lui Aragon pentru tot efortul !");
	}

stock ColorChat(const id, const input[], any:...) {
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "^x04", "^4");
	replace_all(msg, 190, "^x01", "^1");
	replace_all(msg, 190, "^x03", "^3");
	
	if(id) players[0] = id;
	else get_players(players, count, "ch"); {
	for(new i = 0; i < count; i++) {
	if(is_user_connected(players)) {
	message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
	write_byte(players);
	write_string(msg);
	message_end();
	}
	}
	}
	}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Aici Aveti include-ul pentru modul basebuilder
| Afiseaza codul
https://www68.zippyshare.com/v/FF5Yf4K7/file.html
și aceasta este nativa de prep time presupun, adică de timpul de pregătire. native bb_is_prep_phase()

EDIT: Vă mulțumesc dacă mă puteți ajuta.
User avatar
EnTeR_
Membru, skill +1
Membru, skill +1
Posts: 495
Joined: 13 Sep 2014, 15:36
Detinator Steam: Da
Fond eXtream: 0
Been thanked: 12 times

24 Jun 2020, 15:41

Personal nu cunosc acest mod de joc, dar cred ca am inteles ideea.

Code: Select all

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

Code: Select all

public SetRace(id, menu, item) {
	if (item == MENU_EXIT) {
	menu_destroy(menu);
	return PLUGIN_HANDLED;
	}
	
	if ( !bb_is_prep_phase() )
	{
		client_print ( id, print_chat, "Nu poti selecta rasa" );
		menu_destroy ( menu );
		return PLUGIN_HANDLED;
	}
Modifici partea aceasta de cod, dupa care iti ramane doar sa afisezi meniul la spawn.
Discord: EyeKon#3230
X-D3$[T]Ro!
Membru, skill 0
Membru, skill 0
Posts: 70
Joined: 13 Aug 2018, 19:19
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: NU
Fond eXtream: 0
Has thanked: 4 times
Been thanked: 1 time
Contact:

25 Jun 2020, 05:05

EnTeR_ wrote:
24 Jun 2020, 15:41
Personal nu cunosc acest mod de joc, dar cred ca am inteles ideea.

Code: Select all

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

Code: Select all

public SetRace(id, menu, item) {
	if (item == MENU_EXIT) {
	menu_destroy(menu);
	return PLUGIN_HANDLED;
	}
	
	if ( !bb_is_prep_phase() )
	{
		client_print ( id, print_chat, "Nu poti selecta rasa" );
		menu_destroy ( menu );
		return PLUGIN_HANDLED;
	}
Modifici partea aceasta de cod, dupa care iti ramane doar sa afisezi meniul la spawn.
Aşa este modul:

Build time(Timpul de construire). Care-i 2.50 minute, după cele 2.50 minute intrã în timpul de prep time(Timpul de pregatire) şi inainte dea intra in timpul de pregatire runda se restartează şi sunt 30 de secunde pentru ati testa baza. Aşa vreau cum se restarteaza runda de-a intra in timpul de pregatire să-i afiseze meniul.
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests