DeFRAG 1.0 BETA
by superNOVA_
Description: DeFRAG is a plugin that modify the game experience of the user. Super speed, total control and trick maps are the mains points. If you want a totally new experience try this!
No more need of svdefrag.cfg! Server config added in the plugin! =)
Have fun with it! And I'm looking for one or two mappers
How to :
Download defrag.sma
cldefrag
defrag_trainv2b
For executing! Place defrag.amxx in plugin folder and add it to the plugins.ini file [found in the amxmodx/configs folder]
place cldefrag in your cstrike folder
Launch game and exec cldefrag.cfg
Play the game
New map out to! defrag_trainv2b -> Harder friends harder....
Here's some pics of each part of the map! First line is knife speed part, second is scout part!!
And a video too
http://www.dailymotion.com/video/x8q...s16_videogames :
streaming with sound
http://www.youtube.com/watch?v=Wj6is36wRaE : streaming (without sound)
http://www.filedropper.com/defrag_2 : direct download
Continue giving me advice it motives me to do great work for the community
Cya and have fun with the plugin
Quote:
Changelog
0.1 - Pasted different codes without any kind of experience
0.5 - Added scout_conc
0.6 - Modified scout cvar to be a bit harder
0.9 - Redone part of the code need some explanation from pro to do better
0.91 - Removed double register_forward!
1.0 - Recoded many many things
Plugin Change to come
- Add Noclip and Grenade conc
MAP Change to come :
-Help printed on wall to fully understand the process
|
PHP Code:
/*
DeFRAG for CS1.6
Version 1.0
By superNOVA_
Information about this plugin can be found at:
https://forums.alliedmods.net/showthread.php?t=87863
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#define PLUGIN "DeFRAG"
#define AUTHOR "superNOVA_"
#define VERSION "1.0"
new bool:g_bAlive[33]
new lastammo[33]
new lastweap[33]
new defrag_scoutpush
new defrag_scoutradius
new g_defrag_nodamages
new g_pcvarGravity
new g_iCdWaterJumpTime[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
// SERVER CVARS
set_cvar_num ("sv_gravity", 600) // Set the server gravity [600 for DeFRAG is really good]
set_cvar_num ("sv_maxspeed", 1500) // Set player maxspeed
set_cvar_num ("mp_startmoney", 0) // Set player start money [Don't make buy zone in DeFRAG just place armory_entity]
set_cvar_num ("mp_timelimit", 0) // Time before map changes
set_cvar_num ("sv_airaccelerate", 100)
set_cvar_num ("mp_freezetime", 0)
set_cvar_num ("mp_autoteambalance", 0)
set_cvar_num ("mp_limitteams", 0)
register_clcmd ( "+sprint", "defrag_start_sprint")
register_clcmd ( "-sprint", "defrag_stop_sprint")
register_event("CurWeapon","make_tracer", "be", "1=1");
RegisterHam(Ham_TakeDamage, "player", "defrag_nodamages")
RegisterHam(Ham_Player_Jump, "player", "Player_Jump")
register_forward(FM_UpdateClientData, "UpdateClientData")
register_forward(FM_CmdStart, "CmdStart")
RegisterHam(Ham_Spawn, "player", "Check_Alive", 1)
RegisterHam(Ham_Killed, "player", "Check_Alive", 1)
g_pcvarGravity = get_cvar_pointer("sv_gravity")
// DeFRAG Sprint CVARS
#define KNIFE_SPRINT_SPEED 1500.0 // Define the speed when using +sprint cmd
#define KNIFE_DEFAULT_SPEED 500.0 // Define normal move speed with the knife (Default Cs1.6 = 250)
// DeFRAG Scout CVARS
defrag_scoutpush = register_cvar("scout_conc","1000.0"); // Force of the push
defrag_scoutradius = register_cvar("scout_radius","1000.0"); // Area covered by the push
#define CONC_WEAP CSW_SCOUT // Define wich weapon to use for having a conc push
// DeFRAG No Damages
g_defrag_nodamages = register_cvar ("mp_falldamage", "0.0") // Set the amount of damages taken from falling (1 = normal damages)
// DeFRAG BHOP
#define PLAYER_JUMP 6
}
public Check_Alive(id)
{
g_bAlive[id] = bool:is_user_alive(id)
}
// DeFRAG Knife
new const g_szKnifeModel[] = "models/v_knife.mdl"; // To set the knife model! Easy if you want to use custom models (will make some soon just for DeFRAG)
const KNIFE_DRAW_ANIMATION = 3;
public defrag_start_sprint ( const PlayerId )
{
if ( get_user_weapon ( PlayerId ) == CSW_KNIFE )
{
UTIL_SetPlayerSpeed ( PlayerId, KNIFE_SPRINT_SPEED );
set_pev ( PlayerId, pev_viewmodel2, "" );
}
return PLUGIN_HANDLED;
}
public defrag_stop_sprint ( const PlayerId )
{
if( get_user_weapon( PlayerId ) == CSW_KNIFE )
{
UTIL_SetPlayerSpeed ( PlayerId, KNIFE_DEFAULT_SPEED );
set_pev( PlayerId, pev_viewmodel2, g_szKnifeModel );
set_pev( PlayerId, pev_weaponanim, KNIFE_DRAW_ANIMATION );
message_begin( MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, PlayerId );
write_byte( KNIFE_DRAW_ANIMATION );
write_byte( pev( PlayerId, pev_body ) );
message_end();
}
return PLUGIN_HANDLED;
}
UTIL_SetPlayerSpeed ( const PlayerId, const Float:Speed )
{
set_pev( PlayerId, pev_maxspeed, Speed );
engfunc( EngFunc_SetClientMaxspeed, PlayerId, Speed );
}
// DeFRAG Scout
stock get_velocity_from_origin( ent, Float:fOrigin[3], Float:fSpeed, Float:fVelocity[3] )
{
new Float:fEntOrigin[3];
pev( ent, pev_origin, fEntOrigin );
// Velocity = Distance / Time
new Float:fDistance[3];
fDistance[0] = fEntOrigin[0] - fOrigin[0];
fDistance[1] = fEntOrigin[1] - fOrigin[1];
fDistance[2] = fEntOrigin[2] - fOrigin[2];
new Float:fTime = ( vector_distance( fEntOrigin,fOrigin ) / fSpeed );
fVelocity[0] = fDistance[0] / fTime;
fVelocity[1] = fDistance[1] / fTime;
fVelocity[2] = fDistance[2] / fTime;
return ( fVelocity[0] && fVelocity[1] && fVelocity[2] );
}
// Sets velocity of an entity (ent) away from origin with speed (speed)
stock set_velocity_from_origin( ent, Float:fOrigin[3], Float:fSpeed )
{
new Float:fVelocity[3];
get_velocity_from_origin( ent, fOrigin, fSpeed, fVelocity )
set_pev( ent, pev_velocity, fVelocity );
return ( 1 );
}
public make_tracer(id)
{
new Float:maxboost = get_pcvar_float( defrag_scoutpush );
if( !maxboost )
return;
new weap = read_data(2); // id of the weapon
new ammo = read_data(3); // ammo left in clip
if( weap == CONC_WEAP && g_bAlive[id] ){
if( lastweap[id] == 0 )
lastweap[id] = weap;
if( lastammo[id] > ammo && lastweap[id] == weap ){
new Vec[3], Float:fVec[3], Float:origin[3];
get_user_origin(id, Vec, 3);
IVecFVec(Vec, fVec);
pev(id, pev_origin, origin);
new Float:dist = get_distance_f( origin, fVec );
new Float:radius = get_pcvar_float( defrag_scoutradius );
if(dist <= radius){
new Float:boost = maxboost - ( ( maxboost * dist) / radius );
set_velocity_from_origin(id, fVec, boost);
}
}
lastammo[id] = ammo;
lastweap[id] = weap;
}
}
// DeFRAG nodamages
public defrag_nodamages(id, ent, idattacker, Float:damage, damagebits)
{
if( damagebits != DMG_FALL )
return HAM_IGNORED
damage *= get_pcvar_float(g_defrag_nodamages)
SetHamParamFloat(4, damage)
return HAM_HANDLED
}
// DeFRAG BHOP
public CmdStart(id, uc_handle, seed)
{
if( g_bAlive[id] && get_uc(uc_handle, UC_Buttons) & IN_USE && pev(id, pev_flags) & FL_ONGROUND )
{
static Float:fVelocity[3]
pev(id, pev_velocity, fVelocity)
fVelocity[0] *= 0.3
fVelocity[1] *= 0.3
fVelocity[2] *= 0.3
set_pev(id, pev_velocity, fVelocity)
}
}
public Player_Jump(id)
{
if( !g_bAlive[id]
|| g_iCdWaterJumpTime[id]
|| pev(id, pev_waterlevel) >= 2 )
{
return
}
static iFlags ; iFlags = pev(id, pev_flags)
if( !(iFlags & FL_ONGROUND) )
{
return
}
static iOldButtons ; iOldButtons = pev(id, pev_oldbuttons)
if( iOldButtons & IN_JUMP )
{
return
}
set_pev(id, pev_oldbuttons, iOldButtons | IN_JUMP)
static Float:fVelocity[3]
pev(id, pev_velocity, fVelocity)
static Float:fFrameTime, Float:fPlayerGravity
global_get(glb_frametime, fFrameTime)
pev(id, pev_gravity, fPlayerGravity)
fVelocity[2] = 268.328157 - fPlayerGravity * fFrameTime * 0.5 * get_pcvar_num(g_pcvarGravity)
set_pev(id, pev_velocity, fVelocity)
set_pev(id, pev_gaitsequence, PLAYER_JUMP)
set_pev(id, pev_frame, 0.0)
}
public UpdateClientData(id, sendweapons, cd_handle)
{
g_iCdWaterJumpTime[id] = get_cd(cd_handle, CD_WaterJumpTime)
}
Credit goes to
ConnorMcLeod : Bhop script ->
http://forums.alliedmods.net/showthr...light=slowdown
skyjur : Semiclip ->
http://forums.alliedmods.net/showthr...light=semiclip post #6
arkshine : Sprint plugin code [VERSION 2] ->
http://forums.alliedmods.net/showthread.php?t=85767 post #10
Meow meow : Scout conc ->
http://forums.alliedmods.net/showthr...highlight=conc [Original idea from Fatalis]