Raised This Month: $51 Target: $400
 12% 

teleport doesn't work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
North_Fiv3
Junior Member
Join Date: Mar 2021
Old 03-28-2021 , 14:35   teleport doesn't work
Reply With Quote #1

Hi! Anyone can take a look to this plugin? It doesn't teleport you when you are bellow 50 hp

Code:
/*
#include <amxmodx>
#include <engine>
#include "runemod.inc"		// We need to include this file, as it contains info we need. Like #define`s and stocks

#define REDEEM_MINIMALDISTANCE 100.0

new g_HasRune[MAXPLAYERS+1] // This is the Array used to store if the user is holding a rune.(Remember the base plugin informs this plugin once he picks up a rune.)
new g_MaxPlayers

public plugin_init() 
{
	register_plugin("RuneMod Redeem", "1.0.1", "EKS")
	g_MaxPlayers = get_maxplayers()
	RegisterPlugin("RedeemName","RedeemDisc",{20,255,127},API_EVENTDAMAGEDONE+API_USELANGSYSTEM)
}

public API_DamageDone(victim,attacker,damage)
{

	if(g_HasRune[victim])
	{
		if(entity_get_float(victim,EV_FL_health) <= 50.0 && !task_exists(victim,1))
		{	
			set_task(0.1,"Task_MovePlayer",victim,_,_,"a",1)
			return PLUGIN_CONTINUE
		}
	}
	return PLUGIN_CONTINUE
}
public Task_MovePlayer(id)
{
	if(!is_user_alive(id)) return PLUGIN_CONTINUE
	new Team = get_user_team(id)
	new TelePortTo=0
	for(new i=1;i<=g_MaxPlayers;i++)
	{
		if(i != id && Team == get_user_team(i) && is_user_alive(i) && entity_range(i,id) >= REDEEM_MINIMALDISTANCE)
		{
			{
				new Float:Origin[3]
				entity_get_vector(i,EV_VEC_origin,Origin)
				Origin[2] = Origin[2] +20.0		
				
				for(new b=0;b<=2;b++)
				{
					if(random_num(0,1) == 1)
					{
						Origin[0] = Origin[0] + random_float(20.0,50.0)
						Origin[1] = Origin[1] + random_float(20.0,50.0)
					}
					else
					{
						Origin[0] = Origin[0] + random_float(-50.0,-20.0)
						Origin[1] = Origin[1] + random_float(-50.0,-20.0)
					}
					
					if(CheckVectorContent(Origin) == 1)
					{	
						TelePortTo = i
						break
					}
				}
				if(TelePortTo)
				{
					new IntOrigin[3]
					IntOrigin[0] = floatround(Origin[0])
					IntOrigin[1] = floatround(Origin[1])
					IntOrigin[2] = floatround(Origin[2])
					MakeTeleport(IntOrigin)

					get_origin(id,IntOrigin)
					entity_set_vector(id,EV_VEC_origin,Origin)
					client_print(id,print_chat,"%L",LANG_PLAYER,"RedeemTelepAway")
					MakeExpl(0,IntOrigin)
					MakeSmoke(0,IntOrigin)
					MakeSmoke(0,IntOrigin)					
					return PLUGIN_CONTINUE
				}
			}
		}
	}
	return PLUGIN_CONTINUE
}

public API_DropedRune(id,Reason) //This function is called by the base plugin to inform about the user droped his rune for whatever reason ( he could have used droprune or died )
{
	g_HasRune[id] = 0
	remove_task(id)
}

// This function is used base plugin to inform this plugin that a user has picked up the rune.
public API_PickUpRune(id) 
{
	g_HasRune[id] = 1
}
stock CheckVectorContent(Float:Origin[3])	// This function check how close a rune spawnpoint is to other rune spawnpoints. And removes any that witin MIN_DISTANCE_BETWEEN_RUNES ( runemod.inc )
{
	if(point_contents(Origin) != CONTENTS_EMPTY)
		return 0
	
	Origin[0] += 5.0	
	if(point_contents(Origin) != CONTENTS_EMPTY)
		return 0

	Origin[0] -= 10.0	
	if(point_contents(Origin) != CONTENTS_EMPTY)
		return 0

	Origin[0] += 5.0
	Origin[1] += 5.0
	if(point_contents(Origin) != CONTENTS_EMPTY)
		return 0

	Origin[1] -= 10.0
	if(point_contents(Origin) != CONTENTS_EMPTY)
		return 0
		
	Origin[1] += 5.0
	Origin[2] += 5.0
	if(point_contents(Origin) != CONTENTS_EMPTY)
		return 0

	Origin[2] -= 10.0
	if(point_contents(Origin) != CONTENTS_EMPTY)
		return 0		
	return 1
}
North_Fiv3 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-28-2021 , 17:26   Re: teleport doesn't work
Reply With Quote #2

this is the scripting help section, if you have 0 experience in coding, go post in the suggestion request forums.

if you do have experience try debugging your code first of all.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-28-2021 at 17:26.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 03-29-2021 , 00:36   Re: teleport doesn't work
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
this is the scripting help section, if you have 0 experience in coding, go post in the suggestion request forums.

if you do have experience try debugging your code first of all.
omg man :-j chill out.

ON: Remove
PHP Code:
entity_get_float(victim,EV_FL_health) <= 50.0 && 
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
North_Fiv3
Junior Member
Join Date: Mar 2021
Old 03-29-2021 , 08:47   Re: teleport doesn't work
Reply With Quote #4

Sry for wrong post.

Quote:
Originally Posted by CryWolf View Post
omg man :-j chill out.

ON: Remove
PHP Code:
entity_get_float(victim,EV_FL_health) <= 50.0 && 
Ty mate! I tried to give me some dmg with he grenade to see what happens when I'm below 50 hp but nothing happend. I will try again later against a player
North_Fiv3 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 17:53.


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