port kamikaze_rocket from AMX to AMXX

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
bane907
Извън линия
Foreigner
Foreigner
Мнения: 2
Регистриран на: 20 Апр 2018, 20:02
Местоположение: Chicago, Illinois

port kamikaze_rocket from AMX to AMXX

Мнение от bane907 » 20 Апр 2018, 20:12

Hello everyone. I am new to this site. I am having a problem with 1 plugin. so the story is. Me and my friend found a plugin but its for amxmod and not for amxmodx so we cant use it. He is a Bulgarian and he sent me here to ask for help. I barely managed to register and find where to write this topic, since my Bulgarian is poor :D . Anyways it's a "Fun Plugin" and we need it for our server but we can't port it to amxmodx. If anyone could help and port it to amxmodx i would be thankful a lot . Cheers!

Plugin Direct Link : http://www.amxmod.net/amxfiles/plugins/ ... rocket.zip
Последно промяна от bane907 на 20 Апр 2018, 20:31, променено общо 1 път.

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

Help

Мнение от OciXCrom » 20 Апр 2018, 20:19

Welcome. Please refrain from using such titles. The title must explain the contents of the thread as best as possible. Titles such as "help", "plugin request", "problem with something" are not welcomed. Please change your title to something like "port <plugin name> from AMX to AMXX" before we proceed.

Аватар
bane907
Извън линия
Foreigner
Foreigner
Мнения: 2
Регистриран на: 20 Апр 2018, 20:02
Местоположение: Chicago, Illinois

port kamikaze_rocket from AMX to AMXX

Мнение от bane907 » 20 Апр 2018, 20:32

Excuse me, i am not familiar with the rules here, it's edited now.

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

port kamikaze_rocket from AMX to AMXX

Мнение от OciXCrom » 20 Апр 2018, 20:36

It compiles, but I'm not sure if it will work or not:

Код за потвърждение: Избери целия код

/*************************************************************************************************************
AMX Kamikaze Rocket

Version: 0.5
Author: KRoT@L

0.1    Release
0.2    Checks if players is alive, removed teamkill, fixed a few things
0.3    Added kamirocket_speed cvar
0.4    Added kamirocket_cooldown cvar
0.5    Improved the code
Renamed some cvars
Added cvars kamirocket_admins, kamirocket_fly_mode
Added cvars kamirocket_speed_guided, kamirocket_damage_max, kamirocket_damage_radius
Added multimod support
Added multilingual support
Added #define PRINT_TYPE to be able to change the type of information message (print_console or print_chat)
0.6    Added CVar kamirocket_looseondeath

Buy a kamikaze rocket, type "kamirocket" in the console (or bind a key), and you will be shot
in the direction you are facing really fast and you will blow up on impact.
You can move the "kamirocket" where you want when the cvar "kamirocket_fly_mode" is enabled.
Anyone you kill counts as a kill.


Commands:

say /buy_kamirocket - buys a kamikaze rocket

kamirocket - makes you become a kamikaze rocket (bind a key to "kamirocket")


Cvars:

kamirocket_active "1" - 0: disable the plugin
1: enable the plugin

kamirocket_admins "0" - 0: all players can use the plugin
1: only admins can use the plugin

kamirocket_delay "120" - waiting delay before to be able to buy a "kamirocket" again (in seconds)

kamirocket_cost "4000" - cost of a kamikaze rocket (unavailable for other mods than CS or CZ)

kamirocket_fly_mode "0" - 0: straight fly (player isn't able to change the direction of the rocket)
1: guided fly (player can move the direction of the rocket)

kamirocket_speed_normal "2000" - speed of the kamirocket in "straight fly"

kamirocket_speed_guided "1000" - speed of the kamirocket in "guided fly"

kamirocket_looseondeath "1" - 0: don't loose the kamirocket on death
1: loose the kamirocket on death


Setup:

Install the .amx & .txt file.
Enable VexdUM.


Credit:

Requested by StK | -kNuLLeD


*************************************************************************************************************/

/******************************************************************************/
// If you change one of the following settings, do not forget to recompile
// the plugin and to install the new .amx file on your server.
// You can find the list of admin flags in the amx/examples/include/amxconst.inc file.

#define FLAG_SAY_BUY_KAMIROCKET ADMIN_ALL

// Mode of print for the Kamikaze Rocket info messages from the "kamirocket" command.
// Values are either "print_console", "print_chat" or "print_center".
#define PRINT_TYPE print_console

/******************************************************************************/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fun>

new g_iSpriteBeam, g_iSpriteBoom

new bool:g_bHasMoneySupport

new bool:g_bHasRocket[33]
#define MODE_NONE     0
#define MODE_STRAIGHT 1
#define MODE_GUIDED   2
new g_iRocketMode[33]
new Float:g_flNextRocketUse[33]
new Float:g_vVelocity[33][3]
new Float:g_vViewAngles[33][3]

new g_iRocketPlayerID

new g_iCVarKamiRocketSpeedGuided
new g_iMaxPlayers

new g_pCVarKamiRocketActive
new g_pCVarKamiRocketAdmins
new g_pCVarKamiRocketDelay
new g_pCVarKamiRocketCost
new g_pCVarKamiRocketFlyMode
new g_pCVarKamiRocketSpeedNormal
new g_pCVarKamiRocketSpeedGuided
new g_pCVarKamiRocketDamageMulti
new g_pCVarKamiRocketRadiusMulti
new g_pCVarKamiRocketLooseOnDeath

new g_pCVarSVMaxVelocity

new g_bIsEntityToSkip[128]
#define SetEntBits(%1)    g_bIsEntityToSkip[%1>>5] |= (1<<(%1-1))
#define RemoveEntBits(%1) g_bIsEntityToSkip[%1>>5] &= ~(1<<(%1-1))
#define GetEntBits(%1)   (g_bIsEntityToSkip[%1>>5] & (1<<(%1-1)))

#define IsPlayer(%1) (1 <= %1 <= g_iMaxPlayers)

public plugin_precache() {
	g_iSpriteBeam = precache_model("sprites/smoke.spr")
	g_iSpriteBoom = precache_model("sprites/dexplo.spr")

	precache_sound("weapons/rocket1.wav")
	precache_sound("weapons/rocketfire1.wav")
}

public entity_spawn_evo(iEntity, const szClassName[]) {
	if(!is_valid_ent(iEntity))
		return PLUGIN_CONTINUE

	// Reduced
	static const szEntitiesList[][] = {
		// Some default Half-Life entities
		{16, "trigger_multiple"},
		// Some default CS entities
		{12, "func_buyzone"},
		{14, "info_vip_start"}, // not sure
		{19, "func_vip_safetyzone"},
		{19, "func_hostage_rescue"},
		{19, "info_hostage_rescue"},
		{16, "func_bomb_target"},
		{16, "info_bomb_target"},
		{15, "func_escapezone"},
		{14, "armoury_entity"}
	}

	new iClassNameLen = strlen(szClassName)

	for(new i = 0; i < charsmax(szEntitiesList); i++) {
		if(iClassNameLen == szEntitiesList[i][0] && equal(szClassName, szEntitiesList[i][1])) {
			SetEntBits(iEntity)
		}
	}
	return PLUGIN_CONTINUE
}

public plugin_init() {
	register_plugin("Kamikaze Rocket", "0.5", "KRoT@L")

	register_clcmd("say /buy_kamirocket", "buy_kamirocket", FLAG_SAY_BUY_KAMIROCKET, "- buys a kamikaze rocket")
	register_clcmd("kamirocket", "kamirocket", FLAG_SAY_BUY_KAMIROCKET, "- makes you become a kamikaze rocket (bind a key to ^"kamirocket^")")

	g_pCVarKamiRocketActive       = register_cvar("kamirocket_active", "1")
	g_pCVarKamiRocketAdmins       = register_cvar("kamirocket_admins", "0")
	g_pCVarKamiRocketDelay        = register_cvar("kamirocket_delay", "120")
	g_pCVarKamiRocketCost         = register_cvar("kamirocket_cost", "3000")
	g_pCVarKamiRocketFlyMode      = register_cvar("kamirocket_fly_mode", "0")
	g_pCVarKamiRocketSpeedNormal  = register_cvar("kamirocket_speed_normal", "2000")
	g_pCVarKamiRocketSpeedGuided  = register_cvar("kamirocket_speed_guided", "1000")
	g_pCVarKamiRocketDamageMulti    = register_cvar("kamirocket_damage_multi", "5")
	g_pCVarKamiRocketRadiusMulti = register_cvar("kamirocket_damage_radius", "350")
	g_pCVarKamiRocketLooseOnDeath = register_cvar("kamirocket_looseondeath", "1")

	g_pCVarSVMaxVelocity = get_cvar_pointer("sv_maxvelocity")

	register_event("TextMsg", "Event_TextMsg_Restart", "a", "2&#Game_C", "2&#Game_w")
	register_event("ResetHUD", "Event_ResetHUD_Spawn", "bef")
	register_event("Health", "Event_Health_Death", "bd", "1<1")

	g_bHasMoneySupport = (is_running("cstrike") || is_running("czero")) ? true : false

	g_iMaxPlayers = get_maxplayers()
}

public client_putinserver(iPlayerID) {
	g_bHasRocket[iPlayerID]      = false
	g_iRocketMode[iPlayerID]     = MODE_NONE
	g_flNextRocketUse[iPlayerID] = 0.0
}

public client_disconnect(iPlayerID) {
	g_bHasRocket[iPlayerID]      = false
	g_iRocketMode[iPlayerID]     = MODE_NONE
	g_flNextRocketUse[iPlayerID] = 0.0
}

public Event_TextMsg_Restart() {
	for(new iPlayerID = 1; iPlayerID <= g_iMaxPlayers; iPlayerID++) {
		g_bHasRocket[iPlayerID]      = false
		g_iRocketMode[iPlayerID]     = MODE_NONE
		g_flNextRocketUse[iPlayerID] = 0.0
	}
}

public Event_ResetHUD_Spawn(iPlayerID) {
	if(g_iRocketMode[iPlayerID] != MODE_NONE) {
		g_bHasRocket[iPlayerID]  = false
		g_iRocketMode[iPlayerID] = MODE_NONE
		emit_sound(iPlayerID, CHAN_VOICE, "weapons/rocket1.wav", 0.0, ATTN_NORM, SND_STOP, PITCH_NORM)
	}
}

public Event_Health_Death(iPlayerID) {
	if(iPlayerID == g_iRocketPlayerID)
	return

	if(g_bHasRocket[iPlayerID] == false
			|| (g_iRocketMode[iPlayerID] == MODE_NONE && get_pcvar_num(g_pCVarKamiRocketLooseOnDeath) <= 0))
	return

	if(g_iRocketMode[iPlayerID]) {
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_KILLBEAM)
		write_short(iPlayerID)
		message_end()
	}

	g_bHasRocket[iPlayerID]  = false
	g_iRocketMode[iPlayerID] = MODE_NONE
}

public buy_kamirocket(iPerformerID, iLevel, iCid) {
	if(!cmd_access(iPerformerID, iLevel, iCid, 1))
		return PLUGIN_HANDLED_MAIN
		
	new szArgs[22]
	new iArgsLen   = read_args(szArgs, charsmax(szArgs))
	new iPrintType = (szArgs[0] == '"' && szArgs[iArgsLen - 1] == '"') ? print_chat : print_console

	if(get_pcvar_num(g_pCVarKamiRocketActive) <= 0) {
		client_print(iPerformerID, iPrintType, "The plugin ^"Kamikaze Rocket^" is disabled.")
		return PLUGIN_HANDLED_MAIN
	}

	if(g_bHasRocket[iPerformerID]) {
		client_print(iPerformerID, iPrintType, "You have already a kamikaze rocket.")
		return PLUGIN_HANDLED_MAIN
	}

	if(get_pcvar_num(g_pCVarKamiRocketAdmins) > 0 && !is_user_admin(iPerformerID)) {
		client_print(iPerformerID, iPrintType, "Only admins can buy a kamikaze rocket.")
		return PLUGIN_HANDLED_MAIN
	}

	if(!is_user_alive(iPerformerID) && get_pcvar_num(g_pCVarKamiRocketLooseOnDeath) > 0) {
		client_print(iPerformerID, iPrintType, "You can't buy a kamikaze rocket when you are dead.")
		return PLUGIN_HANDLED_MAIN
	}

	new Float:flGameTime        = get_gametime()
	new Float:flKamiRocketDelay = get_pcvar_float(g_pCVarKamiRocketDelay)
	new Float:flNextUse         = g_flNextRocketUse[iPerformerID]

	if(flKamiRocketDelay > 0.0 && flNextUse > 0.0 && !(flNextUse <= (flGameTime - flKamiRocketDelay))) {
		client_print(iPerformerID, iPrintType, "You can't buy a kamikaze rocket now, you have to wait %.0f second(s).", floatmax(1.0, flKamiRocketDelay - flGameTime + flNextUse))
		return PLUGIN_HANDLED_MAIN
	}

	new iKamiRocketCost
	if(g_bHasMoneySupport == true && (iKamiRocketCost = get_pcvar_num(g_pCVarKamiRocketCost)) > 0) {
		new iMoney = cs_get_user_money(iPerformerID)

		if(iMoney < iKamiRocketCost) {
			client_print(iPerformerID, iPrintType, "You don't have enough money to buy a kamikaze rocket ($%d needed).", iKamiRocketCost)
			return PLUGIN_HANDLED_MAIN
		}

		new iNewMoney = iMoney - iKamiRocketCost
		cs_set_user_money(iPerformerID, iNewMoney, true)

		client_print(iPerformerID, iPrintType, "You have bought a kamikaze rocket at the price of $%d.", iKamiRocketCost)
	}
	else {
		client_print(iPerformerID, iPrintType, "You have bought a free kamikaze rocket!")
	}

	g_bHasRocket[iPerformerID] = true

	return PLUGIN_HANDLED_MAIN
}

public kamirocket(iPerformerID, iLevel, iCid) {
	if(!cmd_access(iPerformerID, iLevel, iCid, 1))
		return PLUGIN_HANDLED_MAIN

	if(get_pcvar_num(g_pCVarKamiRocketActive) <= 0) {
		client_print(iPerformerID, PRINT_TYPE, "The plugin ^"Kamikaze Rocket^" is disabled.")
		return PLUGIN_HANDLED_MAIN
	}

	if(!g_bHasRocket[iPerformerID]) {
		client_print(iPerformerID, PRINT_TYPE, "You haven't bought a kamikaze rocket, type ^"/buy_kamirocket^" in the chat to buy one.")
		return PLUGIN_HANDLED_MAIN
	}

	// Note: Only when the "loose on death" CVar is disabled.
	if(!is_user_alive(iPerformerID)) {
		client_print(iPerformerID, PRINT_TYPE, "You can't use your kamikaze rocket when you are dead.")
		return PLUGIN_HANDLED_MAIN
	}

	if(g_iRocketMode[iPerformerID] != MODE_NONE) {
		client_print(iPerformerID, PRINT_TYPE, "You are already a kamikaze rocket.")
		return PLUGIN_HANDLED_MAIN
	}

	emit_sound(iPerformerID, CHAN_VOICE, "weapons/rocket1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	emit_sound(iPerformerID, CHAN_BODY, "weapons/rocketfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(TE_BEAMFOLLOW)
	write_short(iPerformerID)
	write_short(g_iSpriteBeam)
	write_byte(30)
	write_byte(5)
	write_byte(254)
	write_byte(27)
	write_byte(0)
	write_byte(128)
	message_end()

	entity_set_float(iPerformerID, EV_FL_gravity, 0.001)
	entity_set_int(iPerformerID, EV_INT_movetype, MOVETYPE_FLY)

	new bool:bFlyMode = (get_pcvar_num(g_pCVarKamiRocketFlyMode) > 0) ? true : false
	new iSpeed

	if(bFlyMode) {
		iSpeed = g_iCVarKamiRocketSpeedGuided = clamp(get_pcvar_num(g_pCVarKamiRocketSpeedGuided), 200, get_pcvar_num(g_pCVarSVMaxVelocity))
	}
	else {
		iSpeed = clamp(get_pcvar_num(g_pCVarKamiRocketSpeedNormal), 200, get_pcvar_num(g_pCVarSVMaxVelocity))
	}

	if(pev(iPerformerID, pev_flags) & FL_ONGROUND) {
		new Float:vOrigin[3]
		entity_get_vector(iPerformerID, EV_VEC_origin, vOrigin)
		vOrigin[2] += 5.0
		entity_set_origin(iPerformerID, vOrigin)
	}

	VelocityByAim(iPerformerID, iSpeed, g_vVelocity[iPerformerID])
	entity_get_vector(iPerformerID, EV_VEC_v_angle, g_vViewAngles[iPerformerID])

	g_iRocketMode[iPerformerID]     = bFlyMode ? MODE_GUIDED : MODE_STRAIGHT
	g_flNextRocketUse[iPerformerID] = get_gametime()

	client_print(iPerformerID, PRINT_TYPE, "You have started your kamikaze action!")

	return PLUGIN_HANDLED_MAIN
}

public client_prethink(iPlayerID) {
	static iRocketMode
	iRocketMode = g_iRocketMode[iPlayerID]

	if(iRocketMode) {
		if(iRocketMode == MODE_GUIDED) {
			VelocityByAim(iPlayerID, g_iCVarKamiRocketSpeedGuided, g_vVelocity[iPlayerID])
			entity_set_vector(iPlayerID, EV_VEC_velocity, g_vVelocity[iPlayerID])
		}
		else {
			entity_set_vector(iPlayerID, EV_VEC_velocity, g_vVelocity[iPlayerID])
			entity_set_vector(iPlayerID, EV_VEC_angles, g_vViewAngles[iPlayerID])
			entity_set_int(iPlayerID, EV_INT_fixangle, 1)
		}
	}
}

public entity_touch(iEntityID, iPlayerID) {
	if(IsPlayer(iPlayerID) && g_iRocketMode[iPlayerID] && !GetEntBits(iEntityID) && entity_get_int(iEntityID, EV_INT_solid) != SOLID_NOT) {
		emit_sound(iPlayerID, CHAN_VOICE, "weapons/rocket1.wav", VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM)
		emit_sound(iPlayerID, CHAN_BODY, "weapons/rocketfire1.wav", VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM)

		new Float:vExplodeAt[3]
		entity_get_vector(iPlayerID, EV_VEC_origin, vExplodeAt)

		entity_set_float(iPlayerID, EV_FL_gravity, 1.0)

		g_iRocketPlayerID = iPlayerID
		radius_damage(vExplodeAt, get_pcvar_num(g_pCVarKamiRocketDamageMulti), get_pcvar_num(g_pCVarKamiRocketRadiusMulti))
		g_iRocketPlayerID = -1

		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_KILLBEAM)
		write_short(iPlayerID)
		message_end()

		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_EXPLOSION)
		write_coord(floatround(vExplodeAt[0]))
		write_coord(floatround(vExplodeAt[1]))
		write_coord(floatround(vExplodeAt[2]))
		write_short(g_iSpriteBoom)
		write_byte(60)
		write_byte(16)
		write_byte(0)
		message_end()

		g_bHasRocket[iPlayerID]  = false
		g_iRocketMode[iPlayerID] = MODE_NONE
	}
}

Публикувай отговор
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 21 госта