Modificare plugin Ut_Revive

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
Laurentiu P.
Fost moderator
Fost moderator
Posts: 2548
Joined: 10 Jul 2013, 21:26
Detinator Steam: Da
Reputatie: Fost super moderator
Fond eXtream: 100
Has thanked: 26 times
Been thanked: 61 times
Contact:

30 Sep 2014, 19:31

Salut as dorii sa mi se modifice cate ceva la plugin-ul Ultimate Revive si anume:

- Cand vreau sa-mi dau revive sa nu mai fie nevoie sa scriu si HP / AP, ci doar amx_revive nume/@/@T/@CT
- Hp-ul si Ap-ul sa fie setate la 200 cand dau revive oricui
- Comanda sa fie executata de 3 ori pe runda
- Cand dau revive sa apara in chat:
"[REVIVE] Ai primit revive cu succes!" [Cand imi dau mie revive]
"[REVIVE] Echipa T/CT a primit revive cu succes!" [Cand dau revive la echipa CT sau T]

Sursa mai jos:

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Ultimate Revive"
#define VERSION "1.1"
#define AUTHOR "anakin_cstrike"

new g_fade;
public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	register_concmd("amx_revive","revive_cmd",ADMIN_BAN," - <Nick | @ALL | @T | @CT> <HP> <AP>");
	g_fade = get_user_msgid("ScreenFade");}
public revive_cmd(id,level,cid)
{
	if(!cmd_access(id,level,cid,4))
		return PLUGIN_HANDLED;
	new 
	arg[32],arg2[4],arg3[4],
	name[32],hp,armor;
	read_argv(1,arg,31);
	read_argv(2,arg2,3);
	read_argv(3,arg3,3);
	get_user_name(id,name,31);
	new argc = read_argc();
	if(argc < 2) {hp = 200;armor = 0;}
	else if(argc == 3) {hp = str_to_num(arg2);armor = 0;}
	else {hp = str_to_num(arg2);armor = str_to_num(arg3);}
	if(arg[0] == '@')
	{
		new players[32],teamname[24],tname[16],num,index,i;
		if(arg[1])
		{
			if(arg[1] == 'T')
			{
				copy(tname,15,"TERRORIST");
				copy(teamname,23,"Terrorist");
			} else if(arg[1] == 'C' && arg[2] == 'T') {
				copy(tname,15,"CT");
				copy(teamname,23,"Counter-Terrorist");
			} else {
				console_print(id,"[INFO] Foloseste: @T / @CT pentru a reinvia echipele CT sau T");
				return PLUGIN_HANDLED;
			}
			get_players(players,num,"be",tname);
		} else {
			get_players(players,num);
			copy(teamname,23,"All");
		}
		if(num == 0)
		{
			chat_color(id, "!g[REVIVE] !nNu sunt jucatori in echipa !g%s",teamname);
			return PLUGIN_HANDLED;
		}
		for(i = 0;i < num;i++)
		{
			index = players;
			if(is_user_alive(index)) continue;
			Revive(index,hp,armor);
		}
		//log_amx("ADMIN %s: Revive %s with %i hp and %i armor",name,teamname,hp,armor);
		chat_color(0, "!g[REVIVE] !nAdminul !g%s !n a reinviat echipa !g%s.", name, teamname);
	} else {
		new target = cmd_target(id,arg,3);
		if(!target)
		return PLUGIN_HANDLED;
		if(is_user_alive(target))
		{
			chat_color(0, "!g[REVIVE] !nJucatorul este in viata!");
			return PLUGIN_HANDLED;
		}
		new namet[32]; 
		get_user_name(target,namet,31);
		Revive(target,hp,armor);
		//log_amx("ADMIN %s: Revive %s with %i hp and %i armor",name,namet,hp,armor);
		chat_color(0, "!g[REVIVE] !nJucatorul !g%s a reinviat. A primit !g%i !nHP & !g%i !nAP", namet, hp, armor);
	}
	return PLUGIN_HANDLED;
}
Revive(index,hp,armor)
{
	set_pev(index,pev_deadflag,DEAD_RESPAWNABLE);
	set_pev(index,pev_iuser1,0);
	dllfunc(DLLFunc_Think,index);
	engfunc(EngFunc_SetOrigin,index,Float:{-4800.0,-4800.0,-4800.0});
	new array[3];
	array[0] = index;
	array[1] = hp;
	array[2] = armor
	set_task(0.5,"respawn",0,array,3);
}
public respawn(array[3])
{
	new index = array[0];
	new hp = array[1];
	new armor = array[2];
	if(is_user_connected(index))
	{
		dllfunc(DLLFunc_Spawn,index);
		set_pev(index,pev_health,float(hp));
		set_pev(index,pev_armorvalue,float(armor));
		switch(get_user_team(index))
        	{
            		case 1:
            		{
                		fm_give_item(index,"weapon_knife");
                		fm_give_item(index,"weapon_glock18");
                		fm_give_item(index,"ammo_9mm");
                		fm_give_item(index,"ammo_9mm");
                		fm_give_item(index,"ammo_9mm");
                		fm_give_item(index,"ammo_9mm");
            		}
            		case 2:
            		{
               		 	fm_give_item(index,"weapon_knife");
                		fm_give_item(index,"weapon_usp");
                		fm_give_item(index,"ammo_45acp");
                		fm_give_item(index,"ammo_45acp");
                		fm_give_item(index,"ammo_45acp");
                		fm_give_item(index,"ammo_45acp");
            		}
        	}
		Fade(index,0,255,0,30);
	}
}
stock fm_give_item(id,const item[])
{
	static ent
	ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
	if(!pev_valid(ent)) return;
   
	static Float:originF[3]
	pev(id, pev_origin, originF);
	set_pev(ent, pev_origin, originF);
	set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
	dllfunc(DLLFunc_Spawn, ent);
   
	static save
	save = pev(ent, pev_solid);
	dllfunc(DLLFunc_Touch, ent, id);
	if(pev(ent,pev_solid) != save)
		return;
      
	engfunc(EngFunc_RemoveEntity, ent);
}
stock Fade(index,red,green,blue,alpha)
{
	message_begin(MSG_ONE,g_fade,{0,0,0},index);
	write_short(1<<10);
	write_short(1<<10);
	write_short(1<<12);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(alpha);
	message_end();
}

stock chat_color(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4")
	replace_all(msg, 190, "!n", "^1")
	replace_all(msg, 190, "!t", "^3")
	replace_all(msg, 190, "!t2", "^0")
	
	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();
			}
		}
	}
}



Multumesc!
no...
RoyalServer 2
User avatar
Laurentiu P.
Fost moderator
Fost moderator
Posts: 2548
Joined: 10 Jul 2013, 21:26
Detinator Steam: Da
Reputatie: Fost super moderator
Fond eXtream: 100
Has thanked: 26 times
Been thanked: 61 times
Contact:

01 Oct 2014, 19:52

cineva?!
no...
User avatar
Laurentiu P.
Fost moderator
Fost moderator
Posts: 2548
Joined: 10 Jul 2013, 21:26
Detinator Steam: Da
Reputatie: Fost super moderator
Fond eXtream: 100
Has thanked: 26 times
Been thanked: 61 times
Contact:

02 Oct 2014, 20:25

Cineva? Undeva? Candva?
no...
User avatar
Laurentiu P.
Fost moderator
Fost moderator
Posts: 2548
Joined: 10 Jul 2013, 21:26
Detinator Steam: Da
Reputatie: Fost super moderator
Fond eXtream: 100
Has thanked: 26 times
Been thanked: 61 times
Contact:

04 Oct 2014, 07:55

Putin ajutor daca se poate ? Multumesc!
no...
User avatar
Laurentiu P.
Fost moderator
Fost moderator
Posts: 2548
Joined: 10 Jul 2013, 21:26
Detinator Steam: Da
Reputatie: Fost super moderator
Fond eXtream: 100
Has thanked: 26 times
Been thanked: 61 times
Contact:

06 Oct 2014, 07:47

Cineva va rog !?
no...
User avatar
Nubo
Fost moderator
Fost moderator
Posts: 2734
Joined: 11 Jul 2012, 18:45
Detinator Steam: Da
CS Status: [əˈnɒn.ɪ.məs]
Reputatie: Fost scripter eXtreamCS
Fost eXtream Mod
Has thanked: 8 times
Been thanked: 27 times

07 Oct 2014, 00:04

Poftim:
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Ultimate Revive"
#define VERSION "1.1"
#define AUTHOR "anakin_cstrike"

new g_fade, g_num[33];
public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	register_concmd("amx_revive","revive_cmd",ADMIN_BAN," - <Nick | @ALL | @T | @CT>");
	g_fade = get_user_msgid("ScreenFade");
	register_event("HLTV", "new_round", "a", "1=0", "2=0")
}

public new_round()
{
	arrayset(g_num, 0, 33)
}

public client_disconnect(id)
{
	g_num[id] = 0;
}

public client_connect(id)
{
	g_num[id] = 0;
}

public revive_cmd(id,level,cid)
{
	if(!cmd_access(id,level,cid,2))
		return PLUGIN_HANDLED;
	if(g_num[id] >= 3)
		return 1;
	new arg[32];
	new name[32], hp, armor;
	read_argv(1,arg,31);
	//read_argv(2,arg2,3);
	//read_argv(3,arg3,3);
	get_user_name(id,name,31);
	hp = 200;
	armor = 200;
	/*new argc = read_argc();
	if(argc < 2) {hp = 200;armor = 0;}
	else if(argc == 3) {hp = str_to_num(arg2);armor = 0;}
	else {hp = str_to_num(arg2);armor = str_to_num(arg3);}*/
	if(arg[0] == '@')
	{
		new players[32],teamname[24],tname[16],num,index,i;
		if(arg[1])
		{
			if(arg[1] == 'T')
			{
				copy(tname,15,"TERRORIST");
				copy(teamname,23,"Terrorist");
			} else if(arg[1] == 'C' && arg[2] == 'T') {
				copy(tname,15,"CT");
				copy(teamname,23,"Counter-Terrorist");
			} else {
				console_print(id,"[INFO] Foloseste: @T / @CT pentru a reinvia echipele CT sau T");
				return PLUGIN_HANDLED;
			}
			get_players(players,num,"be",tname);
		} else {
			get_players(players,num);
			copy(teamname,23,"All");
		}
		if(num == 0)
		{
			chat_color(id, "!g[REVIVE] !nNu sunt jucatori in echipa !g%s",teamname);
			return PLUGIN_HANDLED;
		}
		for(i = 0;i < num;i++)
		{
			index = players;
			if(is_user_alive(index)) continue;
			Revive(index,hp,armor);
		}
		//log_amx("ADMIN %s: Revive %s with %i hp and %i armor",name,teamname,hp,armor);
		chat_color(0, "!g[REVIVE] Echipa %s a primit revive cu succes!", teamname);
	} else {
		new target = cmd_target(id,arg,2);
		if(!target)
		return PLUGIN_HANDLED;
		if(is_user_alive(target))
		{
			chat_color(0, "!g[REVIVE] !nJucatorul este in viata!");
			return PLUGIN_HANDLED;
		}
		new namet[32]; 
		get_user_name(target,namet,31);
		Revive(target,hp,armor);
		//log_amx("ADMIN %s: Revive %s with %i hp and %i armor",name,namet,hp,armor);
		if(id == target)
			chat_color(id, "!g[REVIVE] !nAi primit revive cu succes!");
		else
			chat_color(0, "!g[REVIVE] !n%s l-a reinviat pe %s !", name, namet);
	}
	return PLUGIN_HANDLED;
}
Revive(index,hp,armor)
{
	set_pev(index,pev_deadflag,DEAD_RESPAWNABLE);
	set_pev(index,pev_iuser1,0);
	dllfunc(DLLFunc_Think,index);
	engfunc(EngFunc_SetOrigin,index,Float:{-4800.0,-4800.0,-4800.0});
	new array[3];
	array[0] = index;
	array[1] = hp;
	array[2] = armor
	set_task(0.5,"respawn",0,array,3);
}
public respawn(array[3])
{
	new index = array[0];
	new hp = array[1];
	new armor = array[2];
	if(is_user_connected(index))
	{
		dllfunc(DLLFunc_Spawn,index);
		set_pev(index,pev_health,float(hp));
		set_pev(index,pev_armorvalue,float(armor));
		switch(get_user_team(index))
        	{
            		case 1:
            		{
                		fm_give_item(index,"weapon_knife");
                		fm_give_item(index,"weapon_glock18");
                		fm_give_item(index,"ammo_9mm");
                		fm_give_item(index,"ammo_9mm");
                		fm_give_item(index,"ammo_9mm");
                		fm_give_item(index,"ammo_9mm");
            		}
            		case 2:
            		{
               		 	fm_give_item(index,"weapon_knife");
                		fm_give_item(index,"weapon_usp");
                		fm_give_item(index,"ammo_45acp");
                		fm_give_item(index,"ammo_45acp");
                		fm_give_item(index,"ammo_45acp");
                		fm_give_item(index,"ammo_45acp");
            		}
        	}
		Fade(index,0,255,0,30);
	}
}
stock fm_give_item(id,const item[])
{
	static ent
	ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
	if(!pev_valid(ent)) return;
   
	static Float:originF[3]
	pev(id, pev_origin, originF);
	set_pev(ent, pev_origin, originF);
	set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
	dllfunc(DLLFunc_Spawn, ent);
   
	static save
	save = pev(ent, pev_solid);
	dllfunc(DLLFunc_Touch, ent, id);
	if(pev(ent,pev_solid) != save)
		return;
      
	engfunc(EngFunc_RemoveEntity, ent);
}
stock Fade(index,red,green,blue,alpha)
{
	message_begin(MSG_ONE,g_fade,{0,0,0},index);
	write_short(1<<10);
	write_short(1<<10);
	write_short(1<<12);
	write_byte(red);
	write_byte(green);
	write_byte(blue);
	write_byte(alpha);
	message_end();
}

stock chat_color(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4")
	replace_all(msg, 190, "!n", "^1")
	replace_all(msg, 190, "!t", "^3")
	replace_all(msg, 190, "!t2", "^0")
	
	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();
			}
		}
	}
}

Testat
Cand nu merge acest forum sunt online aici:
  • * Skype: nubo_cs
    * Y!M ID: nubo_cs
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests