AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   warnings (native "engfunc") (https://forums.alliedmods.net/showthread.php?t=217735)

Closer456 06-06-2013 18:00

warnings (native "engfunc")
 
What's wrong this code?
PHP Code:

public fm_Touch(ptrptd)
{
    if ( !
sh_is_active() ) return FMRES_IGNORED
    
if ( !pev_valid(ptr) ) return FMRES_IGNORED

    
static classname[32]
    
classname[0] = '^0'
    
pev(ptrpev_classnameclassname31)

    
// Lets block the picking up of a shield
    
if ( equal(classnamegPowerClass) ) {
        new 
id pev(ptrpev_owner)

        new 
Float:dRatioFloat:distanceBetweendamage
        
new Float:dmgRadius get_pcvar_float(gPcvarRadius)
        new 
maxDamage get_pcvar_num(gPcvarMaxDamage)
        new 
CsTeams:idTeam cs_get_user_team(id)
        new 
FFOn sh_friendlyfire_on()
        new 
Float:vicOrigin[3]
        new 
Float:fl_vExplodeAt[3]

        
pev(ptrpev_originfl_vExplodeAt)

        for ( new 
victim 1victim <= gMaxPlayersvictim++ )
        {
            if ( !
is_user_alive(victim) ) continue
            if ( 
idTeam == cs_get_user_team(victim) && !FFOn && id != victim ) continue

            
pev(victimpev_originvicOrigin)
            
distanceBetween vector_distance(fl_vExplodeAtvicOrigin)

            if ( 
distanceBetween <= dmgRadius )
            {
                
dRatio distanceBetween dmgRadius
                damage 
maxDamage floatround(maxDamage dRatio)

                
// Lessen damage taken by self
                
if (victim == iddamage floatround(damage 2.0)

                if ( !
damage damage 1    // Incase damage cvar is really low cause something if within the radius 
                
sh_extra_damage(victimiddamage"Kamehameha"_SH_DMG_NORMtrue_fl_vExplodeAt)

                
// Make them feel it
                
new Float:fl_vicVelocity[3]
                
fl_vicVelocity[0] = ((vicOrigin[0] - fl_vExplodeAt[0]) / distanceBetween) * 300.0
                fl_vicVelocity
[1] = ((vicOrigin[1] - fl_vExplodeAt[1]) / distanceBetween) * 300.0
                fl_vicVelocity
[2] = 150.0

                set_pev
(victimpev_velocityfl_vicVelocity)
                
sh_screen_shake(victim1.21.21.2)
            }
        }


        
// Make some Effects
        
new blastSize floatround(dmgRadius 12.0)

        
// Explosion Sprite
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_GLOWSPRITE)    //23
        
engfunc(EngFunc_WriteCoordfl_vExplodeAt[0])
        
engfunc(EngFunc_WriteCoordfl_vExplodeAt[1])
        
engfunc(EngFunc_WriteCoordfl_vExplodeAt[2])
        
write_short(gSpriteExplosion)    // model
        
write_byte(01)            // life 0.x sec
        
write_byte(blastSize)        // size
        
write_byte(255)            // brightness
        
message_end()

        
// Explosion (smoke, sound/effects)
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_EXPLOSION)    //3
        
engfunc(EngFunc_WriteCoordfl_vExplodeAt[0])
        
engfunc(EngFunc_WriteCoordfl_vExplodeAt[1])
        
engfunc(EngFunc_WriteCoordfl_vExplodeAt[2])
        
write_short(gSpriteSmoke)    // model
        
write_byte(blastSize+5)        // scale in 0.1's
        
write_byte(20)            // framerate
        
write_byte(10)            // flags
        
message_end()

        
// Create Burn Decals, if they are used
        
if ( get_pcvar_num(gPcvarDecals) ) {
            
// Change burn decal according to blast size
            
new decal random_num(0,2)
            if (
blastSize 18) {
                
//If radius >~ 216 use larger decals
                
decal += 3
            
}

            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(TE_GUNSHOTDECAL)    //109
            
engfunc(EngFunc_WriteCoordfl_vExplodeAt[0])
            
engfunc(EngFunc_WriteCoordfl_vExplodeAt[1])
            
engfunc(EngFunc_WriteCoordfl_vExplodeAt[2])
            
write_short(0)            //?
            
write_byte(gBurnDecal[decal])        //decal
            
message_end()
        }

        
// Stop the sounds
        
emit_sound(ptrCHAN_STATICgSoundBeamVOL_NORMATTN_NORMSND_STOPPITCH_NORM)
        
emit_sound(idCHAN_STATICgSoundReleaseVOL_NORMATTN_NORMSND_STOPPITCH_NORM)

        
engfunc(EngFunc_RemoveEntityptr)

        new 
Float:cooldown get_pcvar_float(gPcvarCooldown)
        if ( 
cooldown 0.0 sh_set_cooldown(idcooldown)

        
// Reset the Varible
        
gPowerID[id] = 0
        gUsingPower
[id] = false

        
// Switch back to previous weapon and reset speed...
        
if ( gLastWeapon[id] != CSW_KNIFE sh_switch_weapon(idgLastWeapon[id])
        else 
sh_reset_max_speed(id)
    }

    return 
FMRES_IGNORED


Here's the log:
PHP Code:

L 02/11/2012 19:28:51: [FAKEMETAInvalid entity
L 02
/11/2012 19:28:51: [AMXXDisplaying debug trace (plugin "modifytest.amxx")
L 02/11/2012 19:28:51: [AMXXRun time error 10native error (native "engfunc")
L 02/11/2012 19:28:51: [AMXX] [0textc9x2LU.sma::fm_Touch (line 432)
L 02/11/2012 19:29:02: [FAKEMETAInvalid entity 


xPez 06-07-2013 03:30

Re: warnings (native "engfunc")
 
Can you please post the whole code?

claudiuhks 06-07-2013 04:35

Re: warnings (native "engfunc")
 
PHP Code:

if( pev_validptr ) )
  
engfuncEngFunc_RemoveEntityptr ); 


ConnorMcLeod 06-07-2013 18:03

Re: warnings (native "engfunc")
 
2 Attachment(s)
Try that version


All times are GMT -4. The time now is 16:18.

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