AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   info_target needs changing. (https://forums.alliedmods.net/showthread.php?t=221800)

devu4 07-26-2013 13:39

info_target needs changing.
 
1 Attachment(s)
I have uploaded a Jailbreak soccer ball plugin with this post, when the soccer ball is created it's class type is "info_target"

I need someone to change this to class_ball or something different from info_target . This is because I have another plugin which contains same type of entity. When I pick up that entity it changes into a ball. Which I don't want. And sometimes the when I touch the ball it changes into the other entity.

I have tried just replacing the info_target but then it gives me this error after changing it to class_ball

HAMSANDWICH] Failed to retrieve classtype for "class_ball"

Attachment 123208

simanovich 07-26-2013 18:01

Re: info_target needs changing.
 
PHP Code:

set_pev(entity,pev_classname,"class_ball"); 

Then i the enother plugin do a check of classname

devu4 07-26-2013 18:44

Re: info_target needs changing.
 
Quote:

Originally Posted by simanovich (Post 1999470)
PHP Code:

set_pev(entity,pev_classname,"class_ball"); 

Then i the enother plugin do a check of classname

I really do not understand.
I cannot code so I would be grateful if someone did it for me or told me clearly so i can do it my self. Thanks for the message anyway!

akcaliberg 07-26-2013 20:52

Re: info_target needs changing.
 
it seems classname of the ball is "ball". If you think it's not, try to put a print after the entity created that will show you the classname of the ball.

pokemonmaster 07-26-2013 21:45

Re: info_target needs changing.
 
If i remmeber correctly, hamsandwich can't retrive custom classnames which are different from engine's ones.

If you do
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <hamsandwich>

public plugin_init()
{
    
// This is just an example plugin
    
    
new iEnt CreateEnt()
}

new const 
g_szBallClassName[]  = "ball_entity"
stock CreateEnt()
{
    new 
iEnt create_entity("info_target")
    
    
entity_set_string(iEntEV_SZ_classnameg_szBallClassName)
    
    
RegisterHam(Ham_Think"ball_entity""fw_Think"// This will fail
    
RegisterHam(Ham_Think"info_target""fw_Think"// This would work, but you need to filter classname
    
    
RegisterHamFromEntity(Ham_ThinkiEnt"fw_Think"// Don't know if this would work, try it?
    
    
return iEnt
    
}

public 
fw_Think(iEnt)
{
        
// Filtering classnames ...
    
static szClassName[32]
    
entity_get_string(iEntEV_SZ_classnameszClassName31)
    
    if(!
equal(g_szBallClassNameszClassName))
    {
        return;
    }
    
    
// Code here ...




All times are GMT -4. The time now is 06:32.

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