AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Undefined symbol 'id' (https://forums.alliedmods.net/showthread.php?t=183090)

FailOverFlow 04-17-2012 06:47

Undefined symbol 'id'
 
Hi! Here the code:
PHP Code:

public grenade_explosion()
{
    if (
get_msg_arg_int) == && get_msg_arg_int ) == 25 && get_msg_arg_int ) == 30 && HasVanguard[id])
    {
        new 
pos[3]
        
pos[0] = floatroundget_msg_arg_float) )
        
pos[1] = floatroundget_msg_arg_float) )
        
pos[2] = floatroundget_msg_arg_float) )

        new 
clusterFloat:vAngle[3], Float:angles[3], Float:velocity[3], Rvelocity[3], Float:distanceFloat:actualDistanceFloat:multiplier

        
new Float:origin[3
        
origin[0] = floatpos[0] )
        
origin[1] = floatpos[1] )
        
origin[2] = floatpos[2] )

        new 
Float:minBox[3] = { -1.0, ... }
        new 
Float:maxBox[3] = { 1.0, ... }
        
        
//This will launch the above specified number of clusters
        
for (new 0CLUSTERSi++)
        {
            
//Create a random direction for the cluster to fly
            
velocity[0] = random_floatfloatMIN_FLY_DISTANCE ), floatMAX_FLY_DISTANCE ) )
            if ( 
random_num0) == velocity[0] = floatmulvelocity[0], -1.0 )
            
velocity[1] = random_floatfloatMIN_FLY_DISTANCE ), floatMAX_FLY_DISTANCE ) )
            if ( 
random_num0) == velocity[1] = floatmulvelocity[1], -1.0 )
            
velocity[2] = floatUPWARD_ARC )

            
Rvelocity[0] = pos[0] + floatroundvelocity[0] )
            
Rvelocity[1] = pos[1] + floatroundvelocity[1] )
            
Rvelocity[2] = pos[2] + floatroundvelocity[2] )

            
//Create the distance the cluster will fly
            
distance random_floatfloatMIN_FLY_DISTANCE ), floatMAX_FLY_DISTANCE ) )
            
actualDistance floatget_distanceposRvelocity ) )
            
multiplier floatdivdistanceactualDistance )
            

            
velocity[0] = floatmulvelocity[0], multiplier )
            
velocity[1] = floatmulvelocity[1], multiplier )
            
velocity[2] = floatmulvelocity[2], multiplier )

            
//Create the angles for the facing of the cluster. PS: I have no idea how to do the angle thing really. This is a blind attempt.
            
vector_to_anglevelocityangles )
            
vector_to_anglevelocityvAngle )

            
//Create the entity of the cluster
            
cluster create_entity"info_target" )

            
//Set the identifying string of the cluster's entity
            
entity_set_stringclusterEV_SZ_classname"grenade_cluster"

            
//Set the model for the cluster's entity
            
entity_set_modelcluster"models/grenade.mdl" )     

            
//Set the bounds for the cluster's entity    
            
entity_set_vectorclusterEV_VEC_minsminBox)
            
entity_set_vectorclusterEV_VEC_maxsmaxBox)

            
//Set the origin for the cluster's entity (NOTE: The clusters will spawn in the same spot, but they will be set to ignore eachother
            
entity_set_originclusterorigin )

            
//Set the angles of the cluster's entity    
            
entity_set_vectorclusterEV_VEC_anglesangles )
            
entity_set_vectorclusterEV_VEC_v_anglevAngle )

            
//Set the behavior specific variables for the cluster's entity
            
entity_set_intclusterEV_INT_movetype//Has gravity and registers collisions
            
entity_set_intclusterEV_INT_solid//Collisions do not block

            //Record who the owner of this nade is
            
entity_set_edictclusterEV_ENT_ownerget_grenade_owner() )

            
//Make the cluster fly!
            
entity_set_vectorclusterEV_VEC_velocityvelocity 
        }
    }

    return 
PLUGIN_CONTINUE


and in plugin_init:
PHP Code:

register_message23"grenade_explosion" 

While compiling i'v got Undefined sumbol 'id'

rak 04-17-2012 07:05

Re: Undefined symbol 'id'
 
because.. id does not exist

FailOverFlow 04-17-2012 07:34

Re: Undefined symbol 'id'
 
rak, help please. I need to check if user (id) have HasVanguard

FailOverFlow 04-17-2012 07:50

Re: Undefined symbol 'id'
 
like that? ))
new id[32];
get_players( id );

EpicMonkey 04-17-2012 08:22

Re: Undefined symbol 'id'
 
yeah loop through players and check if user hasvanguard

Deidara 04-17-2012 08:23

Re: Undefined symbol 'id'
 
Code:

public grenade_explosion()
Not

Code:

public grenade_explosion(id)
?

Exolent[jNr] 04-17-2012 09:46

Re: Undefined symbol 'id'
 
Quote:

Originally Posted by FailOverFlow (Post 1690931)
like that? ))
new id[32];
get_players( id );

No.

Quote:

Originally Posted by EpicMonkey (Post 1690946)
yeah loop through players and check if user hasvanguard

No.

Quote:

Originally Posted by Deidara (Post 1690947)
Code:

public grenade_explosion()
Not

Code:

public grenade_explosion(id)
?

No.

PHP Code:

public grenade_explosion()
{
    if (
get_msg_arg_int) == && get_msg_arg_int ) == 25 && get_msg_arg_int ) == 30)
    {
        new 
id get_grenade_owner()
        if(!
HasVanguard[id]) return PLUGIN_CONTINUE
        
        
new pos[3]
        
pos[0] = floatroundget_msg_arg_float) )
        
pos[1] = floatroundget_msg_arg_float) )
        
pos[2] = floatroundget_msg_arg_float) )

        new 
clusterFloat:vAngle[3], Float:angles[3], Float:velocity[3], Rvelocity[3], Float:distanceFloat:actualDistanceFloat:multiplier

        
new Float:origin[3
        
origin[0] = floatpos[0] )
        
origin[1] = floatpos[1] )
        
origin[2] = floatpos[2] )

        new 
Float:minBox[3] = { -1.0, ... }
        new 
Float:maxBox[3] = { 1.0, ... }
        
        
//This will launch the above specified number of clusters
        
for (new 0CLUSTERSi++)
        {
            
//Create a random direction for the cluster to fly
            
velocity[0] = random_floatfloatMIN_FLY_DISTANCE ), floatMAX_FLY_DISTANCE ) )
            if ( 
random_num0) == velocity[0] = floatmulvelocity[0], -1.0 )
            
velocity[1] = random_floatfloatMIN_FLY_DISTANCE ), floatMAX_FLY_DISTANCE ) )
            if ( 
random_num0) == velocity[1] = floatmulvelocity[1], -1.0 )
            
velocity[2] = floatUPWARD_ARC )

            
Rvelocity[0] = pos[0] + floatroundvelocity[0] )
            
Rvelocity[1] = pos[1] + floatroundvelocity[1] )
            
Rvelocity[2] = pos[2] + floatroundvelocity[2] )

            
//Create the distance the cluster will fly
            
distance random_floatfloatMIN_FLY_DISTANCE ), floatMAX_FLY_DISTANCE ) )
            
actualDistance floatget_distanceposRvelocity ) )
            
multiplier floatdivdistanceactualDistance )
            

            
velocity[0] = floatmulvelocity[0], multiplier )
            
velocity[1] = floatmulvelocity[1], multiplier )
            
velocity[2] = floatmulvelocity[2], multiplier )

            
//Create the angles for the facing of the cluster. PS: I have no idea how to do the angle thing really. This is a blind attempt.
            
vector_to_anglevelocityangles )
            
vector_to_anglevelocityvAngle )

            
//Create the entity of the cluster
            
cluster create_entity"info_target" )

            
//Set the identifying string of the cluster's entity
            
entity_set_stringclusterEV_SZ_classname"grenade_cluster"

            
//Set the model for the cluster's entity
            
entity_set_modelcluster"models/grenade.mdl" )     

            
//Set the bounds for the cluster's entity    
            
entity_set_vectorclusterEV_VEC_minsminBox)
            
entity_set_vectorclusterEV_VEC_maxsmaxBox)

            
//Set the origin for the cluster's entity (NOTE: The clusters will spawn in the same spot, but they will be set to ignore eachother
            
entity_set_originclusterorigin )

            
//Set the angles of the cluster's entity    
            
entity_set_vectorclusterEV_VEC_anglesangles )
            
entity_set_vectorclusterEV_VEC_v_anglevAngle )

            
//Set the behavior specific variables for the cluster's entity
            
entity_set_intclusterEV_INT_movetype//Has gravity and registers collisions
            
entity_set_intclusterEV_INT_solid//Collisions do not block

            //Record who the owner of this nade is
            
entity_set_edictclusterEV_ENT_ownerget_grenade_owner() )

            
//Make the cluster fly!
            
entity_set_vectorclusterEV_VEC_velocityvelocity 
        }
    }

    return 
PLUGIN_CONTINUE



EpicMonkey 04-17-2012 09:54

Re: Undefined symbol 'id'
 
Quote:

Originally Posted by Exolent[jNr] (Post 1690985)
PHP Code:

public grenade_explosion()
{
    if (
get_msg_arg_int) == && get_msg_arg_int ) == 25 && get_msg_arg_int ) == 30)
    {
        new 
id get_grenade_owner()
        if(!
HasVanguard[id]) return
        
        new 
pos[3]
        
pos[0] = floatroundget_msg_arg_float) )
        
pos[1] = floatroundget_msg_arg_float) )
        
pos[2] = floatroundget_msg_arg_float) )

        new 
clusterFloat:vAngle[3], Float:angles[3], Float:velocity[3], Rvelocity[3], Float:distanceFloat:actualDistanceFloat:multiplier

        
new Float:origin[3
        
origin[0] = floatpos[0] )
        
origin[1] = floatpos[1] )
        
origin[2] = floatpos[2] )

        new 
Float:minBox[3] = { -1.0, ... }
        new 
Float:maxBox[3] = { 1.0, ... }
        
        
//This will launch the above specified number of clusters
        
for (new 0CLUSTERSi++)
        {
            
//Create a random direction for the cluster to fly
            
velocity[0] = random_floatfloatMIN_FLY_DISTANCE ), floatMAX_FLY_DISTANCE ) )
            if ( 
random_num0) == velocity[0] = floatmulvelocity[0], -1.0 )
            
velocity[1] = random_floatfloatMIN_FLY_DISTANCE ), floatMAX_FLY_DISTANCE ) )
            if ( 
random_num0) == velocity[1] = floatmulvelocity[1], -1.0 )
            
velocity[2] = floatUPWARD_ARC )

            
Rvelocity[0] = pos[0] + floatroundvelocity[0] )
            
Rvelocity[1] = pos[1] + floatroundvelocity[1] )
            
Rvelocity[2] = pos[2] + floatroundvelocity[2] )

            
//Create the distance the cluster will fly
            
distance random_floatfloatMIN_FLY_DISTANCE ), floatMAX_FLY_DISTANCE ) )
            
actualDistance floatget_distanceposRvelocity ) )
            
multiplier floatdivdistanceactualDistance )
            

            
velocity[0] = floatmulvelocity[0], multiplier )
            
velocity[1] = floatmulvelocity[1], multiplier )
            
velocity[2] = floatmulvelocity[2], multiplier )

            
//Create the angles for the facing of the cluster. PS: I have no idea how to do the angle thing really. This is a blind attempt.
            
vector_to_anglevelocityangles )
            
vector_to_anglevelocityvAngle )

            
//Create the entity of the cluster
            
cluster create_entity"info_target" )

            
//Set the identifying string of the cluster's entity
            
entity_set_stringclusterEV_SZ_classname"grenade_cluster"

            
//Set the model for the cluster's entity
            
entity_set_modelcluster"models/grenade.mdl" )     

            
//Set the bounds for the cluster's entity    
            
entity_set_vectorclusterEV_VEC_minsminBox)
            
entity_set_vectorclusterEV_VEC_maxsmaxBox)

            
//Set the origin for the cluster's entity (NOTE: The clusters will spawn in the same spot, but they will be set to ignore eachother
            
entity_set_originclusterorigin )

            
//Set the angles of the cluster's entity    
            
entity_set_vectorclusterEV_VEC_anglesangles )
            
entity_set_vectorclusterEV_VEC_v_anglevAngle )

            
//Set the behavior specific variables for the cluster's entity
            
entity_set_intclusterEV_INT_movetype//Has gravity and registers collisions
            
entity_set_intclusterEV_INT_solid//Collisions do not block

            //Record who the owner of this nade is
            
entity_set_edictclusterEV_ENT_ownerget_grenade_owner() )

            
//Make the cluster fly!
            
entity_set_vectorclusterEV_VEC_velocityvelocity 
        }
    }

    return 
PLUGIN_CONTINUE



^ Yes! yes! yes! :3

FailOverFlow 04-17-2012 10:05

Re: Undefined symbol 'id'
 
PHP Code:

cluster_grenade/main.inl(21) : warning 209: function "grenade_explosion" should return a value
cluster_grenade
/main.inl(96) : error 078: function uses both "return" and "return <value>" 

Something wrong
Maybe need to remove return PLUGIN_CONTINUE?

Exolent[jNr] 04-17-2012 10:06

Re: Undefined symbol 'id'
 
You should be able to fix that yourself. Anyway, I fixed it in my previous post.


All times are GMT -4. The time now is 07:46.

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