Raised This Month: $ Target: $400
 0% 

Wath is wrong in this code?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 01-01-2010 , 15:42   Wath is wrong in this code?
Reply With Quote #1

I copie some parts of codes and tried to made a plugin that give autobhop to players when they type /bhop. But it didn't worked.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <engine>

#define PLUGIN "Bhop"
#define AUTHOR "AUTHOR"
#define VERSION "0.1"

#define MAX_PLAYERS 32
#define PLAYER_JUMP  6
#define PLAYER_MAX_SAFE_FALL_SPEED  580
#define MULTI  0
#define WALL  1
#define AUTOBHOP 2
#define LONGJUMP 3
#define NORMAL  5
#define CANCEL  9
#define KEYS ((1<<MULTI)|(1<<WALL)|(1<<AUTOBHOP)|(1<<LONGJUMP)|(1<<NORMAL)|(1<<CANCEL))

new g_pCvarAutoBhops
new g_iJumpType[MAX_PLAYERS+1]
new 
g_iJumps[MAX_PLAYERS+1]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Player_Jump"player""Player_Jump")
    
RegisterHam(Ham_Spawn"player""Player_Spawn"1)
    
    
    
register_clcmd("say /bhop""ClientCommand_Jump")
    
    
g_pCvarAutoBhops register_cvar("ja_autobhop_limit""300")
}
public 
Player_Spawn(id)
{
    if( !
is_user_alive(id) )
    {
        
g_iJumpType[id] = NORMAL
    
}
}
public 
ClientCommand_Jump(id)
{
    if( !
is_user_alive(id) )
    {
        
g_iJumpType[id] = AUTOBHOP
    
}
}
public 
Player_Jump(id)
{
    if( !
is_user_alive(id)
    || 
pev(idpev_waterlevel) >= )
{
    return
}
switch( 
g_iJumpType[id] )
{
    case 
AUTOBHOP:AutoBhop(id)
    }
}
AutoBhop(id)
{
static 
iFlags iFlags pev(idpev_flags)
if( !(
iFlags FL_ONGROUND) )
{
    return
}
static 
iOldButtons iOldButtons pev(idpev_oldbuttons)
if( !(
iOldButtons IN_JUMP) )
{
    
g_iJumps[id] = 0
    
return
}
set_pev(idpev_oldbuttonsiOldButtons IN_JUMP)
static 
iLimit iLimit get_pcvar_num(g_pCvarAutoBhops)
if( 
iLimit && g_iJumps[id]++ >= iLimit )
{
    return
}

__________________
Please help me with this Thread
I am 70% addicted to Counterstrike. What about you?
Ill make any spanish translation of a plugin. Just ask for it

Last edited by benamo6; 01-02-2010 at 02:21.
benamo6 is offline
Send a message via MSN to benamo6
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-01-2010 , 15:44   Re: Wath is wrong in this code?
Reply With Quote #2

Start to indent properly your code, please.
__________________
Arkshine is offline
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 01-01-2010 , 15:50   Re: Wath is wrong in this code?
Reply With Quote #3

Edited first post
__________________
Please help me with this Thread
I am 70% addicted to Counterstrike. What about you?
Ill make any spanish translation of a plugin. Just ask for it
benamo6 is offline
Send a message via MSN to benamo6
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-01-2010 , 16:05   Re: Wath is wrong in this code?
Reply With Quote #4

Quote:
Originally Posted by title
Wath is wrong in this code?
Identation prevent us from [quick / having motivation to] read the code.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-01-2010 , 16:14   Re: Wath is wrong in this code?
Reply With Quote #5

Quote:
Originally Posted by benamo6 View Post
Edited first post
Your code is not indented... Please do some efforts.
__________________
Arkshine is offline
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 01-01-2010 , 16:19   Re: Wath is wrong in this code?
Reply With Quote #6

Sorry, my english is not so good. I cant understund wath indentation means. Can you explain it to me?
Edit: I understund wath you mean now. Sorry for bad understunding, already edited first post.

Edit2: I already done indentation with amxx studio, and there I saw it much better than the forum shows. Tabs here are wierd.
__________________
Please help me with this Thread
I am 70% addicted to Counterstrike. What about you?
Ill make any spanish translation of a plugin. Just ask for it

Last edited by benamo6; 01-01-2010 at 16:31.
benamo6 is offline
Send a message via MSN to benamo6
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 01-01-2010 , 19:28   Re: Wath is wrong in this code?
Reply With Quote #7

Type Control+I in AMX Mod Studio and copy the stuff here
Mxnn is offline
benamo6
Veteran Member
Join Date: Aug 2008
Location: NeverLand
Old 01-01-2010 , 20:37   Re: Wath is wrong in this code?
Reply With Quote #8

That's wath I did but I get that when I post it.
I idented it on another pc and it worked, for some reason in the other one I couldn't do it.
__________________
Please help me with this Thread
I am 70% addicted to Counterstrike. What about you?
Ill make any spanish translation of a plugin. Just ask for it

Last edited by benamo6; 01-02-2010 at 02:22.
benamo6 is offline
Send a message via MSN to benamo6
Reply



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 04:16.


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