Help i'm stuck in the conversion

Unpaid Requests, Public Plugins
Post Reply
Rain1153
Senior Member
Senior Member
India
Posts: 277
Joined: 1 Year Ago
Has thanked: 2 times
Been thanked: 1 time
Age: 18
Contact:

Help i'm stuck in the conversion

#1

Post by Rain1153 » 3 Months Ago

can anybody convert this plugin for me?
https://forums.alliedmods.net/showthrea ... 3?t=170793
THANKS
LOL

User avatar
Jack GamePlay
Mod Developer
Mod Developer
Egypt
Posts: 541
Joined: 2 Years Ago
Location: Egypt
Has thanked: 31 times
Been thanked: 44 times
Age: 19
Contact:

#2

Post by Jack GamePlay » 2 Months Ago

Code: Select all

/*
*	---------------------------------------------------------------------------------------------------------
*	------------------------------------[ZP] Zombie Class: Jockey--------------------------------------------
*	---------------------------------------------------------------------------------------------------------
*	------------------------------------Author: SNAKER_BEATTER-----------------------------------------------
*	---------------------------------------------------------------------------------------------------------
*				About:
*		I was playing on a l4d2 dead center server, when jockey jumped into my head. I'm really totally
*		shocked on that momment. But on that time i dont known how to make it for zp so ii search from
*		google and i found jockey(fixed) on a zombie-portal website. BUT its now cool only if a human
*		gets in hes radius, that man's screen turns black. So i was think and think to create and i
*		i remembered my smoker's long tongue system and thats the way to create this :D....
*	---------------------------------------------------------------------------------------------------------
*				Description:
*		This is another zombie class 4.3 or later version. This is like the special infected jockey
*		When he jumped into a human's head it. Jockey drags it and the victim will damage as long
*		as the abillity is processing...
*	---------------------------------------------------------------------------------------------------------
*				Credits:
*		Isaacd3d - Asked/request 
*		Head splash plugin - the way to create this plugin
*	---------------------------------------------------------------------------------------------------------
*				Cvars:
*		NO cvars needed...
*	----------------------------------------------------------------------------------------------------------
*				Modules:
*		fakemeta
*		fun
*		engine
*		cstrike
*	-----------------------------------------------------------------------------------------------------------
*				Change log:
*		1.0 (Oct 25, 2011)
*		{
*			public release
*		}
*		1.1 (Oct 26, 2011)
*		{
*			Added 3rdperson view
*		}
*		1.2 (Oct 28, 2011)
*		{
*			3rdperson view works
*		}
*			Fix jockey when touch a human they stick together
*			(mistake) changed victim's deal damage to jockey 
*		}
*		1.3 (Oct 29, 2011)
*		{
*			Changes jockey's speed to 190.0 every time he jump to a head
*			(best) Fix after jockeying, 3rdperson still working
*		}
*		1.4 (Oct 29, 2011)(3pm)
*		{
*			Fix jockey is a human, Can do a command
*		}
*		1.5 (Forgotten)
*		{
*			Added new round remove 3rdperson
*			Added after infecting jockey victim, remove 3rdperson
*			Fix survivor(maybe) and nemesis can do a jockey ability
*		}
*		1.6 (Oct 30, 2011)(Includes CS_HAM_BOTS_API plugin)
*		{
*			Fix jockey's victim killed, 3rdperson still works (cs_ham_bots_api)
*		}
*		1.7 (Oct 30, 2011)(3pm)
*		{
*			Added print chat color when is using jockey class
*			Fix jockey's slower speed still theirs when ability end
*		}
*		1.8 (Oct 30, 2011)(5pm)
*		{
*			Fix normal speed to jockey is effecting whether using a ability
*		}
*		2.0 (Nov 29, 2011)
*		{
*			Added Strip weapons and only leave knife to jockey's victim
*			(best fix) Victim's speed get buggy after doing jockey's ability
*			-0.1 gravity so jumps more higher
*		}
*/

/******************************************************
		[Include files]
******************************************************/

#include <zombie_escape>
#include <ze_zombie_class>
#include <fun>
#include <engine>
#include <cstrike>
// Important (install cs_ham_bots_api.amxx to your server)
#include <cs_ham_bots_api>

/******************************************************
		[Plugin infos]
******************************************************/

#define PLUGIN_NAME "[ZP] ZCLASS: L4D Jockey"
#define PLUGIN_VERSION "2.0"
#define PLUGIN_AUTHOR "snaker-beatter"

/******************************************************
		[Id(s)]
******************************************************/

#define MINIMUM_FALL_SPEED 300
#define MAXIMUM_DAMAGE_FROM_JUMP 10.0

#define DAMAGE 6.0
#define DELAY 5.0

new Float:falling_speed[33];
new Float:damage_after[33][33];

new g_zclass_jockey, bool:g_nospeed[33], bool:g_headpullspeed[33], bool:check_inhead[33], bool:g_normspeed[33]

new const zclass_name[] = { "Jockey l4d2" }
new const zclass_info[] = { "Jumps to human" }
const zclass_health = 2312 
const zclass_speed = 245
const zclass_gravity = 800 

/******************************************************
		[Main event]
******************************************************/

public plugin_init()
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR); 
	register_forward(FM_Touch, "forward_touch");
	register_forward(FM_PlayerPreThink, "forward_PlayerPreThink")
	register_event("ResetHUD", "forward_spawn", "b")
	RegisterHamBots(Ham_Killed, "forward_Killed")
	RegisterHam(Ham_Killed, "player", "forward_Killed")
	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
	RegisterHamBots(Ham_TakeDamage, "fw_TakeDamage")
}

/****************************************************
		[Events]
****************************************************/

public plugin_precache()
{
	g_zclass_jockey = ze_register_zombie_class(zclass_name, zclass_info, zclass_health, zclass_speed, zclass_gravity)
	
}

public ze_user_infected(id, infector)
{
	task_send_color(id)
	if (check_inhead[id])
	{
		g_nospeed[id] = false
		g_normspeed[id] = true
		check_inhead[id] = false
	}
	if (check_inhead[infector])
	{
		check_inhead[infector] = false
	}
}

public task_send_color(id) 
{
	if (ze_get_current_zombie_class(id) == g_zclass_jockey)
	{ 
		print_chatColor(id, "\g[ZP \nyou are using \tjockey\n, \tjump \nto \thuman's head and control hes movements") 
	}
}
		
public forward_spawn(id)
{
	if (check_inhead[id])
	{
		check_inhead[id] = false
		g_nospeed[id] = false
		g_normspeed[id] = true
	}
}

public forward_Killed(id, attacker, shouldgib)
{
	if (check_inhead[id])
	{
		check_inhead[id] = false
		g_nospeed[id] = false
		g_normspeed[id] = true
	}
	if (check_inhead[attacker])
	{
		check_inhead[attacker] = false
	}
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damagegibs)
{
	if (victim == attacker || !is_user_alive(attacker))
		return HAM_IGNORED;
	
	if (!ze_is_user_zombie(victim) && ze_get_current_zombie_class(attacker) == g_zclass_jockey && ze_is_user_zombie(attacker))
	{
		SetHamParamFloat(4, damage * random_float(0.20, 0.30))
		return HAM_HANDLED;
	}
	
	return HAM_IGNORED;
}

public forward_touch(toucher, touched)
{
	if(!is_user_alive(toucher) || !ze_is_user_zombie(toucher) || !is_user_alive(touched) || ze_is_user_zombie(touched) || ze_get_current_zombie_class(toucher) != g_zclass_jockey) // The touching players can't be dead.
		return;
	
	if(falling_speed[touched])
		return;
	
	if(get_user_team(toucher) == get_user_team(touched) && !get_cvar_num("mp_friendlyfire"))
		return;
	
	new touched_origin[3], toucher_origin[3];
	get_user_origin(touched, touched_origin); 
	get_user_origin(toucher, toucher_origin);
	
	new Float:toucher_minsize[3], Float:touched_minsize[3];
	pev(toucher,pev_mins,toucher_minsize);
	pev(touched,pev_mins,touched_minsize); 
	
	if(touched_minsize[2] != -18.0) 
	{
		if(!(toucher_origin[2] == touched_origin[2]+72 && toucher_minsize[2] != -18.0) && !(toucher_origin[2] == touched_origin[2]+54 && toucher_minsize[2] == -18.0))
		{	
			g_normspeed[toucher] = true
			g_normspeed[touched] = true
			check_inhead[touched] = false
			check_inhead[toucher] = false
			g_nospeed[touched] = false
			return;
		}
	}
	else 
	{
		if(!(toucher_origin[2] == touched_origin[2]+68 && toucher_minsize[2] != -18.0) && !(toucher_origin[2] == touched_origin[2]+50 && toucher_minsize[2] == -18.0))
		{
			g_normspeed[toucher] = true
			g_normspeed[touched] = true
			check_inhead[touched] = false
			check_inhead[toucher] = false
			g_nospeed[touched] = false
			return;
		}
	}
	
	if(falling_speed[toucher] >= MINIMUM_FALL_SPEED)
	{
		g_headpullspeed[toucher] = true
		new Float:damage = ((falling_speed[toucher] - MINIMUM_FALL_SPEED + 30) * (falling_speed[toucher] - MINIMUM_FALL_SPEED + 30)) / 1300;
		if(damage > MAXIMUM_DAMAGE_FROM_JUMP) 
			damage = MAXIMUM_DAMAGE_FROM_JUMP;
		//damage_player(touched, toucher, damage); 
		//damage_after[toucher][touched] = 0.0;
	}
	if(is_user_alive(touched) && damage_after[toucher][touched] <= get_gametime()) 
	{
		g_nospeed[touched] = true
		g_headpullspeed[toucher] = true
		g_normspeed[toucher] = false
		
		strip_user_weapons(touched)
		give_item(touched, "weapon_knife")
		
		//damage_after[touched][toucher] = get_gametime() + DELAY;
		//damage_player(toucher, touched, DAMAGE);
		
		new Float:fl_Velocity[3]
		new idOrigin[3], vicOrigin[3]
	
		get_user_origin(touched, vicOrigin)
		get_user_origin(toucher, idOrigin)
	
		new distance = get_distance(idOrigin, vicOrigin)
		
		if (distance > 1)
		{
			check_inhead[toucher] = true
			check_inhead[touched] = true
			new Float:fl_Time = distance / 389.0
			
			fl_Velocity[0] = (idOrigin[0] - vicOrigin[0]) / fl_Time
			fl_Velocity[1] = (idOrigin[1] - vicOrigin[1]) / fl_Time
			fl_Velocity[2] = (idOrigin[2] - vicOrigin[2]) / fl_Time
		} 
		else 
		{
			check_inhead[toucher] = false
			check_inhead[touched] = false
			fl_Velocity[0] = 0.0
			fl_Velocity[1] = 0.0
			fl_Velocity[2] = 0.0
		}
	
		entity_set_vector(touched, EV_VEC_velocity, fl_Velocity)
		/*check_inhead[toucher] = true
		check_inhead[touched] = true*/
	}
	else
	{
		//set_view(touched, CAMERA_NONE)
		//set_view(toucher, CAMERA_NONE)
	}
	if (get_entity_distance(toucher, touched) == 100)
	{
		g_normspeed[touched] = true
		g_normspeed[toucher] = true
		check_inhead[touched] = false
		check_inhead[toucher] = false
		g_nospeed[touched] = false
	}
}

public forward_PlayerPreThink(id)
{
	//falling_speed[id] = entity_get_float(id, EV_FL_flFallVelocity); // Store the falling speed of the soon to be "thinking" player.
	pev(id, pev_flFallVelocity, falling_speed[id])
	
	if (g_nospeed[id])
	{
		set_user_maxspeed(id, 1.0)
	}
	else
	{
		g_normspeed[id] = true
	}
	if (g_headpullspeed[id])
	{
		set_user_maxspeed(id, 190.0)
	}
	if (g_normspeed[id])
	{
		set_user_maxspeed(id, 245.0)
	}
	if (check_inhead[id])
	{
		//set_view(id, CAMERA_UPLEFT)
	}
	else
	{
		//set_view(id, CAMERA_NONE)
		give_item(id, "weapon_knife")
	}
}

public damage_player(pwned, pwnzor, Float:damage) // Damages or kills a player. Home made HAX
{
	new health = get_user_health(pwned);
	if(get_user_team(pwned) == get_user_team(pwnzor)) // If both players are in the same team, reduce the damage.
		damage /= 1.4;
	new CsArmorType:armortype;
	cs_get_user_armor(pwned, armortype);
	if(armortype == CS_ARMOR_VESTHELM)
		damage *= 0.7;
	if(health >  damage)
	{	
		new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "trigger_hurt"));
		if(!ent)
			return;
		new value[16];
		float_to_str(damage * 2, value, sizeof value - 1);
		set_kvd(0, KV_ClassName, "trigger_hurt");
		set_kvd(0, KV_KeyName, "dmg");
		set_kvd(0, KV_Value, value);
		set_kvd(0, KV_fHandled, 0);
		dllfunc(DLLFunc_KeyValue, ent, 0);
		num_to_str(DMG_GENERIC, value, sizeof value - 1);
		set_kvd(0, KV_ClassName, "trigger_hurt");
		set_kvd(0, KV_KeyName, "damagetype");
		set_kvd(0, KV_Value, value);
		set_kvd(0, KV_fHandled, 0);
		dllfunc(DLLFunc_KeyValue, ent, 0);
		set_kvd(0, KV_ClassName, "trigger_hurt");
		set_kvd(0, KV_KeyName, "origin");
		set_kvd(0, KV_Value, "8192 8192 8192");
		set_kvd(0, KV_fHandled, 0);
		dllfunc(DLLFunc_KeyValue, ent, 0);
		dllfunc(DLLFunc_Spawn, ent);
		set_pev(ent, pev_classname, "head_splash");
		dllfunc(DLLFunc_Touch, ent, pwned);
		engfunc(EngFunc_RemoveEntity, ent);
	}
	else
	{	
		set_pev(pwned, pev_frags, float(get_user_frags(pwned) + 1));
		user_silentkill(pwned);
		make_deathmsg(pwnzor, pwned, 1, "his/her feet :)");
		if(get_user_team(pwnzor) != get_user_team(pwned)) // If it was a team kill, the pwnzor's money should get reduced instead of increased.
		{
			set_pev(pwnzor, pev_frags, float(get_user_frags(pwnzor) + 1));
			cs_set_user_money(pwnzor, cs_get_user_money(pwnzor) + 300);
		}
		else
		{
			set_pev(pwnzor, pev_frags, float(get_user_frags(pwnzor) - 1));
			cs_set_user_money(pwnzor, cs_get_user_money(pwnzor) - 300);
		}
		
		message_begin(MSG_ALL, get_user_msgid("ScoreInfo")); // Fixes the scoreboard.
		write_byte(pwnzor);
		write_short(get_user_frags(pwnzor));
		write_short(cs_get_user_deaths(pwnzor));
		write_short(0);
		write_short(get_user_team(pwnzor));
		message_end();
		
		message_begin(MSG_ALL, get_user_msgid("ScoreInfo"));
		write_byte(pwned);
		write_short(get_user_frags(pwned));
		write_short(cs_get_user_deaths(pwned));
		write_short(0);
		write_short(get_user_team(pwned));
		message_end();
		set_pev(pwned, pev_frags, float(get_user_frags(pwned) - 1));
	}
}

stock print_chatColor(id, const message[], any:...)
{
	new msg[191], players[32], count = 1;
	vformat(msg,190,message,3);
	replace_all(msg,190,"\g","^4");// green
	replace_all(msg,190,"\n","^1");// normal
	replace_all(msg,190,"\t","^3");// team
	
	if (id) players[0] = id; else get_players(players,count,"ch");
	for (new i=0;i<count;i++)
	if (is_user_connected(players[i]))
	{
		message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
		write_byte(players[i]);
		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 }
*/
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest