AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Few questions (https://forums.alliedmods.net/showthread.php?t=223908)

EvoLutionCRO 08-18-2013 10:22

Few questions
 
Hello,

I have few scripting questions:

Spawn boxes on map as entity

Is it possible to spawn boxes which look like ones on the image below as an entity on specific coordinates?

http://files.gamebanana.com/img/ss/t...b791852007.jpg

Check if user isn't moving

Is there any way to trigger event if user hadn't moved (Jumped, ducked, went forward, backward, left or right) for 5 seconds and then trigger other event if user moves again (Note: camera moving doesn't affect events)

Code examples would be useful..
-Thank you alot!

EvoLutionCRO 08-18-2013 16:39

Re: Few questions
 
After searching a bit, I couldn't find anything. Can you please provide me with some working example.

devilicioux 08-22-2013 04:40

Re: Few questions
 
Quote:

Originally Posted by EvoLutionCRO (Post 2016245)

Check if user isn't moving

Is there any way to trigger event if user hadn't moved (Jumped, ducked, went forward, backward, left or right) for 5 seconds and then trigger other event if user moves again (Note: camera moving doesn't affect events)

Search for the plugin BAD CAMPER For Checking NO Movement..
Plus I had this code You can use it if it looks useful to you :)

PHP Code:

public FM_CmdStart_Preplruc_handle )
{
    static 
bool:wasOnGround[33], bool:wasDuckingBeforeFalling[33];
    static 
buttonoldButtonsflags;
    
    
//button = pev( plr, pev_button );
    
button get_ucuc_handle UC_Buttons );
    
oldButtons pevplrpev_oldbuttons );
    
flags pevplrpev_flags );
    
    if( 
wasOnGround[plr] && !( flags FL_ONGROUND ) )
    {
        
wasDuckingBeforeFalling[plr] = bool:!!( oldButtons IN_DUCK );
    }
    else if( 
wasDuckingBeforeFalling[plr] && wasOnGround[plr] && flags FL_ONGROUND )
    {
        
wasDuckingBeforeFalling[plr] = false;
    }
    
    if( 
button IN_JUMP && !( oldButtons IN_JUMP ) )
    {
        if( 
wasOnGround[plr] )
        {
            
// detecting normal jumps
        
++g_iJumps[plr];
        if(
g_iJumps[plr]%3==0)
        { 
    
colored_print(0"^x04 Yeah Baby !! ^x03 You got 1 point for perfect jump :D");
    }        
}
        else
        {
            
// detecting bhops
            
            
static Float:velocity[3];
            
pevplrpev_velocityvelocity );
            
            if( !
velocity[2] )
            {
                
colored_print(0"^x04 Whoaaa Pro !! ^x03 You got 2 point for Bhop jump :P");
                if( 
button IN_DUCK )
                {
                    
// detecting duckbhops
        
colored_print(plr"^x04 PURE SKILL !! ^x03 You got 3 points for Perfect Duck Bhop xD ");
                }
            }
        }
    }
    else if( 
button IN_DUCK )
    {
        
        if( 
oldButtons IN_DUCK )
        {
            if( !
wasDuckingBeforeFalling[plr] && !wasOnGround[plr] && flags FL_ONGROUND )
            {
                
// detecting jumps or any cases where the user ducks in the air but does not release it on ground
        
colored_print(plr"^x04 GODLIKE !! ^x03 You got 4 points for Weird Duck Bhop");
            }
        }
        else
        {
            if( 
wasOnGround[plr] )
            {
                
// detecting normal ducks
        
++g_iDucks[plr];
        if(
g_iDucks[plr]%3==0)
        {
        
colored_print(plr"^x04 Dont Keep Ducking Idiot :/");
        }            
}
        }
    }
    
    
wasOnGround[plr] = bool:!!( flags FL_ONGROUND );


Use Colored_print Stock by Mercyless Or Just Remove those print commands.

red_bull2oo6 08-22-2013 11:39

Re: Few questions
 
its possible to spawn boxes exactly like in your picture but, you will need a bit more knowledge and you will need each crate's model.
you will also need to know a crate's size ( mins, max ).

you can also set each crate's type using EV_INT_iuser1 ( just an example ).
and then when you touch it it'll act depending on its type.

you can also look at DeathRace plugin. ( it needs a created map< deathrace mod > and it replace crates.. )


All times are GMT -4. The time now is 15:50.

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