AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   SPRINT a like (https://forums.alliedmods.net/showthread.php?t=217334)

myusername 06-01-2013 14:23

SPRINT a like
 
Hello, i need plugin that makes if player press "shift" key then player will run fast like a sprint. But there is no limit. Only if you running fast then you cant attack.

Thank you.

EpicMonkey 06-01-2013 14:52

Re: SPRINT a like
 
I found something a while ago, try searching for it

myusername 06-01-2013 15:43

Re: SPRINT a like
 
Ive posted after search!

Closer456 06-01-2013 17:36

Re: SPRINT a like
 
this?
http://forums.alliedmods.net/showpos...5&postcount=24

Don_Collione 06-01-2013 20:34

Re: SPRINT a like
 
Quote:

Originally Posted by myusername (Post 1962540)
Hello, i need plugin that makes if player press "shift" key then player will run fast like a sprint. But there is no limit. Only if you running fast then you cant attack.

Thank you.

Check this bro.

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define VERSION "0.1"
#define LEET 1337
//#define DEBUG     1

const g_iProg         = (0xFF);
const 
g_iWeaps        = (0x1E);
const 
g_iMaxSpeed    = (0x2EE);
const 
g_iMaxCzas    = (0xA);

new 
g_iMaxPlayers;

new 
Float:g_fTempMaxSpeed[0x21];
new 
Float:g_fSprintLeft[0x21];

new const 
Float:g_fWeaponsSpeed[g_iWeaps 1]={
    
000.0,
    
250.0000.0260.0250.0240.0
    
250.0250.0240.0250.0250.0,                
    
250.0250.0210.0240.0240.0,    
    
250.0250.0210.0250.0220.0,              
    
230.0230.0250.0210.0250.0,            
    
250.0235.0221.0250.0245.0 
};

public 
plugin_init() {
    
register_plugin("Sprint"VERSION"nevermore")
    
    
g_iMaxPlayers get_maxplayers();
    
    
register_forward(FM_CmdStart"fwCmdStart"0);
    
register_event("CurWeapon""eventCurWeapon""be""1=1");
    
    
set_task(0.4"taskPrintAmmount"___"b");
}

public 
plugin_cfg() set_cvar_num("sv_maxspeed"g_iMaxSpeed);

public 
eventCurWeapon(id){
    if(
g_fTempMaxSpeed[id] >= float(g_iProg)){
        
set_pev(idpev_maxspeedg_fTempMaxSpeed[id]);
        
client_cmd(id"cl_forwardspeed ^"%d^""floatround(g_fTempMaxSpeed[id]));
        
        
#if defined DEBUG
        
client_print(id3"%.1f"g_fTempMaxSpeed[id]);
        
#endif
    
}
    else{
        
set_pev(idpev_maxspeedg_fWeaponsSpeed[get_user_weapon(id)]);
        
        
#if defined DEBUG
        
client_print(id3"%.1f"g_fWeaponsSpeed[get_user_weapon(id)]);
        
#endif
    
}
}

public 
fwCmdStart(idiHandleiSeed){
    if(!
is_user_alive(id)) return FMRES_IGNORED;
    
    new 
Float:fmoveFloat:smove;
    
get_uc(iHandleUC_ForwardMovefmove);
    
get_uc(iHandleUC_SideMovesmove);
    
    new 
Float:maxspeed;
    
pev(idpev_maxspeedmaxspeed);
    new 
Float:walkspeed = (maxspeed 0.52); 
    
fmove floatabs(fmove);
    
smove floatabs(smove);
    
    if(
fmove <= walkspeed && smove <= walkspeed && !(fmove == 0.0 && smove == 0.0)){    
        if(
g_fSprintLeft[id] >= 0.5){
            if(
task_exists(id LEET)) remove_task(id LEET);
            
g_fTempMaxSpeed[id] = g_fTempMaxSpeed[id] < 400.0 400.0 g_fTempMaxSpeed[id];
            
g_fTempMaxSpeed[id] = g_fTempMaxSpeed[id] < float(g_iMaxSpeed) ? g_fTempMaxSpeed[id] + 10.0 g_fTempMaxSpeed[id];
            
set_pev(idpev_maxspeedg_fTempMaxSpeed[id]);
            
client_cmd(id"cl_forwardspeed ^"%d^""floatround(g_fTempMaxSpeed[id]));
            
engclient_cmd(id"weapon_knife");
            
            
g_fSprintLeft[id] -= 0.05;
            
            for(new 
0x10 i++){
                new 
bitButtons         get_uc(iHandleUC_Buttons);
                new 
bitOldbuttons     pev(idpev_oldbuttons);
                if(!(((
1<<3)|(1<<4)|(1<<12)) & (1<<i))){
                    if((
bitButtons & (1<<i))){
                        if((
1<<2) & (1<<i))
                            
set_pev(idpev_oldbuttonsbitOldbuttons | (1<<i));
                        
                        else
                            
set_uc(iHandleUC_ButtonsbitButtons & (~(1<<i)));
                        
                        return 
FMRES_SUPERCEDE;
                    }
                }
            }
        }
        else{
            
g_fTempMaxSpeed[id] = 0.0;
            
eventCurWeapon(id);
            
client_print(idprint_center"Tired!");
        }
        return 
FMRES_IGNORED;
    }
    else{
        if(!
task_exists(id LEET)) set_task(1.0"taskRecoverSprint"id LEET);
        
g_fTempMaxSpeed[id] = 0.0;
        
eventCurWeapon(id);
    }
    return 
FMRES_IGNORED;
}

public 
taskRecoverSprint(task_id){
    new 
id task_id LEET;
    
    
g_fSprintLeft[id]++;
    
    if(
floatround(g_fSprintLeft[id]) < g_iMaxCzas || floatround(g_fSprintLeft[id]) > g_iMaxCzas){
        if(
floatround(g_fSprintLeft[id]) < g_iMaxCzasset_task(1.0"taskRecoverSprint"id LEET);
        if(
floatround(g_fSprintLeft[id]) > g_iMaxCzasg_fSprintLeft[id] = float(g_iMaxCzas);
    }
}

public 
taskPrintAmmount(){
    static 
id//statyczna
    
for(id id <= g_iMaxPlayers id++){
        if(
is_user_alive(id)){
            new 
iSprint floatround(g_fSprintLeft[id]);
            new 
sSprint[g_iMaxCzas];
            
            while(
iSprint >= 1){
                
iSprint--;
                
add(sSprintsizeof sSprint 1"*");
            }
            
iSprint floatround(g_fSprintLeft[id]);
            
set_hudmessage(iSprint 0x64 0xFFiSprint 0x48 0x0iSprint 0xC 0x00.010.7700.0000010.4050.0000010.000001, -1);
            
show_hudmessage(id"SPRINT : [%s]"sSprint);    
        }
    }


or

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Sprint"
#define VERSION "0.2"
#define AUTHOR "nevermore"


new const Float:g_fWeaponsSpeed[ ]={
    
000.0,
    
250.0000.0260.0250.0240.0
    
250.0250.0240.0250.0250.0,                
    
250.0250.0210.0240.0240.0,    
    
250.0250.0210.0250.0220.0,              
    
230.0230.0250.0210.0250.0,            
    
250.0235.0221.0250.0245.0 
};

new 
Float:gfPitch[33];
new 
Float:gfYaw[33];

new 
Float:gfMoveOffset[33][2];
new 
giMoves[33];
new 
bool:gFast[33];
new 
gZmeczenie[33];

new 
pSpeed,pZmeczenie;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
pSpeed register_cvar("sprint_speed","60.0")
    
pZmeczenie register_cvar("sprint_tired","5");
    
    
register_forward(FM_PlayerPreThink"fwPreThink");
    
register_forward(FM_UpdateClientData"UpdateClientData_Post"1
    
    
RegisterHam(Ham_Spawn,"player","spawned",1)
    
    
register_event("CurWeapon","CurWeapon","be""1=1");
    
    
register_clcmd("+fast_run","startMove")
    
register_clcmd("-fast_run","stopMove")
}

public 
client_connect(id)
    
client_cmd(id,"bind shift +fast_run");

public 
startMove(id){
    if(!
gFast[id] && is_user_alive(id) && cs_get_user_zoom(id) == CS_SET_NO_ZOOM){
        
gfPitch[id] = gfYaw[id] = 0.0;
        
moveTo(id0.020.0);
        
gFast[id] = true;
        
engfunc(EngFunc_SetClientMaxspeedidg_fWeaponsSpeed[get_user_weapon(id)]+get_pcvar_float(pSpeed));
        
remove_task(id)
        
set_task(0.1,"addZmeczenie",id,_,_,"b")
    }
    return 
PLUGIN_HANDLED
}

public 
stopMove(id){
    if(
gFast[id] && is_user_alive(id)){
        
moveTo(id0.00.0);
        
gFast[id] = false;
        
engfunc(EngFunc_SetClientMaxspeedidg_fWeaponsSpeed[get_user_weapon(id)]);
        
remove_task(id)
        
set_task(0.2,"odejZmecznie",id,_,_,"b")
    }
    return 
PLUGIN_HANDLED
}

moveTo(idFloat:fPitchFloat:fYawmoves=30){
    
gfMoveOffset[id][0] = (fPitch gfPitch[id])/moves;
    
gfMoveOffset[id][1] = (fYaw gfYaw[id])/moves;
    
giMoves[id] = moves;
}

public 
fwPreThink(id){
    if(!
is_user_alive(id)) return;
    
    if(
gFast[id]){
        
set_pev(idpev_buttonpev(id,pev_button) & ~IN_ATTACK
        
set_pev(idpev_buttonpev(id,pev_button) & ~IN_ATTACK2
        if(
gZmeczenie[id] >= get_pcvar_num(pZmeczenie)*10){
            
stopMove(id);
        }
    }

    if(
giMoves[id] > 0){
        
giMoves[id]--;
        
gfPitch[id] += gfMoveOffset[id][0];
        
gfYaw[id] += gfMoveOffset[id][1];
        
engfunc(EngFunc_CrosshairAngleidgfPitch[id], gfYaw[id]);
    }
}


public 
spawned(id){
    if(
is_user_alive(id)){
        
gZmeczenie[id] = 0;
    }
}

public 
addZmeczenie(id){
    
gZmeczenie[id]++;
}

public 
odejZmecznie(id){
    if(
gZmeczenie[id] > 0){
        
gZmeczenie[id]--;
    }
}

public 
UpdateClientData_Post(idsendweaponscd_handle

    
    if(!
is_user_alive(id)){ 
        return 
FMRES_IGNORED
    
}
    
    if(
gFast[id]){
        
set_cd(cd_handleCD_ID0
        return 
FMRES_HANDLED 
    
}     
    
    return 
FMRES_IGNORED
}  

public 
CurWeapon(id)
{
    if(!
is_user_alive(id)){
        return 
PLUGIN_CONTINUE;
    }
    
    static 
iOldWeap[33];
    
    new 
weapon read_data(2);
    
    
    if(
gFast[id] && iOldWeap[id] != weapon){
        new 
szName[64];
        
get_weaponname(iOldWeap[id],szName,charsmax(szName));
        
engclient_cmd(id,szName);
        
engfunc(EngFunc_SetClientMaxspeedidg_fWeaponsSpeed[get_user_weapon(id)]+get_pcvar_float(pSpeed));
        return 
PLUGIN_CONTINUE;
    }
    
    
iOldWeap[id] = weapon;
    return 
PLUGIN_CONTINUE;


client_cmd(id,"bind shift +fast_run");

oxygen935 06-02-2013 03:43

Re: SPRINT a like
 
Don collione this is slowhacking which is forbidden except the fact that is no longer working(i mean the client_cmd(id, "bind ......."))

myusername 06-02-2013 07:15

Re: SPRINT a like
 
Code sounds ok. But isn't this a slowhack? client_cmd(id,"bind shift +fast_run")
Also i dont need the tired part :)
@Closer456 Ive seen that. But cant bind with shift key.


All times are GMT -4. The time now is 12:53.

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