Raised This Month: $13 Target: $400
 3% 

DeFRAG [1.0 OUT] // News to come soon!


Post New Thread Reply   
 
Thread Tools Display Modes
khios
Junior Member
Join Date: Mar 2009
Location: Belgium
Old 03-18-2009 , 20:06   Re: DeFRAG
Reply With Quote #21

Quote:
Originally Posted by Nextra View Post
This.

There are currently more than 3 different identation styles in your plugin. You should really take some time to work on the code instead of just pasting everything into one file. I did not look through the entire code but I bet there are enough things that can be done better easily.

Few things I noticed:
- You should put global constants and defines at the top of the file..
- You do not use g_bAlive in the whole code. You want to use a global variable so do not use is_user_alive anymore. Thats an example copy and paste fails and you should review the code.
- There are two register_forward for each post and prethink, one of each without the required function wich will cause errors in plugin_init, often preventing it from executing following code.
- Again, fix your identation and use one (read: your) style accross the whole plugin.

regards.
Thanks Nextra now I know a little bit more what to change and where =)

Will work on it soon
khios is offline
Send a message via MSN to khios Send a message via Skype™ to khios
khios
Junior Member
Join Date: Mar 2009
Location: Belgium
Old 03-19-2009 , 04:59   Re: DeFRAG [New map coming soon!]
Reply With Quote #22

NEWS!

So here's my own code for the plugin! It has only speed and scout for now but I wanna know if you people think it look better??

Just a hint! Line 178 I wanna change cs_get_weaopn_ammo to use fakemeta or other module so that I don't have to include <cstike> any idea?

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>

/*Hello people and welcome to DeFRAG for CS1.6!
Most of the code here is taken from anothers plugins that already exist. I'm a totally beginner in amxx coding so I need time to understand fully how it works.
If someone better than me want to make it I will be gratefull, I just got the idea nothing more :)

CREDITS 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]

Watch scout conc in action -> http://www.youtube.com/watch?v=g0lBufjXakI

That is DeFRaG on Quake 3 -> http://www.youtube.com/watch?v=fqq9YcmHW1A*/

#define MAX_PLAYERS 20            // Define max_players on DeFRAG server
#define BUNNYJUMP_MAX_SPEED_FACTOR 1.0    // Define speed gained when using Bhop
#define Player_Jump 6
#define OFFSET_CAN_LONGJUMP    356 // VEN 

#define CONC_WEAP CSW_SCOUT        // Define wich weapon to use for having a conc push

#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)

new defrag_scoutpushdefrag_scoutradiusdefrag_scout_iammo;
// new maxplayers
new bool:g_bAlive[MAX_PLAYERS +1]
// new g_pcvarBhop, g_pcvarFallDamage
// new g_pcvarGravity
new lastammo[33]; 
new 
lastweap[33]; 

public 
plugin_init() {
    
register_plugin("DeFRAG""1.0""superNOVA_")
    
register_clcmd "+sprint""ClientCommand_StartSprint" );
    
register_clcmd "-sprint""ClientCommand_StopSprint" );
    
    
// g_pcvarBhop = register_cvar("bhop", "1")      // 0 = Bhop OFF / 1 = Bhop ON // 
    // g_pcvarFallDamage = register_cvar("mp_falldamage", "0.0")    // Amout of the normal damages taken when falling (0 = no damages / 1 = normal damages )

    
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)
    
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamage_player")

    
register_concmd("amx_bhop""AdminCmd_Bhop"ADMIN_LEVEL_A"<nick|#userid> <0|1>")

    
// g_pcvarGravity = get_cvar_pointer("sv_gravity")
    
        // DeFRAG Scout Settings
    
    
defrag_scoutpush register_cvar("scout_conc","900.0"); // Force of the push
    
defrag_scoutradius register_cvar("scout_radius","900.0"); // Area covered by the push
    
defrag_scout_iammo register_cvar("scout_iammo","0"); // Infinite ammo for scout <0/1>
    
        // BHOP Settings
    
    // g_pcvarBhop = register_cvar("bhop_on", "1")  // (0 : bhop off, 1 : bhop off) 
    // g_pcvarFallDamage = register_cvar("mp_falldamage", "0.0") // Amount of normal damages taken when falling ( 0 = no damages // 1 = normal damages )
}

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 
ClientCommand_StartSprint ( const PlayerId )
    {
        if ( 
get_user_weapon PlayerId ) == CSW_KNIFE )
        {
            
UTIL_SetPlayerSpeed PlayerId KNIFE_DEFAULT_SPEED );
            
set_pevPlayerIdpev_viewmodel2g_szKnifeModel ); 
            
set_pevPlayerIdpev_weaponanimKNIFE_DRAW_ANIMATION );
            
message_beginMSG_ONE_UNRELIABLESVC_WEAPONANIM_PlayerId ); 
            
write_byteKNIFE_DRAW_ANIMATION ); 
            
write_bytepevPlayerIdpev_body ) ); 
            
message_end();
        }
    
        return 
PLUGIN_HANDLED;
    }
    
     
UTIL_SetPlayerSpeed ( const PlayerId, const Float:Speed )
    { 
        
set_pevPlayerIdpev_maxspeedSpeed ); 
        
engfuncEngFunc_SetClientMaxspeedPlayerIdSpeed ); 
    }
    

        
// DeFRAG bhop 
        
        // DeFRAG scout
        
    
stock get_velocity_from_originentFloat:fOrigin[3], Float:fSpeedFloat:fVelocity[3] ) 
    { 
        new 
Float:fEntOrigin[3]; 
        
peventpev_originfEntOrigin ); 

        
// 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_distancefEntOrigin,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_originentFloat:fOrigin[3], Float:fSpeed 
    { 
    new 
Float:fVelocity[3]; 
    
get_velocity_from_originentfOriginfSpeedfVelocity 

    
set_peventpev_velocityfVelocity ); 

    return ( 
); 
    } 

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] == 
        
lastweap[id] = weap

        if( 
lastammo[id] > ammo && lastweap[id] == weap ){ 
        new 
Vec[3], Float:fVec[3], Float:origin[3]; 
        
get_user_origin(idVec3); 

        
IVecFVec(VecfVec); 

        
pev(idpev_originorigin); 
        new 
Float:dist get_distance_foriginfVec ); 
        new 
Float:radius get_pcvar_floatdefrag_scoutradius ); 
        if(
dist <= radius){ 
        new 
Float:boost maxboost - ( ( maxboost dist) / radius ); 
        
set_velocity_from_origin(idfVecboost); 
        } 

        if( 
get_pcvar_numdefrag_scout_iammo ) )
        { 
        new 
wpn[32]; 
        
get_weaponname(weap,wpn,31); 

        if( 
ammo == )
        { 
        new 
iWPNidx = -1
        while( (
iWPNidx fm_find_ent_by_class(iWPNidxwpn)) )
        { 
        if( 
id == pev(iWPNidxpev_owner) )
        { 
        
cs_set_weapon_ammo(iWPNidx11); 
        
ammo 11
        break; 
                        } 
                    } 
                } 
            } 
        }
        
lastammo[id] = ammo
        
lastweap[id] = weap;
        }


Last edited by khios; 03-19-2009 at 05:03.
khios is offline
Send a message via MSN to khios Send a message via Skype™ to khios
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-19-2009 , 09:21   Re: DeFRAG [New map coming soon!]
Reply With Quote #23

Quote:
Originally Posted by khios View Post
Just a hint! Line 178 I wanna change cs_get_weaopn_ammo to use fakemeta or other module so that I don't have to include <cstike> any idea?
Don't worry about it. Using cstrike is fine and is faster than the Fakemeta conversion in most cases
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (intervening in a thread, asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
khios
Junior Member
Join Date: Mar 2009
Location: Belgium
Old 03-19-2009 , 09:48   Re: DeFRAG [New map coming soon!]
Reply With Quote #24

Ok for now I'm having a hard time to recode the bhop :/ many erros when compiling will post when fixed those
khios is offline
Send a message via MSN to khios Send a message via Skype™ to khios
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 03-19-2009 , 10:52   Re: DeFRAG [New map coming soon!]
Reply With Quote #25

Hey, nice to see that you are working on it. You should, however, not rush through things. Take your time so you will have a nice plugin at the end, we do not need it tomorrow.
__________________
In Flames we trust!
Nextra is offline
khios
Junior Member
Join Date: Mar 2009
Location: Belgium
Old 03-19-2009 , 11:01   Re: DeFRAG [New map coming soon!]
Reply With Quote #26

Yes I'm working on several things at the same time! the map is finished (just to create wall information for beginners)! The coding is a bit ameliored and I've got a way to get new ideas for the future of the plugin =) Just too lazy today to continue it with the bright sun that we have out! So i'm going to sunbathe... =D
khios is offline
Send a message via MSN to khios Send a message via Skype™ to khios
letgoofmyeggs
Senior Member
Join Date: Aug 2006
Old 03-19-2009 , 13:45   Re: DeFRAG [New map OUT!]
Reply With Quote #27

wat does this plugin do? i tested it and the only thing i saw it does was add a conc blast to the scout? am i missing somthin? i no yu can enable bhop for somone.. but wat else is there?
letgoofmyeggs is offline
bomnacama
Senior Member
Join Date: Dec 2008
Location: Portugal
Old 03-19-2009 , 13:50   Re: DeFRAG [New map OUT!]
Reply With Quote #28

its a realy cool plugin. I can make a demo in this computer but I will try
__________________



Please FEED MY HAMSTERS by giving me +karma
bomnacama is offline
khios
Junior Member
Join Date: Mar 2009
Location: Belgium
Old 03-19-2009 , 13:50   Re: DeFRAG [New map OUT!]
Reply With Quote #29

So the basic is that the plugin modify your speed when using knife (1500 speed) so you move a lote faster!

But i really need some help now to implement autocvar and bhop to work properly! Will do some demo and post it on the first page!
khios is offline
Send a message via MSN to khios Send a message via Skype™ to khios
plasmo
Member
Join Date: Aug 2006
Location: Melbourne, Australia
Old 03-19-2009 , 23:09   Re: DeFRAG [New map OUT!] PICS Added
Reply With Quote #30

doesnt seem to work for me
the knife/sprint works but apart from that

the scout conc or etc doesnt seem to work
plasmo is offline
Send a message via MSN to plasmo
Reply


Thread Tools
Display Modes

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:53.


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