AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with pev_view_ofs (https://forums.alliedmods.net/showthread.php?t=118338)

One 02-10-2010 03:11

Problem with pev_view_ofs
 
1 Attachment(s)
Hi,

i wanted to catch the origins of users view offset(Aim origins) to spawn my sprite, but like ever i have a problem :P

the offset/origins are not correct.

PHP Code:

public ClientCommand_CreateMagic ( const Player, const Level, const Cid )
{
    if ( !
cmd_accessPlayerLevelCid) )
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
Float:Origin[3];
    new 
Entity;
    
    
pev(Player,pev_v_angle,Origin)
    
    if ( ( 
Entity create_entity"info_target" ) ) )
    {
        
set_pevEntitypev_classnamegMagicBallClassname );
        
        
        
engfuncEngFunc_SetSize  EntityFloat:{ -311.0, -1.0, -1.0 }, Float:{ 311.01.01.0 } );
        
engfuncEngFunc_SetOriginEntityOrigin );
        
        
set_pevEntitypev_effectsEF_BRIGHTFIELD );
        
set_pevEntitypev_solidSOLID_BBOX );
        
set_pevEntitypev_movetypeMOVETYPE_TOSS );
        
set_pevEntitypev_ownerPlayer );
        
set_pevEntitypev_nextthinkget_gametime() + 0.1 );
    }
    
    return 
PLUGIN_HANDLED_MAIN;


&& when i use the command to spawn the ball, i got crashes :( no error, nothing in log. my game will be freezed.

Arkshine 02-10-2010 06:05

Re: Problem with pev_view_ofs
 
pev(Player,pev_v_angle,Origin)
engfunc( EngFunc_SetOrigin, Entity, Origin );


You think really that pev_v_angle is an origin ?

One 02-10-2010 06:12

Re: Problem with pev_view_ofs
 
ty & Nope.

you know why i cant spawn more sprites ? how i said, i got crashes when i spawn more that 1 sprite :(

Arkshine 02-10-2010 06:17

Re: Problem with pev_view_ofs
 
You don't show enough code.

One 02-10-2010 06:23

Re: Problem with pev_view_ofs
 
Silly coded... :(

PHP Code:


new const gwatterBallClassname[] = "watterball";
new 
gLaserSprite;
#define write_coord_f(%0)  ( engfunc( EngFunc_WriteCoord, %0 ) )

public ClientCommand_Createwatter ( const Player, const Level, const Cid )
{
    if ( !
cmd_accessPlayerLevelCid) )
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
Float:Origin[3];
    new 
Entity;
    
    
pevPlayerpev_originOrigin );
    
    if ( ( 
Entity create_entity"info_target" ) ) )
    {
        
set_pevEntitypev_classnamegwatterBallClassname );
        
        
        
engfuncEngFunc_SetSize  EntityFloat:{ -311.0, -1.0, -1.0 }, Float:{ 311.01.01.0 } );
        
engfuncEngFunc_SetOriginEntityOrigin );
        
        
set_pevEntitypev_effectsEF_BRIGHTFIELD );
        
set_pevEntitypev_solidSOLID_BBOX );
        
set_pevEntitypev_movetypeMOVETYPE_TOSS );
        
set_pevEntitypev_ownerPlayer );
        
set_pevEntitypev_nextthinkget_gametime() + 0.1 );
    }
    
    return 
PLUGIN_HANDLED_MAIN;
}
public 
ClientCommand_Killwatter ( const Player, const Level, const Cid )
{
    if ( 
cmd_accessPlayerLevelCid) )
    {
        
remove_entity_namegwatterBallClassname );
        return 
PLUGIN_HANDLED_MAIN;
    }
    
    return 
PLUGIN_HANDLED;
}
public 
CwatterBall_Think ( const Entity )
{
    if ( !
is_valid_entEntity ) )
    {
        return;
    }
    static 
Float:Origin[3];
    static 
Float:TestEnd[3];
    static 
Float:EndPos[3];
    
    
pevEntitypev_originOrigin );
    
    
TestEnd[0] = random_float( -5000.05000.0 );
    
TestEnd[1] = random_float( -5000.05000.0 );
    
TestEnd[2] = random_float0.05000.0 );
    
    
trace_lineEntityOriginTestEndEndPos );
    
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_BEAMCYLINDER  )
    
write_coord_fOrigin[0] );
    
write_coord_fOrigin[1]  );
    
write_coord_fOrigin[2] + 200.0 );
    
write_coord_fEndPos[0] );
    
write_coord_fEndPos[1] );
    
write_coord_fEndPos[2] );
    
write_shortgLaserSprite );
    
write_byte255 );    //Start frame 0 
    
write_byte255 );    //Frame rate 0
    
write_byte20 );    //Life 10
    
write_byte10);    //Width 20
    
write_byte255);    //noise 300
    
write_byterandom_num(1,255) );    //R
    
write_byterandom_num(1,255)  );    //G
    
write_byterandom_num(1,255)  );    //B
    
write_byte255 );    //brightness 200
    
write_byte);    //Scroll 30
    
message_end();        //End
    
    
    
set_pevEntitypev_nextthinkget_gametime() + 0.25 );


Dont lol @ code please :(


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

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