AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Wath is wrong in this code? (https://forums.alliedmods.net/showthread.php?t=114058)

benamo6 01-01-2010 15:42

Wath is wrong in this code?
 
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
}



Arkshine 01-01-2010 15:44

Re: Wath is wrong in this code?
 
Start to indent properly your code, please.

benamo6 01-01-2010 15:50

Re: Wath is wrong in this code?
 
Edited first post

ConnorMcLeod 01-01-2010 16:05

Re: Wath is wrong in this code?
 
Quote:

Originally Posted by title
Wath is wrong in this code?

Identation prevent us from [quick / having motivation to] read the code.

Arkshine 01-01-2010 16:14

Re: Wath is wrong in this code?
 
Quote:

Originally Posted by benamo6 (Post 1039292)
Edited first post

Your code is not indented... Please do some efforts.

benamo6 01-01-2010 16:19

Re: Wath is wrong in this code?
 
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.

Mxnn 01-01-2010 19:28

Re: Wath is wrong in this code?
 
Type Control+I in AMX Mod Studio and copy the stuff here

benamo6 01-01-2010 20:37

Re: Wath is wrong in this code?
 
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.


All times are GMT -4. The time now is 04:16.

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