Cerere Plugin

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
User avatar
Tw-PRO
Membru, skill +1
Membru, skill +1
Posts: 202
Joined: 12 Aug 2010, 00:40
Detinator Steam: Nu
CS Status: Stau pe mess
Detinator server CS: Zp.XtremeXPC.Ro
SteamID: -
Location: Hunedoara
Has thanked: 11 times
Been thanked: 7 times
Contact:

01 Sep 2010, 16:30

vreau un plugin cred ca e din modu matrix ca zm cand tine apasat space sa se urce pe pereti,Dau +1 multumesc
User avatar
b[L]u
Membru, skill +1
Membru, skill +1
Posts: 314
Joined: 31 May 2010, 13:27
Detinator Steam: Nu
Has thanked: 26 times
Been thanked: 8 times

01 Sep 2010, 17:27

uite aici :d
| Afiseaza codul
// Thanks to cheap_suit for his mazing climbing code

// Release notes:
//  - Added new cvars
//  - Added new climbing code (cheap_suit, Climbing Gear)
//  - Implemented buy system
//  - Cleaned up the code for release
//  - Using pcvars now

/*
Known bugs:
- Climbing is not actually climbing but it has the same effect
- Player can climb on roof also
- (In use mode) You have to jump once or you can't climb

Todo
- Climb-time-limit to stop players climbing forever

Credits:
Thanks to cheap_suit for his mazing climbing code
Also thanks to GHW_Chronic for converting parts of the code to fakemeta

Cvars and commands

Say
 - "/climbon" "/climboff"  --  Enables/disables *players* wallclimb
 - "/Buyclimb"  --  If buymode is activated use this to buy it

Console
 - climbon climboff  --  Read from above
 - buyclimb   --  Read from above

 - amx_climb (1) --  Enable(1) or disable(0) the plugin

 - amx_climb_mode (0)
   - "0" Hold jump and up/down button to climb
   - "1" Hold use key and up/down and press jump
   - "2" Both modes

 - amx_climb_team (2)  --  (for cstrike only) Select the team which can use climbing
   - "0" Terrorists
   - "1" Counter-Terrorists
   - "2" Everyone

 - amx_climb_method (1)
   - "0" Old climbing code (not supported, not recommended to use)
      - I only left it there because in that mode steering doesn't work and also you can't climb on roof
   - "1" New method (suggested)
 - amx_climb_speed (240) --  How fastly use climbs (suggestion: Don't change)

 - amx_climb_buy  (0) -- Control buying
   - "0" Disable buying
   - "1" Enable buying
   - "2" Enable buying but remove after death

 - amx_climb_cost (5000) -- How much it costs to buy it
*/

#include <amxmodx>
// #include <engine>
#include <fakemeta>

#include <cstrike>

#include <fakemeta_util>
#define STR_T           32

// Thanks to cheap_suit for his mazing climbing code

// Release notes:
//  - Added new cvars
//  - Added new climbing code (cheap_suit, Climbing Gear)
//  - Implemented buy system
//  - Cleaned up the code for release


// Known bugs:
// - Climbing is not actually climbing but it has the same effect
// - Player can climb on roof also
// - (In use mode) You have to jump once or you can't climb

// Todo
// - No idea


new bool:ftimeover
new bool:g_WallClimb[33]

new bool:bought_WallClimb[33]

new Float:g_wallorigin[32][3]

new p_climb
new p_climb_mode
new p_climb_team
new p_climb_method
new p_climb_speed
new p_climb_buy
new p_climb_cost

public plugin_init() 
{
	register_plugin("WallClimb", "1.0f", "WallClimb by Python1320, Climbing Gear by Cheap_Suit")

	register_clcmd("say /climbon","Enable_Climb")
	register_concmd("climbon","Enable_Climb")

	register_clcmd("say /climboff","Disable_Climb")
	register_concmd("climboff","Disable_Climb")
	
	
	register_clcmd("say /buyclimb","climb_buy")
	register_concmd("buyclimb","climb_buy")
	
	
	// Enable plugin, yes(1) , no(0)
	p_climb = register_cvar("amx_climb","1")
	// Use mode: 0=jump   1=use  2=both
	p_climb_mode = register_cvar("amx_climb_mode","0")
	
	// ClimbTeam: 2=Everyone  1=Counter-Terrorists 0=Terrorists
	p_climb_team = register_cvar("amx_climb_team","2") 	
	
	// Climbing method 1=New 0=Old
	p_climb_method = register_cvar("amx_climb_method","1") 
	// Climbing speed  - Default: 240  (suggestion: Don't change)
	p_climb_speed = register_cvar("amx_climb_speed", "240.0")
	
	
	// BuyMode: 0= Disabled  1=Enabled   2=Enabled, Remove after death
	p_climb_buy = register_cvar("amx_climb_buy","0") 	
	// Guess....
	p_climb_cost = register_cvar("amx_climb_cost","5000") 		
	
	

	register_logevent("LogEvent_RoundStart", 2, "0=World triggered", "1=Round_Start")
	register_event("TextMsg", "Event_GameRestart", "a", "2=#Game_will_restart_in") 
	register_event("SendAudio", "Event_RoundEnd", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw")
	
	register_forward(FM_Touch, 		"fwd_touch")
	register_forward(FM_PlayerPreThink, 	"fwd_playerprethink")
	register_forward(FM_PlayerPostThink, 	"fwd_playerpostthink")

	register_event("DeathMsg","EventDeathMsg","a")
	
}

public EventDeathMsg()	
{
	if (!(get_pcvar_num(p_climb_buy) == 2)) 
	{
		return PLUGIN_HANDLED	
	}
	new id = read_data(2)
	bought_WallClimb[id] = false

	return PLUGIN_HANDLED
}


public climb_buy(id) {
	
	if (get_pcvar_num(p_climb_buy) == 0) 
	{
		client_print(id, print_chat, "[AMXX] Buying WallClimb is disabled")
		return PLUGIN_HANDLED	
	}
		
	if (cs_get_user_money(id) >= get_pcvar_num(p_climb_cost) && !bought_WallClimb[id] ) 
	{
		cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(p_climb_cost), 1)	
		bought_WallClimb[id] = true
		client_print(id, print_chat, "[AMXX] You have bought WallClimb")
	} 
	else // no money
	{
		client_print(id, print_chat, "[AMXX] You don't have enough money to buy WallClimb or you already have it")
		return PLUGIN_HANDLED
	}

	return PLUGIN_HANDLED	
} 

public client_connect(id) {
	g_WallClimb[id] = true
	
	bought_WallClimb[id] = false
	
} 

public Event_RoundEnd() {
	ftimeover = false
}
	
public Event_GameRestart()
{
	new Float:fRestartCvar = get_cvar_float("sv_restart")
	set_task((fRestartCvar - 0.5), "Event_RoundEnd")	
}

public LogEvent_RoundStart(id) {
	ftimeover = true
}

public Enable_Climb(id) {
	g_WallClimb[id] = true
}

public Disable_Climb(id) {
	g_WallClimb[id] = false
}

public fwd_touch(id, world)
{
	if(!is_user_alive(id) || !g_WallClimb[id])
		return FMRES_IGNORED
	
	new classname[STR_T]
	pev(world, pev_classname, classname, (STR_T-1))
	
	if(equal(classname, "worldspawn") || equal(classname, "func_wall") || equal(classname, "func_breakable"))
		pev(id, pev_origin, g_wallorigin[id])

	return FMRES_IGNORED
}


public fwd_playerprethink(id) 
{
	if(!ftimeover || !g_WallClimb[id] || !get_pcvar_num(p_climb)) 
	{		
	return FMRES_IGNORED
	}  

	new CsTeams:Team = cs_get_user_team(id)
	if(Team == CS_TEAM_T  && get_pcvar_num(p_climb_team) == 1)
	{	
	return FMRES_IGNORED		
	}	else if(Team == CS_TEAM_CT && get_pcvar_num(p_climb_team) == 0)		
	{	
	return FMRES_IGNORED	
	}		
	
	if(!bought_WallClimb[id] && (get_pcvar_num(p_climb_buy) == 1 || get_pcvar_num(p_climb_buy) == 2))
	{	 	
	return FMRES_IGNORED
	}
	
	if (get_pcvar_num(p_climb_method) == 0) 
	{   // Old method  !!!! (not supported but left here if someone finds it better)
		new Float: fVelocity[3]
		new Float:pcvar_speed = get_pcvar_float( p_climb_speed )
		pev(id,pev_velocity,fVelocity)
		new Buttons = pev(id,pev_button)

		if(get_pcvar_num(p_climb_mode) == 1 && Buttons & /*IN_JUMP*/ IN_USE && (Buttons & IN_FORWARD || Buttons & IN_BACK) ) 
		{
			if(fVelocity[0] == 0.0 || fVelocity[1] == 0.0)
			{
				fVelocity[1] = 10.0
				fVelocity[2] = pcvar_speed
				set_pev(id,pev_velocity, fVelocity)
			}
		} else
	if(get_pcvar_num(p_climb_mode) == 0 && Buttons & IN_JUMP/*IN_USE*/  && (Buttons & IN_FORWARD || Buttons & IN_BACK) ) 
    {
        if(fVelocity[0] == 0.0 || fVelocity[1] == 0.0)
        {
            fVelocity[1] = 10.0
            fVelocity[2] = pcvar_speed
            set_pev(id,pev_velocity, fVelocity)
        }
    }
	
	} else if(get_pcvar_num(p_climb_method) == 1) 	
	{  // new method
	
		new button = fm_get_user_button(id)
		
		if (get_pcvar_num(p_climb_mode) == 0 && button & IN_USE && !(button & IN_JUMP)) 
		{
			return FMRES_IGNORED
		}
		else if (get_pcvar_num(p_climb_mode) == 1 && button & IN_JUMP && !(button & IN_USE))
		{
			return FMRES_IGNORED
		}		
		
		if((button & IN_JUMP || button & IN_USE) /*&& button & IN_DUCK*/) 	{
		static Float:origin[3]
		pev(id, pev_origin, origin)
		if(get_distance_f(origin, g_wallorigin[id]) > 10.0)	return FMRES_IGNORED  // if not near wall
		
		if(fm_get_entity_flags(id) & FL_ONGROUND) {
// (works but is buggy)	client_cmd(id,"+jump;wait;-jump")  //workaround for +use climbing
			return FMRES_IGNORED
		}
		
		
		
		if(button & IN_FORWARD)
		{
			static Float:velocity[3]
			velocity_by_aim(id, get_pcvar_num(p_climb_speed), velocity)
			fm_set_user_velocity(id, velocity)
		}
		else if(button & IN_BACK)
		{
			static Float:velocity[3]
			velocity_by_aim(id, -get_pcvar_num(p_climb_speed), velocity)
			fm_set_user_velocity(id, velocity)
		}
	}	
	
	} // end of new method
	return FMRES_IGNORED
}
Nick: MiSteR D
Image
Post Reply

Return to “Cereri”

  • Information