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

Parachute vip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
agrafos97
Junior Member
Join Date: Feb 2012
Old 03-25-2012 , 06:35   Parachute vip
Reply With Quote #1

They could put this plugin only for VIP flag with B.
Place parachute free at the beginning of each round just click on E.

Code:
#include <amxmodx>
#include <engine>
#include <fun>
#include <hamsandwich>

#include "furien.inc"
#include "furien_shop.inc"

#define MAX_PLAYERS		32

new g_szParaModel[64]

new Float:g_flFallSpeed

new g_bHasParachute
#define SetUserParachute(%1)		g_bHasParachute |=	1<<(%1&31)
#define RemoveUserParachute(%1)	g_bHasParachute &=	~(1<<(%1&31))
#define HasUserAutoParachute(%1)	g_bHasParachute &	1<<(%1&31)


new g_iParachute[MAX_PLAYERS+1]
new Float:g_flFrame[MAX_PLAYERS+1]

new g_iCost[2]

public plugin_precache()
{
	register_plugin("AMX Parachute", "1.4.0", "KRoT@L")

	new szConfigFile[128]
	get_localinfo("amxx_configsdir", szConfigFile, charsmax(szConfigFile))
	format(szConfigFile, charsmax(szConfigFile), "%s/furien/items/parachute.ini", szConfigFile);

	new fp = fopen(szConfigFile, "rt")
	if( !fp )
	{
		return
	}

	new szFurienName[32], szAntiName[32]

	new szDatas[80], szKey[16], szValue[64]
	while( !feof(fp) )
	{
		fgets(fp, szDatas, charsmax(szDatas))
		trim(szDatas)
		if(!szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/'))
		{
			continue
		}

		parse(szDatas, szKey, charsmax(szKey), szValue, charsmax(szValue))

		switch( szKey[0] )
		{
			case 'A':
			{
				switch( szKey[7] )
				{
					case 'M':
					{
						if( equal(szKey, "ANTI_NAME" ) )
						{
							copy(szAntiName, charsmax(szAntiName), szValue)
						}
					}
					case 'S':
					{
						if( equal(szKey, "ANTI_COST" ) )
						{
							g_iCost[AntiFurien] = str_to_num(szValue)
						}
					}
				}
			}
			case 'F':
			{
				switch( szKey[9] )
				{
					case 'M':
					{
						if( equal(szKey, "FURIEN_NAME" ) )
						{
							copy(szFurienName, charsmax(szAntiName), szValue)
						}
					}
					case 'S':
					{
						if( equal(szKey, "FURIEN_COST" ) )
						{
							g_iCost[Furien] = str_to_num(szValue)
						}
					}
				}
			}
			case 'P':
			{
				switch( szKey[5] )
				{
					case 'M':
					{
						if( equal(szKey, "PARA_MODEL" ) )
						{
							copy(g_szParaModel, charsmax(g_szParaModel), szValue)
							precache_model(g_szParaModel)
						}
					}
					case 'F':
					{
						if( equal(szKey, "PARA_FALLSPEED" ) )
						{
							g_flFallSpeed = -str_to_float(szValue)
						}
					}
				}
			}
		}
	}
	fclose( fp )

	if( g_iCost[Furien] || g_iCost[AntiFurien] )
	{
		furien_register_item(szFurienName, g_iCost[Furien], szAntiName, g_iCost[AntiFurien], "furien_buy_parachute")	

		RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
		RegisterHam(Ham_Killed, "player", "Player_Killed", 1)
	}
}

public furien_team_change( /*iFurien */ )
{
	if( !g_iCost[Furien] || !g_iCost[AntiFurien] )
	{
		g_bHasParachute = 0
	}
}

public furien_round_restart()
{
	g_bHasParachute = 0
}

public furien_buy_parachute( id )
{
	new iTeam = furien_get_user_team(id)
	if( iTeam == -1 )
	{
		return ShopCloseMenu
	}

	new iItemCost = g_iCost[iTeam]
	if( iItemCost <= 0 )
	{
		return ShopTeamNotAvail
	}

	if( ~HasUserAutoParachute(id) )
	{
		if( furien_try_buy(id, iItemCost) )
		{
			SetUserParachute( id )
			return ShopBought
		}
		else
		{
			return ShopNotEnoughMoney
		}
	}
	return ShopAlreadyHaveOne
}

public client_disconnect(id)
{
	parachute_reset(id, false)
}

public Player_Spawn(id)
{
	parachute_reset(id, false)
}

public Player_Killed(id)
{
	parachute_reset(id, true)
	RemoveUserParachute(id)
}

public client_putinserver(id)
{
	RemoveUserParachute(id)
}

parachute_reset(id, bool:bReSetGravity = true)
{
	new iEnt = g_iParachute[id]
	if( iEnt > 0 )
	{
		if( is_valid_ent(iEnt) )
		{
			entity_set_int(iEnt, EV_INT_flags, FL_KILLME)
		}
	}

	if( bReSetGravity && is_user_alive(id) )
	{
		set_user_gravity(id)
	}

	g_iParachute[id] = 0
}

public client_PreThink(id)
{
	if( ~HasUserAutoParachute(id) || !is_user_alive(id) )
	{
		return
	}
	//parachute.mdl animation information
	//0 - deploy - 84 frames
	//1 - idle - 39 frames
	//2 - detach - 29 frames

	static const info_target[] = "info_target"
	static iEnt, Float:flFrame
	iEnt = g_iParachute[id]
	flFrame = g_flFrame[id]

	if ( iEnt > 0 && entity_get_int(id, EV_INT_flags) & FL_ONGROUND )
	{	
		if ( get_user_gravity(id) == 0.1 )
		{
			set_user_gravity(id)
		}

		if( entity_get_int(iEnt, EV_INT_sequence) != 2 )
		{
			entity_set_int(iEnt, EV_INT_sequence, 2)
			entity_set_int(iEnt, EV_INT_gaitsequence, 1)

			entity_set_float(iEnt, EV_FL_frame, 0.0)
			g_flFrame[id] = 0.0

			entity_set_float(iEnt, EV_FL_animtime, 0.0)
			entity_set_float(iEnt, EV_FL_framerate, 0.0)
			return
		}

		flFrame += 2.0
		entity_set_float(iEnt, EV_FL_frame, flFrame)

		if ( flFrame > 254.0 )
		{
			entity_set_int(iEnt, EV_INT_flags, FL_KILLME)
			iEnt = 0
		}
	}
	
	else if(entity_get_int(id, EV_INT_button) & IN_USE)
	{
		new Float:velocity[3]
		entity_get_vector(id, EV_VEC_velocity, velocity)

		if ( velocity[2] < 0.0 )
		{
			if ( iEnt <= 0 )
			{
				iEnt = create_entity(info_target)
				if( iEnt > 0 )
				{
					entity_set_edict(iEnt, EV_ENT_aiment, id)
					entity_set_edict(iEnt, EV_ENT_owner, id)
					entity_set_int(iEnt, EV_INT_movetype, MOVETYPE_FOLLOW)
					entity_set_model(iEnt, g_szParaModel)
					entity_set_int(iEnt, EV_INT_sequence, 0)
					entity_set_int(iEnt, EV_INT_gaitsequence, 1)

					flFrame = 0.0
					entity_set_float(iEnt, EV_FL_frame, 0.0)
				}
			}

			if ( iEnt > 0 )
			{
				entity_set_int(id, EV_INT_sequence, 3)
				entity_set_int(id, EV_INT_gaitsequence, 1)
				entity_set_float(id, EV_FL_frame, 1.0)
				entity_set_float(id, EV_FL_animtime, 100.0)
				entity_set_float(id, EV_FL_framerate, 1.0)
				set_user_gravity(id, 0.1)

				velocity[2] += 40
				velocity[2] = (velocity[2] < g_flFallSpeed) ? velocity[2] : g_flFallSpeed
				entity_set_vector(id, EV_VEC_velocity, velocity)

				if ( entity_get_int(iEnt, EV_INT_sequence) == 0 )
				{
					flFrame += 1.0
					entity_set_float(iEnt, EV_FL_frame, flFrame)

					if ( flFrame > 100.0 )
					{
						entity_set_float(iEnt, EV_FL_animtime, 120.0)
						entity_set_float(iEnt, EV_FL_framerate, 0.4)
						entity_set_int(iEnt, EV_INT_sequence, 1)
						entity_set_int(iEnt, EV_INT_gaitsequence, 1)
						flFrame = 0.0
						entity_set_float(iEnt, EV_FL_frame, 0.0)
					}
				}
			}
		}
		else if ( iEnt > 0 )
		{
			entity_set_int(iEnt, EV_INT_flags, FL_KILLME)
			set_user_gravity(id)
			iEnt = 0
		}
	}
	
	else if( iEnt > 0 && get_user_oldbutton(id) & IN_USE )
	{
		entity_set_int(iEnt, EV_INT_flags, FL_KILLME)
		set_user_gravity(id)
		iEnt = 0
	}

	g_iParachute[id] = iEnt
	g_flFrame[id] = flFrame
}

Last edited by agrafos97; 03-25-2012 at 06:38.
agrafos97 is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 03-25-2012 , 07:25   Re: Parachute vip
Reply With Quote #2

PHP Code:
 if (get_user_flags(id) && ADMIN_KICK)
{
your code
}
else
{
client_print(id"You have to be VIP")


Last edited by Bilal Pro; 03-25-2012 at 07:25.
Bilal Pro is offline
agrafos97
Junior Member
Join Date: Feb 2012
Old 03-25-2012 , 07:34   Re: Parachute vip
Reply With Quote #3

Quote:
Originally Posted by Bilal Pro View Post
PHP Code:
 if (get_user_flags(id) && ADMIN_KICK)
{
your code
}
else
{
client_print(id"You have to be VIP")

I do not understand
agrafos97 is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 03-25-2012 , 10:39   Re: Parachute vip
Reply With Quote #4

PHP Code:
 if (get_user_flags(id) && ADMIN_KICK

Put your code here!

else 

client_print(id"You have to be VIP"


Last edited by Bilal Pro; 03-25-2012 at 10:39.
Bilal Pro is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-25-2012 , 10:46   Re: Parachute vip
Reply With Quote #5

Stop to help Bilal Pro, you don't know what you're doing, it would be & and not &&.
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-25-2012 , 11:16   Re: Parachute vip
Reply With Quote #6

+1 you are really annoying, i will request a ban if you don't stop
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 03-25-2012 at 11:16.
ConnorMcLeod is offline
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 03-25-2012 , 12:05   Re: Parachute vip
Reply With Quote #7

Attach those includes "furien.inc" & "furien_shop.inc" I will try to help you.

Last edited by bazhenov93; 03-25-2012 at 12:17.
bazhenov93 is offline
agrafos97
Junior Member
Join Date: Feb 2012
Old 03-25-2012 , 12:55   Re: Parachute vip
Reply With Quote #8

Quote:
Originally Posted by bazhenov93 View Post
Attach those includes "furien.inc" & "furien_shop.inc" I will try to help you.
Are there!
furien.inc
Quote:
#if defined _furien
#endinput
#endif
#define _furien

#pragma reqlib furien

#define FURIEN_VERSION "0.4.4"

enum _:ItemRestriction {
Furien,
AntiFurien
}

forward furien_team_change(id);
forward furien_round_restart(id);
native furien_get_user_team(id);
Attached Files
File Type: inc furien_shop.inc (460 Bytes, 244 views)

Last edited by agrafos97; 03-25-2012 at 12:56.
agrafos97 is offline
Xvil
BANNED
Join Date: Feb 2012
Old 03-25-2012 , 13:01   Re: Parachute vip
Reply With Quote #9

Quote:
Originally Posted by Arkshine View Post
Stop to help Bilal Pro, you don't know what you're doing, it would be & and not &&.
Quote:
Originally Posted by ConnorMcLeod View Post
+1 you are really annoying, i will request a ban if you don't stop
Can i Help it ??

Last edited by Xvil; 03-25-2012 at 13:02.
Xvil is offline
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 03-25-2012 , 14:04   Re: Parachute vip
Reply With Quote #10

OK, try this one. I tested it without the " furien " mod, because I don't have it. And work perfectly.
Attached Files
File Type: sma Get Plugin or Get Source (parachute.sma - 950 views - 6.7 KB)
bazhenov93 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 12:56.


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