Raised This Month: $ Target: $400
 0% 

Safe Speed Hide'N'Seek coderz


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Trafikkz
Junior Member
Join Date: Apr 2010
Old 08-17-2010 , 17:07   Safe Speed Hide'N'Seek coderz
Reply With Quote #1

Hello, I just want to say how to make this plugin to check and backspeed if is 300 like in the code below. Script is made by coderz and it's called Safe Speed. I really need to edit this because if you have cl_sidespeed 300, cl_backspeed 300 and cl_forwardspeed 300 this plugin doesn't affect anything. cl_sidespeed it's blocked, forwardspeed it's blocked, he just needs backspeed.

Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Safe Side Speed"
#define VERSION "1.1"
#define AUTHOR "coderiz"

new const Float:c_warning_interval = 5.0
new const c_warning[] = "!!! WARNING !!!^n^nYou are using illegal speed settings.^nPlease change your cvar values to defaults:^n^ncl_sidespeed 400^ncl_forwardspeed 400^ncl_backspeed 400"

new Float:plr_warntime[32]
new plr_warnings[32]
new plr_badframe[32]

new Float:vector[3]
new index, buttons
new Float:fw, Float: sd, Float:bw

new hudobj
new hudchannel


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_cvar("safespeed_hud", "-1")
    hudchannel = get_cvar_num("safespeed_hud")
    
    register_forward(FM_CmdStart, "cmdStart")
    register_forward(FM_ClientPutInServer, "putInServer")
    
    hudobj = CreateHudSyncObj()
}

public putInServer(id)
{
    plr_warnings[id-1] = 0
}

public cmdStart(id, uc_handle, seed)
{
    if(pev(id, pev_movetype) != MOVETYPE_WALK) return
    
    index = id - 1
    
    get_uc(uc_handle, UC_ForwardMove, fw)
    get_uc(uc_handle, UC_SideMove, sd)
    get_uc(uc_handle, UC_BackMove, bw)
    buttons = get_uc(uc_handle, UC_Buttons)
    
    if((buttons & IN_LEFT) || (buttons & IN_RIGHT))
    {
        pev(id, pev_velocity, vector)
        vector[0] = vector[0] * 0.8
        vector[1] = vector[1] * 0.8
        vector[2] = vector[2] * 0.8
        set_pev(id, pev_velocity, vector)
    }
    
    if(ff == 0.0 || sd == 0.0 || bw == 0.0) {
        plr_badframe[index] = 0
        return
    }
    
    if(floatabs(ff) != floatabs(sd) != floatabs(bw)) 
    {    
        plr_badframe[index]++
        if(plr_badframe[index] > 5) {
            badSpeedCvar(id)
        }
    } else {
        plr_warnings[index] = 0
        plr_badframe[index] = 0
    }
}

public badSpeedCvar(id)
{
    index = id -1
    
    pev(id, pev_velocity, vector)
    
    if(vector_length(vector) < 80.0) return
    
    vector[0] = vector[0] * 0.9
    vector[1] = vector[1] * 0.9
    vector[2] = vector[2] * 0.9
    
    set_pev(id, pev_velocity, vector)
    
    if(get_gametime() - plr_warntime[index] < c_warning_interval) return
    
    plr_warntime[index] = get_gametime()
    plr_warnings[index]++
    
    set_task(0.1, "plrWarn", id)
}

public plrWarn(id)
{
    index = id -1
    
    if(plr_warnings[index] == 0 || !is_user_connected(id)) return
    
    set_hudmessage(150, 50, 0, -1.0, 0.23, 0, 1.0, 3.0, 0.1, 0.2, hudchannel)
    ShowSyncHudMsg(id, hudobj, c_warning)
    
    set_task(3.0, "plrWarn", id)
}
The only error is at BackMove, undefined symbol, in fakemeta doesn't exist any Backward user command
Trafikkz is offline
infek
Senior Member
Join Date: May 2009
Location: Behind you
Old 08-18-2010 , 01:06   Re: Safe Speed Hide'N'Seek coderz
Reply With Quote #2

Why not use Engine IN_BACK etc.

http://www.amxmodx.org/funcwiki.php?...#const_buttons

---------
There is no UC_BackMove


http://www.amxmodx.org/funcwiki.php?go=module&id=16
PHP Code:
UserCmd Constants 
enum 
{
    
// Interpolation time on client
    
UC_LerpMsec,        // short
    // Duration in ms of command
    
UC_Msec,        // byte
    // Command view angles
    
UC_ViewAngles,        // float array[3]
    
    // Intended velocities
    // Forward velocity
    
UC_ForwardMove,        // float
    // Sideways velocity
    
UC_SideMove,        // float
    // Upward velocity
    
UC_UpMove,        // float
    // Light level at spot where we are standing
    
UC_LightLevel,        // byte
    // Attack buttons
    
UC_Buttons,        // unsigned short
    // Impulse command issued
    
UC_Impulse,        // byte
    // Current weapon id
    
UC_WeaponSelect,    // byte
    
    // Experimental player impact stuff
    
UC_ImpactIndex,        // int
    
UC_ImpactPosition    // float array[3] 
__________________
"Domo Arigato, Mr. Roboto!"
PM me if you want to know a secret
infek is offline
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 22:01.


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