AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   (KREEDZ) Make CP on ladder (https://forums.alliedmods.net/showthread.php?t=182995)

bazhenov93 04-16-2012 01:10

(KREEDZ) Make CP on ladder
 
How a player can create a checkpoint on ladder?
I have this code, but when you try create CP on a ladder it's says "You can't make a checkpoint in the air" That's because of " FL_ONGROUND2 "

PHP Code:

public CheckPoint(id)
{
    if(
get_pcvar_num(kz_checkpoints) == 1)
    {

        if( !
is_user_aliveid ) )
        {
            switch (
get_pcvar_num(kz_chatorhud))
            {
                case 
1ColorChat(idGREEN"You must be alive to use this command.")
                case 
2kz_hud_message(id"You must be alive to use this command")
            }
            return 
PLUGIN_HANDLED
        
}

        if( !( 
pevidpev_flags ) & FL_ONGROUND2 ) )
        {
            switch (
get_pcvar_num(kz_chatorhud))
            {
                case 
1ColorChat(idGREEN"You can't make a checkpoint in the air.")
                case 
2kz_hud_message(id"You can't make a checkpoint in the air")
            }
            return 
PLUGIN_HANDLED
        
}
        
        if( 
IsPaused[id] )
        {
            switch (
get_pcvar_num(kz_chatorhud))
            {
                case 
1ColorChat(idGREEN"You can't make a checkpoint in pause.")
                case 
2kz_hud_message(id"You can't make a checkpoint in pause")
            }
            return 
PLUGIN_HANDLED
        
}
        
        
pev(idpev_originCheckpoints[id][g_bCpAlternate[id] ? 0])
        
g_bCpAlternate[id] = !g_bCpAlternate[id]
        
checknumbers[id]++

        switch (
get_pcvar_num(kz_chatorhud))
        {
            case 
1ColorChat(idGREEN"^1Checkpoint ^3#%d ^1created",checknumbers[id])
            case 
2kz_hud_message(id"Checkpoint #%d",checknumbers[id])
        }
    }
    else
    {
        switch (
get_pcvar_num(kz_chatorhud))
        {
            case 
1ColorChat(idGREEN"Checkpoints are off.")
            case 
2kz_hud_message(id"Checkpoints are off")
        }
    }
    return 
PLUGIN_HANDLED



rak 04-16-2012 01:55

Re: (KREEDZ) Make CP on ladder
 
check if touch a ladder entity ( func_ladder )

--------------------------

chequea si esta tocando la entidad func_ladder

bazhenov93 04-16-2012 03:43

Re: (KREEDZ) Make CP on ladder
 
Yes, very good explained.... tut with func_ladder?
I searched and founded nothing=S

rak 04-16-2012 07:32

Re: (KREEDZ) Make CP on ladder
 
sorry; now i see this

Code:

This is an internal entity. When the map is compiled by VBSP it is processed and then removed: it does not exist when the map is running.

Quote:

Originally Posted by Exolent[jNr] (Post 833435)
If a player is on a ladder, his move type will be fly.
Code:
// at the top of your plugin #define IsOnLadder(%1) (entity_get_int(%1, EV_INT_movetype) == MOVETYPE_FLY) // in your plugin if( IsOnLadder(index) ) {     // player is on a ladder }
That code requires the engine module.

Quote:

Originally Posted by xPaw (Post 833529)
PHP Code:

#define IsOnLadder(%1) (pev(%1, pev_movetype) == MOVETYPE_FLY) 



bazhenov93 04-16-2012 08:08

Re: (KREEDZ) Make CP on ladder
 
So something like this, mmm?

PHP Code:

if( !( pevidpev_flags ) & FL_ONGROUND2 ) )
        {
            switch (
get_pcvar_num(kz_chatorhud))
            {
                case 
1ColorChat(idGREEN"You can't make a checkpoint in the air.")
                case 
2kz_hud_message(id"You can't make a checkpoint in the air")
            }
            if (
pev(%1pev_movetype) == MOVETYPE_FLY)  
          {
            switch (
get_pcvar_num(kz_chatorhud))
        {
            case 
1ColorChat(idGREEN"^1Checkpoint ^3#%d ^1created",checknumbers[id])
            case 
2kz_hud_message(id"Checkpoint #%d",checknumbers[id])
        }



Blue Snake. 04-16-2012 08:45

Re: (KREEDZ) Make CP on ladder
 
A player is on the ground if his vertical speed is 0. So, you can cp on the ladder and maybe in water [no checked]

bazhenov93 04-16-2012 09:13

Re: (KREEDZ) Make CP on ladder
 
I can't compile, the code is not good

rak 04-16-2012 09:17

Re: (KREEDZ) Make CP on ladder
 
becase you don't read tutorials
PHP Code:

if( !( pevidpev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id)) 


bazhenov93 04-16-2012 09:26

Re: (KREEDZ) Make CP on ladder
 
PHP Code:

public CheckPoint(id)
{
    if(
get_pcvar_num(kz_checkpoints) == 1)
    {

        if( !
is_user_aliveid ) )
        {
            {
                
ColorChat(idBLUE"You must be alive to use this command")
            }
            return 
PLUGIN_HANDLED
        
}

        if( !( 
pevidpev_flags ) & FL_ONGROUND2 ) )
        {
            switch (
get_pcvar_num(kz_chatorhud))
            {
                case 
1ColorChat(idGREEN"You can't make a checkpoint in the air")
                case 
2kz_hud_message(id"You can't make a checkpoint in the air")
            }
            return 
PLUGIN_HANDLED
        
}
        
        
        if( 
IsPaused[id] )
        {
            switch (
get_pcvar_num(kz_chatorhud))
            {
                case 
1ColorChat(idGREEN"You can't make a checkpoint in pause")
                case 
2kz_hud_message(id"You can't make a checkpoint in pause")
            }
            return 
PLUGIN_HANDLED
        
}
        
        
pev(idpev_originCheckpoints[id][g_bCpAlternate[id] ? 0])
        
g_bCpAlternate[id] = !g_bCpAlternate[id]
        
checknumbers[id]++, IsOnLadder(id// allow cp on ladder

        
switch (get_pcvar_num(kz_chatorhud))
        {
            case 
1ColorChat(idRED"^1Checkpoint ^4#%d",checknumbers[id])
            case 
2kz_hud_message(id"Checkpoint #%d",checknumbers[id])
        }
        
    }
    else
    {
        {
            
kz_hud_message(id"Checkpoints are off")
        }
    }
    return 
PLUGIN_HANDLED



rak 04-16-2012 09:33

Re: (KREEDZ) Make CP on ladder
 
IsOnLadder(id) // allow cp on ladder

are you kidding me?

PHP Code:

public CheckPoint(id)
{
    if(
get_pcvar_num(kz_checkpoints) == 1)
    {
        
        if( !
is_user_aliveid ) )
        {
            
ColorChat(idBLUE"You must be alive to use this command")
            return 
PLUGIN_HANDLED
        
}
        
        if( !( 
pevidpev_flags ) & FL_ONGROUND2 ) && !IsOnLadder(id))
        {
            switch (
get_pcvar_num(kz_chatorhud))
            {
                case 
1ColorChat(idGREEN"You can't make a checkpoint in the air")
                case 
2kz_hud_message(id"You can't make a checkpoint in the air")
            }
            return 
PLUGIN_HANDLED
        
}
        
        
        if( 
IsPaused[id] )
        {
            switch (
get_pcvar_num(kz_chatorhud))
            {
                case 
1ColorChat(idGREEN"You can't make a checkpoint in pause")
                case 
2kz_hud_message(id"You can't make a checkpoint in pause")
            }
            return 
PLUGIN_HANDLED
        
}
        
        
pev(idpev_originCheckpoints[id][g_bCpAlternate[id] ? 0])
        
g_bCpAlternate[id] = !g_bCpAlternate[id]
        
checknumbers[id]++, 
        
        switch (
get_pcvar_num(kz_chatorhud))
        {
            case 
1ColorChat(idRED"^1Checkpoint ^4#%d",checknumbers[id])
            case 
2kz_hud_message(id"Checkpoint #%d",checknumbers[id])
        }
        
    }
    else
    {
    
        
kz_hud_message(id"Checkpoints are off")
    }

    return 
PLUGIN_HANDLED




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

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