Monthly Target: $400 Donations: $53
 13% 

Multijump


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Altecaho
Senior Member
Join Date: Oct 2010
Old 10-17-2010 , 07:36   Multijump
Reply With Quote #1

I need multijump to be avaible only for CT's. It compiles normally, but then it doesn't work at all
Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>

#define ADMINACCESS ADMIN_LEVEL_F

new jumpnum[33] = 0
new bool:dojump[33] = false

public plugin_init()
{
    register_plugin("MultiJump","1.1","twistedeuphoria")
    register_cvar("amx_maxjumps","1")
    register_cvar("amx_mjadminonly","1")
}

public client_putinserver(id)
{
    jumpnum[id] = 0
    dojump[id] = false
}

public client_disconnect(id)
{
    jumpnum[id] = 0
    dojump[id] = false
}

public client_PreThink(id)
{
    if(!is_user_alive(id)) return PLUGIN_CONTINUE
    if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE
    new nbut = get_user_button(id)
    new obut = get_user_oldbutton(id)
    if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP) & cs_get_user_team(id) == 2)
    {
        if(jumpnum[id] < get_cvar_num("amx_maxjumps"))
        {
            dojump[id] = true
            jumpnum[id]++
            return PLUGIN_CONTINUE
        }
    }
    if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND) & cs_get_user_team(id) == 2)
    {
        jumpnum[id] = 0
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}

public client_PostThink(id)
{
    if(!is_user_alive(id)) return PLUGIN_CONTINUE
    if(get_cvar_num("amx_mjadminonly") && (!access(id,ADMINACCESS))) return PLUGIN_CONTINUE
    if(dojump[id] == true & cs_get_user_team(id) == 2)
    {
        new Float:velocity[3]    
        entity_get_vector(id,EV_VEC_velocity,velocity)
        velocity[2] = random_float(265.0,285.0)
        entity_set_vector(id,EV_VEC_velocity,velocity)
        dojump[id] = false
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}
Altecaho is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 10-17-2010 , 07:43   Re: Multijump
Reply With Quote #2

Replace all
PHP Code:
cs_get_user_team(id) == 
with
PHP Code:
&& cs_get_user_team(id) == 
bibu is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 10-17-2010 , 07:55   Re: Multijump
Reply With Quote #3

use: get_user_team == 1 | 2 | 3
or: cs_get_user_team == CS_TEAM_T | CS_TEAM_CT | CS_TEAM_SPEC
reinert is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 10-17-2010 , 07:59   Re: Multijump
Reply With Quote #4

Quote:
Originally Posted by reinert View Post
use: get_user_team == 1 | 2 | 3
or: cs_get_user_team == CS_TEAM_T | CS_TEAM_CT | CS_TEAM_SPEC
Yes my fault, but he also forgot an other ' & ' .
bibu is offline
Altecaho
Senior Member
Join Date: Oct 2010
Old 10-17-2010 , 11:30   Re: Multijump
Reply With Quote #5

Ill try that.
EDIT: It works Thanks

Last edited by Altecaho; 10-17-2010 at 11:33.
Altecaho is offline
Exolent[jNr]
AMX Mod X Moderator
Join Date: Feb 2007
Location: Tennessee
Old 10-17-2010 , 17:42   Re: Multijump
Reply With Quote #6

Quote:
Originally Posted by reinert View Post
use: get_user_team == 1 | 2 | 3
or: cs_get_user_team == CS_TEAM_T | CS_TEAM_CT | CS_TEAM_SPEC
No. That is completely wrong.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-17-2010 , 17:47   Re: Multijump
Reply With Quote #7

Quote:
Originally Posted by Exolent[jNr] View Post
No. That is completely wrong.
I don't think he's showing how to check team in code but was using the OR operator instead of typing "or"... Atleast I hope so.
__________________

Last edited by Bugsy; 10-17-2010 at 17:53.
Bugsy is offline
Exolent[jNr]
AMX Mod X Moderator
Join Date: Feb 2007
Location: Tennessee
Old 10-17-2010 , 18:00   Re: Multijump
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
I don't think he's showing how to check team in code but was using the OR operator instead of typing "or"... Atleast I hope so.
I doubt he was using proper coding for that.
He was most likely coding for logic:
If the player's team is Terrorist, Counter-Terrorist, or Spectator
Code:
if( cs_get_user_team( iPlayer ) == CS_TEAM_T || CS_TEAM_CT || CS_TEAM_SPECTATOR )
3 ways to fix this with the if() statement, and he wasn't close to any.
1.
Code:
if( cs_get_user_team( iPlayer ) == CS_TEAM_T || cs_get_user_team( iPlayer ) == CS_TEAM_CT || cs_get_user_team( iPlayer ) == CS_TEAM_SPECTATOR )
2.
Code:
new CsTeams:iTeam = cs_get_user_team( iPlayer );
if( iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT || iTeam == CS_TEAM_SPECTATOR )
3.
Code:
if( ( 1 << ( _:cs_get_user_team( iPlayer ) ) ) & ( ( 1 << ( _:CS_TEAM_T ) ) | ( 1 << ( _:CS_TEAM_CT ) ) | ( 1 << ( _:CS_TEAM_SPECTATOR ) ) ) )
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-17-2010 , 18:06   Re: Multijump
Reply With Quote #9

I think what Bugsy was saying is that it wasn't code that he was posting. He was trying to say use get_user_team() with 1, 2, or 3 and cs_get_user_team() with CS_TEAM_T, etc.
__________________
fysiks is offline
Exolent[jNr]
AMX Mod X Moderator
Join Date: Feb 2007
Location: Tennessee
Old 10-17-2010 , 18:15   Re: Multijump
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
I think what Bugsy was saying is that it wasn't code that he was posting. He was trying to say use get_user_team() with 1, 2, or 3 and cs_get_user_team() with CS_TEAM_T, etc.
That makes sense now that I read reinert's post again.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:54.


Powered by vBulletin®
Copyright ©2000 - 2015, vBulletin Solutions, Inc.
Theme made by Freecode