AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Line too long (https://forums.alliedmods.net/showthread.php?t=295528)

Kotoamatsukami 03-28-2017 13:25

Line too long
 
Hello, first of all, I have searched around the forum regarding this issue. I'm unable to find any solution even I understand how the error generated, there is a long line in the whole code that, perhaps, longer than it should. The error is on line 291( the line which is already outside the entire code? )
Some threads I found helpful and yet still hasn't solve my issue;
https://forums.alliedmods.net/showth...nput+line+long
https://forums.alliedmods.net/showth...nput+line+long
https://forums.alliedmods.net/showth...nput+line+long

PS : The code may be too hard-coded, I am new to coding so mostly the code about making fake ghost and player in the code isn't mine, it was Dias'. Just using his code for some testing since I need his code to create ghost entities around a target and only the target can see all the entity.

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <xs>
#include <hamsandwich>

#define PLUGIN "Testing Plugin"
#define VERSION "0.1"
#define AUTHOR "MuhdZaim"

#define MAX_COUNT 4

new bool:g_iHaunted33 ], bool:g_illusioning33 ], 
bool:g_FakePlr33 ]
new 
g_iEntGhost33 ][ MAX_COUNT ], cvar_durationg_Model128 ]

new 
GHOST_CLASSNAME[ ] = "Ghost"
new GHOST_FAKEPLR[ ] = "Fake_Ghost"
new g_ModelName[ ] = "tsukuyomi"

public plugin_init()
{    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
cvar_duration register_cvar"ghost_duration""15.0" )
    
    
register_clcmd"say /change""ChangeModel" )
    
register_event"HLTV""NewRound""1=0""2=0" )
    
    
RegisterHamHam_ThinkGHOST_CLASSNAME"Fw_Think")
    
    
register_forwardFM_AddToFullPack"AddToFullPack")
}

public 
NewRoundid )
{
    if( 
g_iHauntedid ] )
        
g_iHauntedid ] = false
}

public 
ChangeModelid )
{
    if( !
g_iHauntedid ] )
    {
        
g_iHauntedid ] = true;
        
MakeGhostid )
    }
}

public 
MakeGhostid )
{
    if( !
is_user_aliveid ) || !g_iHauntedid ] ) return;
    
    
g_illusioningid ] = true
    
    
static Float:iOrigin], Float:uOrigin], ent
    
    
for( new i=0MAX_COUNTi++ )
    {
        if( !
pev_valident ) )
        {
            
g_iEntGhostid ][ ] = create_entity"info_target" )
        }
        
        
ent g_iEntGhostid ][ ]
        
        if( 
== )
        {
            
get_positionent100.00.00.0iOrigin )
        }
        else if( 
== )
        {
            
get_positionent50.0100.00.0iOrigin )
        }
        else if( 
== )
        {
            
get_positionent, -100.00.00.0iOrigin )
        }
        else if( 
== )
        {
            
get_positionent, -50.0, -100.00.0iOrigin )
        }
        
        
entity_set_originentiOrigin )
        
        
entity_get_vectoridEV_VEC_originuOrigin )
        
npc_turntotargetentiOriginuOrigin )

        static 
ModelName1128 ]
        
        
formatexModelName1sizeof ModelName1"models/player/%s/%s.mdl"g_ModelNameg_ModelName )
        
formatexg_Modelsizeof g_Model"models/player/%s/%s.mdl"g_ModelNameg_ModelName )
        
        
entity_set_stringentEV_SZ_classnameGHOST_CLASSNAME )
        
entity_set_modelentModelName1 )
        
entity_set_intentEV_INT_solidSOLID_NOT )
        
entity_set_intentEV_INT_movetypeMOVETYPE_PUSHSTEP )
        
        new 
Float:mins] = { -16.0, -16.0, -36.0 }
        new 
Float:maxs] = { 16.016.036.0 }
        
        
entity_set_sizeentminsmaxs )
        
        
set_peventpev_renderfxkRenderFxGlowShell )
        
set_peventpev_rendermodekRenderTransAlpha )
        
set_peventpev_renderamt0.0 )
        
        
set_peventpev_ownerid )
        
set_pevidpev_iuser1)
        
        
set_entity_animent)
        
        
drop_to_floorent )
        
        
set_peventpev_nextthinkhalflife_time( ) + 0.01 )
    }
    
    
set_taskget_pcvar_floatcvar_duration ), "RemoveIllusion"id )
}

public 
ThinkGhostent )
{
    if( !
pev_valident ) ) return;
    
    static 
id
    
    id 
peventpev_owner )
    
    if( !
is_user_aliveid ) || !g_illusioningid ] ) return;
    
    
hook_ententid150.0 )
    
    
set_peventpev_nextthinkhalflife_time( ) + 0.01 )
}

public 
AddToFullPackeseenthosthostflagplayerpset )
{
    if( !
is_user_alivehost ) || !pev_valident ) && !g_illusioninghost ] )
        return 
FMRES_IGNORED
        
    
static classname32 ]
    
peventpev_classnameGHOST_CLASSNAMEsizeof GHOST_CLASSNAME ) )
    
    if( 
equalclassnameGHOST_CLASSNAME ) && peventpev_owner ) == host )
    {
        
set_esesES_RenderAmt255.0 )
        
        static 
Float:Angle], Float:Origin], Float:Origin2]
        
        
peventpev_anglesAngle )
        
pevhostpev_originOrigin )
        
peventpev_originOrigin2 )
        
        new 
FloatOrigin] - Origin2]
        new 
FloatOrigin] - Origin2]
        
        new 
Floatradians floatatanZ/Xradian )
        
        
Angle] = radians * ( 180 3.14 )
        
        if( 
Origin] < Origin2] )
        {
            
Angle] = -180.0
        
}
            
        
set_esesES_AnglesAngle )
    }
    else if( 
equalclassnameGHOST_FAKEPLR ) )
    {
        static 
ent_owner 
        
        ent_owner
peventpev_owner )
        
        if( 
is_user_aliveent_owner ) )
        {
            
set_esesES_RenderModekRenderNormal )
            
set_esesES_RenderAmt255.0 )
            
            
engfuncEngFunc_SetModelentg_Model )
        }
    }
    
    if( 
is_user_aliveent ) )
    {
        
set_esesES_RenderModekRenderTransAlpha )
        
set_esesES_RenderAmt0.0 )
        
        new 
iEnt find_ent_by_owner( -1GHOST_FAKEPLRent )
        
        if( !
iEnt || !pev_valident ) )
        {
            
iEnt create_fake_playerent )
        }
        
        
g_FakePlrent ] = iEnt
    
}
    
    return 
FMRES_HANDLED
}

public 
hook_ent(entvictimFloat:speed)
{
    static 
Float:fl_Velocity[3]
    static 
Float:VicOrigin[3], Float:EntOrigin[3]

    
pev(entpev_originEntOrigin)
    
pev(victimpev_originVicOrigin)
    
    static 
Float:distance_f
    distance_f 
get_distance_f(EntOriginVicOrigin)

    if (
distance_f 60.0)
    {
        new 
Float:fl_Time distance_f speed

        fl_Velocity
[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
        fl_Velocity
[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
        fl_Velocity
[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
    
}
    else
    {
        
fl_Velocity[0] = 0.0
        fl_Velocity
[1] = 0.0
        fl_Velocity
[2] = 0.0
    
}

    
entity_set_vector(entEV_VEC_velocityfl_Velocity)
}

stock get_position(entFloat:forwFloat:rightFloat:upFloat:vStart[])
{
    new 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
    
pev(entpev_originvOrigin)
    
pev(entpev_view_ofs,vUp//for player
    
xs_vec_add(vOrigin,vUp,vOrigin)
    
pev(entpev_v_anglevAngle// if normal entity ,use pev_angles
    
    
vAngle[0] = 0.0
    
    angle_vector
(vAngle,ANGLEVECTOR_FORWARD,vForward//or use EngFunc_AngleVectors
    
angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
    
angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
    
    
vStart[0] = vOrigin[0] + vForward[0] * forw vRight[0] * right vUp[0] * up
    vStart
[1] = vOrigin[1] + vForward[1] * forw vRight[1] * right vUp[1] * up
    vStart
[2] = vOrigin[2] + vForward[2] * forw vRight[2] * right vUp[2] * up
}

stock set_entity_anim(entanim)
{
    
entity_set_float(entEV_FL_animtimeget_gametime())
    
entity_set_float(entEV_FL_framerate1.0)
    
entity_set_float(entEV_FL_frame0.0)
    
entity_set_int(entEV_INT_sequenceanim)    
}

public 
npc_turntotarget(entFloat:Ent_Origin[3], Float:Vic_Origin[3]) 
{
    if(!
pev_valid(ent))
        return
    
    new 
Float:newAngle[3]
    
entity_get_vector(entEV_VEC_anglesnewAngle)
    new 
Float:Vic_Origin[0] - Ent_Origin[0]
    new 
Float:Vic_Origin[1] - Ent_Origin[1]

    new 
Float:radians floatatan(z/xradian)
    
newAngle[1] = radians * (180 3.14)
    if (
Vic_Origin[0] < Ent_Origin[0])
        
newAngle[1] -= 180.0

    entity_set_vector
(entEV_VEC_v_anglenewAngle)
    
entity_set_vector(entEV_VEC_anglesnewAngle)
}

public 
create_fake_playerid )
{
    new 
iEnt create_entity"info_target" )
    
    
set_pev(iEntpev_classnameGHOST_FAKEPLR)
    
set_pev(iEntpev_movetypeMOVETYPE_FOLLOW)
    
set_pev(iEntpev_solidSOLID_NOT)
    
set_pev(iEntpev_aimentid)
    
set_pev(iEntpev_ownerid )
    
set_pev(iEntpev_renderfxkRenderFxGlowShell)
    
set_pev(iEntpev_rendermodekRenderTransAlpha)
    
set_pev(iEntpev_renderamt255.0)

    return 
iEnt



OciXCrom 03-28-2017 13:45

Re: Line too long
 
Um... What line? I don't see a huge line here + the code compiles with only a tag mismatch.

Kotoamatsukami 03-28-2017 14:33

Re: Line too long
 
1 Attachment(s)
Quote:

Originally Posted by OciXCrom (Post 2507432)
Um... What line? I don't see a huge line here + the code compiles with only a tag mismatch.

Thank you for the reply. It's strange because the error regarding too long line did not use any module or include files so everyone who compiles this script should get the same result and yes I am agreed with you that there is not even a single line that should be considered long. For now, I am still searching for the error and try to read more from other threads.
Here the errors that I got;

OciXCrom 03-28-2017 14:39

Re: Line too long
 
The first error is in the .inc file. The code you gave doesn't have 291 lines, so it's the wrong one...

Kotoamatsukami 03-28-2017 14:57

Re: Line too long
 
Quote:

Originally Posted by OciXCrom (Post 2507443)
The error is in the .inc file.

Thank you, sir.
That, by any chance, solved my nested comment error that I had been facing from all this time. I forgot I edited the include file as it was a mess since I installed it for the first time, well, just so that will ease me to read the include file so I can understand better.

But, the long line still there. This sounds ridiculous but if you don' mind, OciXCrom, will you please attach your include files here, please? I will try to test it with yours maybe that can solve the problem. :grrr:

Thanks in advance, you really awesome. :)

[ EDIT ]
I have alter the code in the first post, changes that I made after your replies. ^^

OciXCrom 03-28-2017 15:10

Re: Line too long
 
It still compiles without any problems. The .inc files depend on your AMXX version, so it's a bad idea if I give them to you + I have made some modifications. Try a different compiler.

Kotoamatsukami 03-28-2017 15:33

Re: Line too long
 
2 Attachment(s)
So, I did as what you thought I should've been doing and you are right. The compiler plays the role here.
I went to two different websites( 1.8.3 AMXx Compiler and AMX Mod X Web Compiler ) and here the results that I got, respectively.

[ EDIT ]
It seems that we can conclude that too long line error is greatly affected by include files too. Not just the line itself.

OciXCrom 03-28-2017 16:47

Re: Line too long
 
Could you please attach the file here rather than copying its contents?

Kotoamatsukami 03-28-2017 21:34

Re: Line too long
 
2 Attachment(s)
Quote:

Originally Posted by OciXCrom (Post 2507482)
Could you please attach the file here rather than copying its contents?

I am sorry, sir.
Which file you wish me to attach here?
Include file or the original plugin?

[ EDIT ]
I see, so you want the original plugin, aight? :grrr:
Sure, here.

[ EDIT 1 ]
But, the resources is still missing. My laptop has been a mess lately. You can download the resources from Dias' thread though, all his threads are still up and available for public use. :)

[ EDIT 2 ]
Anyone who still want the full code without error and warning, here.

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <xs>
#include <hamsandwich>

#define PLUGIN "Testing Plugin"
#define VERSION "0.1"
#define AUTHOR "MuhdZaim"

#define MAX_COUNT 4

new bool:g_iHaunted33 ], bool:g_illusioning33 ], g_FakePlr33 ]
new 
g_iEntGhost33 ][ MAX_COUNT ], cvar_durationg_Model128 ]

new 
GHOST_CLASSNAME[ ] = "Ghost"
new GHOST_FAKEPLR[ ] = "Fake_Ghost"
new g_ModelName[ ] = "tsukuyomi"

public plugin_init()
{    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
cvar_duration register_cvar"ghost_duration""15.0" )
    
    
register_clcmd"say /change""ChangeModel" )
    
register_event"HLTV""NewRound""1=0""2=0" )
    
    
RegisterHamHam_ThinkGHOST_CLASSNAME"Fw_Think")
    
    
register_forwardFM_AddToFullPack"AddToFullPack")
}

public 
NewRoundid )
{
    if( 
g_iHauntedid ] )
        
g_iHauntedid ] = false
}

public 
ChangeModelid )
{
    if( !
g_iHauntedid ] )
    {
        
g_iHauntedid ] = true;
        
MakeGhostid )
    }
}

public 
MakeGhostid )
{
    if( !
is_user_aliveid ) || !g_iHauntedid ] ) return;
    
    
g_illusioningid ] = true
    
    
static Float:iOrigin], Float:uOrigin], ent
    
    
for( new i=0MAX_COUNTi++ )
    {
        if( !
pev_valident ) )
        {
            
g_iEntGhostid ][ ] = create_entity"info_target" )
        }
        
        
ent g_iEntGhostid ][ ]
        
        if( 
== )
        {
            
get_positionent100.00.00.0iOrigin )
        }
        else if( 
== )
        {
            
get_positionent50.0100.00.0iOrigin )
        }
        else if( 
== )
        {
            
get_positionent, -100.00.00.0iOrigin )
        }
        else if( 
== )
        {
            
get_positionent, -50.0, -100.00.0iOrigin )
        }
        
        
entity_set_originentiOrigin )
        
        
entity_get_vectoridEV_VEC_originuOrigin )
        
npc_turntotargetentiOriginuOrigin )

        static 
ModelName1128 ]
        
        
formatexModelName1sizeof ModelName1"models/player/%s/%s.mdl"g_ModelNameg_ModelName )
        
formatexg_Modelsizeof g_Model"models/player/%s/%s.mdl"g_ModelNameg_ModelName )
        
        
entity_set_stringentEV_SZ_classnameGHOST_CLASSNAME )
        
entity_set_modelentModelName1 )
        
entity_set_intentEV_INT_solidSOLID_NOT )
        
entity_set_intentEV_INT_movetypeMOVETYPE_PUSHSTEP )
        
        new 
Float:mins] = { -16.0, -16.0, -36.0 }
        new 
Float:maxs] = { 16.016.036.0 }
        
        
entity_set_sizeentminsmaxs )
        
        
set_peventpev_renderfxkRenderFxGlowShell )
        
set_peventpev_rendermodekRenderTransAlpha )
        
set_peventpev_renderamt0.0 )
        
        
set_peventpev_ownerid )
        
set_pevidpev_iuser1)
        
        
set_entity_animent)
        
        
drop_to_floorent )
        
        
set_peventpev_nextthinkhalflife_time( ) + 0.01 )
    }
    
    
set_taskget_pcvar_floatcvar_duration ), "RemoveIllusion"id )
}

public 
ThinkGhostent )
{
    if( !
pev_valident ) ) return;
    
    static 
id
    
    id 
peventpev_owner )
    
    if( !
is_user_aliveid ) || !g_illusioningid ] ) return;
    
    
hook_ententid150.0 )
    
    
set_peventpev_nextthinkhalflife_time( ) + 0.01 )
}

public 
AddToFullPackeseenthosthostflagplayerpset )
{
    if( !
is_user_alivehost ) || !pev_valident ) && !g_illusioninghost ] )
        return 
FMRES_IGNORED
        
    
static classname32 ]
    
peventpev_classnameGHOST_CLASSNAMEsizeof GHOST_CLASSNAME ) )
    
    if( 
equalclassnameGHOST_CLASSNAME ) && peventpev_owner ) == host )
    {
        
set_esesES_RenderAmt255.0 )
        
        static 
Float:Angle], Float:Origin], Float:Origin2]
        
        
peventpev_anglesAngle )
        
pevhostpev_originOrigin )
        
peventpev_originOrigin2 )
        
        new 
FloatOrigin] - Origin2]
        new 
FloatOrigin] - Origin2]
        
        new 
Floatradians floatatanZ/Xradian )
        
        
Angle] = radians * ( 180 3.14 )
        
        if( 
Origin] < Origin2] )
        {
            
Angle] = -180.0
        
}
            
        
set_esesES_AnglesAngle )
    }
    else if( 
equalclassnameGHOST_FAKEPLR ) )
    {
        static 
ent_owner 
        
        ent_owner
peventpev_owner )
        
        if( 
is_user_aliveent_owner ) )
        {
            
set_esesES_RenderModekRenderNormal )
            
set_esesES_RenderAmt255.0 )
            
            
engfuncEngFunc_SetModelentg_Model )
        }
    }
    
    if( 
is_user_aliveent ) )
    {
        
set_esesES_RenderModekRenderTransAlpha )
        
set_esesES_RenderAmt0.0 )
        
        new 
iEnt find_ent_by_owner( -1GHOST_FAKEPLRent )
        
        if( !
iEnt || !pev_valident ) )
        {
            
iEnt create_fake_playerent )
        }
        
        
g_FakePlrent ] = iEnt
    
}
    
    return 
FMRES_HANDLED
}

public 
hook_ent(entvictimFloat:speed)
{
    static 
Float:fl_Velocity[3]
    static 
Float:VicOrigin[3], Float:EntOrigin[3]

    
pev(entpev_originEntOrigin)
    
pev(victimpev_originVicOrigin)
    
    static 
Float:distance_f
    distance_f 
get_distance_f(EntOriginVicOrigin)

    if (
distance_f 60.0)
    {
        new 
Float:fl_Time distance_f speed

        fl_Velocity
[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
        fl_Velocity
[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
        fl_Velocity
[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
    
}
    else
    {
        
fl_Velocity[0] = 0.0
        fl_Velocity
[1] = 0.0
        fl_Velocity
[2] = 0.0
    
}

    
entity_set_vector(entEV_VEC_velocityfl_Velocity)
}

stock get_position(entFloat:forwFloat:rightFloat:upFloat:vStart[])
{
    new 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
    
pev(entpev_originvOrigin)
    
pev(entpev_view_ofs,vUp//for player
    
xs_vec_add(vOrigin,vUp,vOrigin)
    
pev(entpev_v_anglevAngle// if normal entity ,use pev_angles
    
    
vAngle[0] = 0.0
    
    angle_vector
(vAngle,ANGLEVECTOR_FORWARD,vForward//or use EngFunc_AngleVectors
    
angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
    
angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
    
    
vStart[0] = vOrigin[0] + vForward[0] * forw vRight[0] * right vUp[0] * up
    vStart
[1] = vOrigin[1] + vForward[1] * forw vRight[1] * right vUp[1] * up
    vStart
[2] = vOrigin[2] + vForward[2] * forw vRight[2] * right vUp[2] * up
}

stock set_entity_anim(entanim)
{
    
entity_set_float(entEV_FL_animtimeget_gametime())
    
entity_set_float(entEV_FL_framerate1.0)
    
entity_set_float(entEV_FL_frame0.0)
    
entity_set_int(entEV_INT_sequenceanim)    
}

public 
npc_turntotarget(entFloat:Ent_Origin[3], Float:Vic_Origin[3]) 
{
    if(!
pev_valid(ent))
        return
    
    new 
Float:newAngle[3]
    
entity_get_vector(entEV_VEC_anglesnewAngle)
    new 
Float:Vic_Origin[0] - Ent_Origin[0]
    new 
Float:Vic_Origin[1] - Ent_Origin[1]

    new 
Float:radians floatatan(z/xradian)
    
newAngle[1] = radians * (180 3.14)
    if (
Vic_Origin[0] < Ent_Origin[0])
        
newAngle[1] -= 180.0

    entity_set_vector
(entEV_VEC_v_anglenewAngle)
    
entity_set_vector(entEV_VEC_anglesnewAngle)
}

public 
create_fake_playerid )
{
    new 
iEnt create_entity"info_target" )
    
    
set_pev(iEntpev_classnameGHOST_FAKEPLR)
    
set_pev(iEntpev_movetypeMOVETYPE_FOLLOW)
    
set_pev(iEntpev_solidSOLID_NOT)
    
set_pev(iEntpev_aimentid)
    
set_pev(iEntpev_ownerid )
    
set_pev(iEntpev_renderfxkRenderFxGlowShell)
    
set_pev(iEntpev_rendermodekRenderTransAlpha)
    
set_pev(iEntpev_renderamt255.0)

    return 
iEnt



Black Rose 03-29-2017 17:28

Re: Line too long
 
The plugin that failed to compile was named SPEED.sma, perhaps you should try to attach that one instead...

The file you attached compiled fine. No errors, no warnings.
Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Header size:          2228 bytes
Code size:            19976 bytes
Data size:            6936 bytes
Stack/heap size:      16384 bytes; max. usage is unknown, due to recursion
Total requirements:  45524 bytes
Done.
[Finished in 0.6s]

I just realized I'm still using the 1.8.1 compiler...


All times are GMT -4. The time now is 17:52.

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