View Single Post
oTm4n3
Member
Join Date: Jul 2021
Old 09-14-2021 , 22:24   Re: Only To Real Devlopers ;)
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
These errors are not complicated, just look at what they tell you. You are posting in scripting help so I assume you are scripting the fixes yourself.

You have 2 functions with the same name, which you cannot do. How is the compiler supposed to know which one you want to call?
PHP Code:
public WallClimb(idbutton)
public 
WallClimb(idFloatiOrigin[3], FloatfNormalVector[3], button
This error is a result of that, as it's thinking you want to use the first one:
Code:
Error: Argument type mismatch (argument 2) on line 83
Same variable defined twice Up_Velocity, similar issue as the duplicate function definition:
PHP Code:
new FloatUp_Velocity;
new 
FloatFinal_Velocity[3], FloatUp_Velocity[3]; 
There's no function or macro defined as 'Z', so not sure what you're doing here:
PHP Code:
fl_Velocity[2] = (EntOrigin[2]- VicOrigin[2]) / fl_Time 
Fix these issues and report back
Whats about this ?
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <fun>
#include <orpheu>

#define PLUGIN "Moving Mekanikusu"
#define VERSION "1.0"
#define AUTHOR ""

#define PLAYER_SPEED 500.0
#define CLIMB_SPEED 200.0
#define WALLJUMP_HEIGHT 450.0
#define CLIMBJUMP_HEIGHT 225.0

#define SetTrue(%1,%2) (%1 |= 1<<(%2&31))
#define SetFalse(%1,%2) (%1 &= ~1<<(%2&31))
#define IsTrue(%1,%2) (%1 & 1<<(%2&31))

new Float:g_WallOrigin[32][3]
new 
g_bFallingg_bJumpg_bWallBlock;
new 
Float:g_fVelocity[32][3];
new 
g_iJumpCount[32];
new 
g_HamBot
new boolg_iOnWall[32], Floatg_iOrigin[32][3], Floatg_fNormalVector[32][3];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurWeapon""Event_CurWeapon""be""1=1")
    
    
register_touch("player""worldspawn""Touch_World")
    
register_touch("player""func_wall""Touch_World")
    
register_touch("player""func_breakable""Touch_World")
    
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn_Post"1)
}

public 
plugin_cfg()
{
    
server_cmd("mp_freezetime 0")    
    
server_cmd("sv_maxspeed 9999")
    
server_cmd("sv_airaccelerate 100")
    
server_cmd("sv_gravity 600")
}

public 
client_putinserver(id)
{
    if(!
g_HamBot && is_user_bot(id))
    {
        
g_HamBot 1
        set_task
(0.1"Register_HamBot"id)
    }
}
 
public 
Register_HamBot(id)
{
    
RegisterHamFromEntity(Ham_Spawnid"fw_PlayerSpawn_Post"1)
}

public 
client_disconnect(id)
{
    
client_cmd(id,"cl_forwardspeed 400")
    
client_cmd(id,"cl_backspeed 400")
    
client_cmd(id,"cl_sidespeed 400")
}

public 
client_PreThink(id)
{
    if(!
is_user_alive(id))
        return
        
    
// CLIMB WALL
    //static Button; Button = get_user_button(id)
    //if(Button & IN_DUCK) WallClimb(id, Button)
    
    
if(g_iOnWall[id]) {
        static 
ButtonButton get_user_button(id);
        
pev(idpev_origing_iOrigin[id]);
        
WallClimb(idg_iOrigin[id], g_fNormalVector[id], Button);
    }
    
    
// WALL JUMP
    // Whether user is falling
    
if (is_user_alive(id) && is_user_connected(id) && pev(idpev_flFallVelocity) >= 350.0)
        
SetTrue(g_bFallingid);
    else
        
SetFalse(g_bFallingid);

    
// Wall jump stuff
    // Skipping one frame after jump from ground, because of entities dumb touch system
    
if (IsTrue(g_bWallBlockid))
        
SetFalse(g_bWallBlockid);
    static 
buttonsoldbuttons;
    
buttons pev(idpev_button);
    
oldbuttons pev(idpev_oldbuttons);
    
// If user performs "manual" jump
    
if (buttons IN_JUMP && !(oldbuttons IN_JUMP) && pev(idpev_flags) & FL_ONGROUND){
        
pev(idpev_velocityg_fVelocity[id]);        // Sets base velocity and
        
g_iJumpCount[id] = 10;        // allowed jumps number
        
SetTrue(g_bWallBlockid);
    }
    
// Wall jump performance
    // If user touched wall and pressed JUMP button
    
if (IsTrue(g_bJumpid)){
        if (
pev(idpev_flags) & FL_ONGROUND){
        
// If user is not in air wall jump doesn't count as performed
            
SetFalse(g_bJumpid);
        }
        else {
            
// Otherwise jump
            
set_pev(idpev_velocityg_fVelocity[id]);
            
g_iJumpCount[id]--;
            
SetFalse(g_bJumpid);
        }
    }
    
    
// Auto BHOP
    
entity_set_float(idEV_FL_fuser20.0)
    if(
entity_get_int(idEV_INT_button) & 2
    {
        new 
flags entity_get_int(idEV_INT_flags)

        if (
flags FL_WATERJUMP)
            return
        if ( 
entity_get_int(idEV_INT_waterlevel) >= )
            return
        if ( !(
flags FL_ONGROUND) )
            return

        new 
Float:velocity[3]
        
entity_get_vector(idEV_VEC_velocityvelocity)
        
velocity[2] += 250.0
        entity_set_vector
(idEV_VEC_velocityvelocity)
        
        static 
OrpheuFunction:handleSetAnimation;
        
handleSetAnimation OrpheuGetFunction("SetAnimation""CBasePlayer");
        
OrpheuCallSuper(handleSetAnimationid2);
    }
}

/*
public WallClimb(id, button)
{
    static Float:origin[3]
    pev(id, pev_origin, origin)

    if(get_distance_f(origin, g_WallOrigin[id]) > 25.0)
        return 
    
    if(pev(id, pev_flags) & FL_ONGROUND)
        return
        
    static Float:velocity[3]
    if(button & IN_FORWARD)
    {
        velocity_by_aim(id, floatround(WALLJUMP_HEIGHT), velocity)
        fm_set_user_velocity(id, velocity)
    }
    
    return
}    
*/

public WallClimb(idFloatiOrigin[3], FloatfNormalVector[3], button)
{
    if ((
pev(idpev_flags) & FL_ONGROUND) || !(button IN_DUCK)) {
        
g_iOnWall[id] = false;
        
set_pev(idpev_maxspeedPLAYER_SPEED);
        
        return;
    }
    
    new 
FloatendOrigin[3], FloatfractionFloatfRightAngle[3], FloatfUpAngle[3];
    
vector_to_angle(fNormalVectorfRightAngle);
    
vector_to_angle(fNormalVectorfUpAngle);
    
angle_vector(fRightAngleANGLEVECTOR_RIGHTfRightAngle);
    
angle_vector(fUpAngleANGLEVECTOR_UPfUpAngle);
    
xs_vec_mul_scalar(fNormalVector, -32.0endOrigin);
    
xs_vec_add(endOriginiOriginendOrigin);
    
    
engfunc(EngFunc_TraceHulliOriginendOriginIGNORE_MONSTERSHULL_HEADid0);
    
get_tr2(0TR_flFractionfraction);
    
get_tr2(0TR_vecPlaneNormalg_fNormalVector[id]);
    
free_tr2(0);
    
    if(
fraction != 1.0) {
        
g_iOnWall[id] = true;
        
        
set_pev(idpev_maxspeed, -1.0);
        
        if(
button IN_JUMP) {
            
g_fVelocity[id][0] = CLIMBJUMP_HEIGHT fNormalVector[0];
            
g_fVelocity[id][1] = CLIMBJUMP_HEIGHT fNormalVector[1];
            
g_fVelocity[id][2] = CLIMBJUMP_HEIGHT;
            
            
g_iOnWall[id] = false;
            
set_pev(idpev_velocityg_fVelocity[id]);
            
            
set_pev(idpev_maxspeedPLAYER_SPEED);
            return;
        }
        
        
//new Float: Up_Velocity;
        
new FloatFinal_Velocity[3], FloatUp_Velocity[3];
        if(
button IN_FORWARD)
            
velocity_by_aim(idfloatround(CLIMB_SPEED), Final_Velocity);
        else if(
button IN_BACK
            
velocity_by_aim(id, -floatround(CLIMB_SPEED), Final_Velocity);
        else {
            
xs_vec_mul_scalar(g_fVelocity[id], 0.0g_fVelocity[id]);
            return;
        }
        
        
//Up_Velocity = g_fVelocity[id][2];
        
        
xs_vec_normalize(Final_VelocityFinal_Velocity);
        
xs_vec_normalize(Final_VelocityUp_Velocity);
        
        new 
Floatfraction xs_vec_dot(Final_VelocityfRightAngle);
        
        
xs_vec_mul_scalar(fRightAnglefractionfRightAngle);
        
        
xs_vec_mul_scalar(fRightAngleCLIMB_SPEEDFinal_Velocity);
        
        
fraction xs_vec_dot(Up_VelocityfUpAngle);
        
        
xs_vec_mul_scalar(fUpAnglefractionfUpAngle);
        
        
xs_vec_mul_scalar(fUpAngleCLIMB_SPEEDUp_Velocity);
        
        
Up_Velocity[0] *= -1.0;
        
Up_Velocity[1] *= -1.0;
        
        
xs_vec_mul_scalar(g_fVelocity[id], 0.0g_fVelocity[id]);
        
xs_vec_add(g_fVelocity[id], Final_Velocityg_fVelocity[id]);
        
xs_vec_add(g_fVelocity[id], Up_Velocityg_fVelocity[id]);
        
        
//g_fVelocity[id][2] = Up_Velocity;
        
        
pev(idpev_origing_iOrigin[id]);
    }
    else {
        
g_iOnWall[id] = false;
        
set_pev(idpev_maxspeedPLAYER_SPEED);
    }
}

public 
client_PostThink(id
{
    if(!
is_user_alive(id)) 
        return
        
    if(
g_iOnWall[id])
        
set_pev(idpev_velocityg_fVelocity[id]);
}

public 
fuck_ent(entFloat:VicOrigin[3], Float:speedFloat:Z)
{
    static 
Float:fl_Velocity[3], Float:EntOrigin[3], Float:distance_fFloat:fl_Time
    
    pev
(entpev_originEntOrigin)
    
    
distance_f get_distance_f(EntOriginVicOrigin)
    
fl_Time distance_f speed
        
    fl_Velocity
[0] = (EntOrigin[0]- VicOrigin[0]) / fl_Time
    fl_Velocity
[1] = (EntOrigin[1]- VicOrigin[1]) / fl_Time
//    fl_Velocity[2] = Z (EntOrigin[2]- VicOrigin[2]) / fl_Time

    
set_pev(entpev_velocityfl_Velocity)
}

public 
Touch_World(idworld
{
    if(
is_user_alive(id) && !g_iOnWall[id]) 
    {
        
pev(idpev_origing_WallOrigin[id]);
        
        
// Wall jump stuff
        // If user is touching wall, not on ground, has some wall jumps left and currently  in jump
        
if (!(pev(idpev_flags) & FL_ONGROUND) && g_iJumpCount[id]
             && (
pev(idpev_button) & IN_JUMP || pev(idpev_button) & IN_DUCK) && !IsTrue(g_bWallBlockid)){
            
// Reverse velocity on X axis
            
g_fVelocity[id][0] *= (-1);
            
// Set velocity upwards equal to 300.0 units/s
            
g_fVelocity[id][2] = 300.0;
            
            new 
FloatiOrigin[3], FloatendOrigin[3], FloatlinearFloatfNormalVector[3], FloatfAngleVector[3], Floattr_fraction;
            
pev(idpev_originiOrigin);
            
pev(idpev_velocityendOrigin);
            
xs_vec_add(fAngleVectorendOriginfAngleVector);
            
linear floatsqroot(floatpower(endOrigin[0], 2.0) + floatpower(endOrigin[1], 2.0) + floatpower(endOrigin[2], 2.0));
            
xs_vec_normalize(endOriginendOrigin);
            
xs_vec_mul_scalar(endOrigin32.0endOrigin);
            
endOrigin[2] = 0.0;
            
xs_vec_add(endOriginiOriginendOrigin);
            
engfunc(EngFunc_TraceHulliOriginendOriginIGNORE_MONSTERSHULL_HEADid0);
            
get_tr2(0TR_flFractiontr_fraction);
            
get_tr2(0TR_vecEndPosendOrigin);
            
get_tr2(0TR_vecPlaneNormalfNormalVector);
            
free_tr2(0);
            
            if(
tr_fraction == 1.0 || engfunc(EngFunc_PointContentsendOrigin) == CONTENTS_SKY)
                return;
            
            
// CLIMB WALL
            
static ButtonButton get_user_button(id);
            if(
Button IN_DUCK) {
                
g_fNormalVector[id][0] = fNormalVector[0];
                
g_fNormalVector[id][1] = fNormalVector[1];
                
g_fNormalVector[id][2] = fNormalVector[2];
                
g_iOnWall[id] = true;
                return;
            }
            
            
xs_vec_normalize(fAngleVectorfAngleVector);
            
            new 
Floatfraction xs_vec_dot(fAngleVectorfNormalVector);
            
            
xs_vec_mul_scalar(fNormalVectorfractionfNormalVector);
            
xs_vec_sub(fNormalVectorfAngleVectorfAngleVector);
            
xs_vec_mul_scalar(fAngleVector, (1-(fraction*fraction))/xs_vec_len(fAngleVector), fAngleVector);
            
            
xs_vec_add(fNormalVectorfAngleVectorfNormalVector);
            
            
xs_vec_mul_scalar(fNormalVectorlinearg_fVelocity[id]);
            
            
g_fVelocity[id][0] *= -1.0;
            
g_fVelocity[id][1] *= -1.0;
            
g_fVelocity[id][2] = WALLJUMP_HEIGHT;
            
            
SetTrue(g_bJumpid);
        }
    }
}


public 
fw_PlayerSpawn_Post(id)
{
    
client_cmd(id,"cl_forwardspeed 9999")
    
client_cmd(id,"cl_sidespeed 9999")
    
client_cmd(id,"cl_backspeed 9999")
    
client_cmd(id,"hud_centerid 0")
}

public 
Event_CurWeapon(id)
{
    if(!
is_user_alive(id))
        return
        
    
set_user_maxspeed(idPLAYER_SPEED)

oTm4n3 is offline