AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [NEED HELP] Multiple questions [Poor english inside :'(] (https://forums.alliedmods.net/showthread.php?t=88575)

khios 03-26-2009 15:52

[NEED HELP] Multiple questions [Poor english inside :'(]
 
Hello there! I will put every question I've got here! So people don't blame me for "hi-jacking".... uhm that out of the way here are the things where I need help

In the case when using a conc_grenade. How to set the damage to 0??

PHP Code:

public plugin_init{
register_event("Damage""hedamage_event""b""2!0""4!0""5!0""6!0")
register_cvar("he_push","600.0")
}

public 
hedamage_event(id) {
    new 
MAXPLAYERS
    MAXPLAYERS 
get_maxplayers()

    new 
inflictor entity_get_edict(idEV_ENT_dmg_inflictor)
    if (
inflictor <= MAXPLAYERS)
        return 
PLUGIN_CONTINUE

    
new classname2[8]
    
entity_get_string(inflictorEV_SZ_classnameclassname27)
    if (!
equal(classname2"grenade"))
        return 
PLUGIN_CONTINUE

    
new Float:upVector[3]
    
upVector[0] = float(read_data(4))
    
upVector[1] = float(read_data(5))
    
upVector[2] = float(read_data(6))

    new 
damagerept read_data(2)
    
set_velocity_from_origin(idupVectorget_cvar_float("he_push")*damagerept)

    return 
PLUGIN_CONTINUE


The important value is damagerept (I think...) And I can't remove damage by using

PHP Code:

#define DMG_GRENADE    (1 << 24)

public plugin_init()
{
    
RegisterHam(Ham_TakeDamage"player""func_TakeDamage")
}  

public 
func_TakeDamage(ididinflictoridattackerFloat:damagedamagebits)
{
    if( 
damagebits DMG_GRENADE 
    {
        return 
HAM_SUPERCEDE;
    }

    return 
HAM_IGNORED

or it will block the conc effect! Any idea?

And second thing! With this code I can set conc on different weapons but I'ld like to set vertival and horizontal conc on the m249 so that I can use it to make people moving upward and laterally!

Here's what I got so far!

PHP Code:

// 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_floatdefrag_scoutpush ); 
    new 
Float:maxboost2 get_pcvar_floatdefrag_m249push ); 
    if( !
maxboost, !maxboost2 
        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); 
            } 
        } 
        
lastammo[id] = ammo
        
lastweap[id] = weap
    } 
    else 
    if( 
weap == CONC_WEAP2 && 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:radius2 get_pcvar_floatdefrag_m249radius ); 
            if(
dist <= radius2){ 
                new 
Float:boost maxboost2 - ( ( maxboost2 dist) / radius2 ); 
                
set_velocity_from_origin(idfVecboost); 
            } 
        } 
        
lastammo[id] = ammo
        
lastweap[id] = weap
    } 


Thx if you take time to help :)

AntiBots 03-26-2009 15:56

Re: [problem] array must be indexed
 
Float:maxboost

khios 03-26-2009 17:39

Re: [NEED HELP] Add multiple weapons to conc_plugin
 
Got it! Yeah!! Not perfect but not bad for a beginning =)

SEE FIRST POST!


All times are GMT -4. The time now is 09:04.

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