Raised This Month: $32 Target: $400
 8% 

Knife mod Respawns me under the map?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MerreBigger
Senior Member
Join Date: Nov 2012
Location: Belgium
Old 03-18-2018 , 16:07   Knife mod Respawns me under the map?
Reply With Quote #1

Hi guys,
I've been looking for a simple Knife Deathmatch plugin,
I found one, but when i get respawned, it spawns me under the map?
Here is the plugin code
Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <engine>
#include <fakemeta>

new cvar_enabled, cvar_hp, cvar_hp_hs, cvar_gamename, amx_gamename

public plugin_init()
{
	register_plugin("Knife DeathMatch", "1.1", "Lucky")
	
	register_event("DeathMsg", "on_Death", "a")
	register_event("CurWeapon", "knife", "b")
	
	cvar_enabled = register_cvar("amx_knifedm", "1")
	cvar_hp = register_cvar("amx_knifedm_hp", "0")
	cvar_hp_hs = register_cvar("amx_knifedm_hp_hs", "0")
	cvar_gamename = register_cvar("amx_knifedm_gamename", "1")

	if(get_pcvar_num(cvar_gamename) == 1)
	{
		amx_gamename = register_cvar("amx_gamename", "Knife DM" )
		register_forward(FM_GetGameDescription, "GameDesc")
	}
	
	if(get_pcvar_num(cvar_enabled) == 1)
	{
		remove_entity_name("func_bomb_target")
		remove_entity_name("info_bomb_target")
		remove_entity_name("hostage_entity")
		remove_entity_name("func_hostage_rescue")
		remove_entity_name("info_hostage_rescue")
		remove_entity_name("info_vip_start")
		remove_entity_name("func_vip_safetyzone")
		remove_entity_name("func_escapezone")
		
		removeweapons()
		
		server_cmd("sv_restart 2")
	}
}

public knife(id)
{
	if(get_pcvar_float(cvar_enabled) == 1)
	{
        new clip, ammo
        new usersweapon = get_user_weapon(id, clip, ammo)

        if(usersweapon == CSW_KNIFE)
		{
			return PLUGIN_CONTINUE
		}
		else
		{
			new origin[3]
			get_user_origin (id, origin)
			origin[2] -= 500
			set_user_origin (id, origin)
			new iwpn, iwpns[32], nwpn[32]
			get_user_weapons (id, iwpns, iwpn)
			for (new a = 0; a < iwpn; ++a)
			{
				get_weaponname (iwpns[a], nwpn, 31)
				engclient_cmd (id, "drop", nwpn)
			}
			origin[2] += 500
			set_user_origin (id, origin)

			client_cmd (id, "weapon_knife")
        }
    }
	return PLUGIN_CONTINUE
}

public on_Death()
{
	if(get_pcvar_float(cvar_enabled) == 1)
	{
		new id = read_data(2)
		set_task(1.0, "spawn_user", id)
	}
}

public spawn_user(id)
{
	if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
	{
		return PLUGIN_HANDLED
	}
	
	ExecuteHamB(Ham_CS_RoundRespawn, id)
	return PLUGIN_HANDLED
}

public client_death(killer, victim, wpnindex, hitplace, TK)
{
	if(get_pcvar_float(cvar_enabled) == 1)
	{
		if(hitplace == HIT_HEAD)
		{
			set_user_health(killer, get_user_health(killer) + get_pcvar_num(cvar_hp_hs))
			
			set_hudmessage(255, 0, 0, 0.1, -1.0, 0, 6.0, 10.0)
			show_hudmessage(killer, "HeadShot")
		}
		else
		{
			set_user_health(killer, get_user_health(killer) + get_pcvar_num(cvar_hp))
		}
	}
}

public client_connect(id)
{
	if(get_pcvar_num(cvar_enabled) == 1)
	{
		set_task(20.0, "connect_ads", id)
	}
}

public connect_ads(id)
{
	client_print(id, print_chat, "|Fg| To buy admin or VIP, add Merouane789 on steam.")
	client_print(id, print_chat, "You can use only knife!")
}

public GameDesc()
{
	static gamename[32]
	get_pcvar_string(amx_gamename, gamename, 31)
	forward_return(FMV_STRING, gamename)
	return FMRES_SUPERCEDE
}

removeweapons()
{
	new weapon, nnumr
	
	while ((weapon = find_ent_by_class(-1,"armoury_entity")))
	{
		remove_entity(weapon)
		nnumr++
	}
}
__________________
___________________________________________


MerreBigger is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 03-18-2018 , 16:46   Re: Knife mod Respawns me under the map?
Reply With Quote #2

i would like to know why that doesnt work

are you sure its not map problem or not enough spawn positions (if you have full server) ?
JocAnis is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 03-18-2018 , 18:07   Re: Knife mod Respawns me under the map?
Reply With Quote #3

Just use CSDM2 with pistol strip and without weapons menu.
__________________
My English is A0
E1_531G is offline
MerreBigger
Senior Member
Join Date: Nov 2012
Location: Belgium
Old 03-19-2018 , 04:20   Re: Knife mod Respawns me under the map?
Reply With Quote #4

how do you mean ' not map problem '
And no the server is empty, when i commit suicide it respawns me under the map. But when i join the server, and i get spawned for the first time, i get spawned correctly, but when i die and i get respawned, i get stuck under the map.
__________________
___________________________________________


MerreBigger is offline
MerreBigger
Senior Member
Join Date: Nov 2012
Location: Belgium
Old 03-19-2018 , 04:20   Re: Knife mod Respawns me under the map?
Reply With Quote #5

how do i do that CSDM?
__________________
___________________________________________


MerreBigger is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-20-2018 , 16:21   Re: Knife mod Respawns me under the map?
Reply With Quote #6

I'm just taking a wild guess here.
Code:
            new origin[3]
            get_user_origin (id, origin)
            origin[2] -= 500
            set_user_origin (id, origin)
            new iwpn, iwpns[32], nwpn[32]             get_user_weapons (id, iwpns, iwpn)             for (new a = 0; a < iwpn; ++a)             {                 get_weaponname (iwpns[a], nwpn, 31)                 engclient_cmd (id, "drop", nwpn)             }
            origin[2] += 500
            set_user_origin (id, origin)
I think there's a function to strip a users weapons instead of doing this.
__________________

Last edited by Black Rose; 03-20-2018 at 16:22.
Black Rose is offline
MerreBigger
Senior Member
Join Date: Nov 2012
Location: Belgium
Old 03-24-2018 , 17:53   Re: Knife mod Respawns me under the map?
Reply With Quote #7

i don't understand what i have to do now, i tried alot of respawn plugins, they all respawn me under the map.
__________________
___________________________________________


MerreBigger is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode