Raised This Month: $51 Target: $400
 12% 

vip speed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 02-12-2019 , 13:57   vip speed
Reply With Quote #1

Hi all . i want a plugin for vip speed . i want duble W = 3 sec speed for vips
who have this ?
Mikaeel123 is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 02-13-2019 , 14:59   Re: vip speed
Reply With Quote #2

Double speed for 3 seconds only? And when does it trigger/start?

Or do you want 3x speed at all times controlled by a cvar?
Moody92 is offline
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 02-14-2019 , 04:37   Re: vip speed
Reply With Quote #3

i want speed in use double W for 3 sec
Mikaeel123 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-14-2019 , 07:41   Re: vip speed
Reply With Quote #4

Translation: he wants to have speed for 3 seconds when he double-taps the W button.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 02-14-2019 , 08:01   Re: vip speed
Reply With Quote #5

Something like this already exists
Sprint - Run Faster
Moody92 is offline
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 02-14-2019 , 11:52   Re: vip speed
Reply With Quote #6

what flag ??
Mikaeel123 is offline
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 02-14-2019 , 12:28   Re: vip speed
Reply With Quote #7

this is for all players
i test code but no work
PHP Code:
 /* Plugin generated by AMXX-Studio */

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

#define ADMIN_IMMUNITY
#define PLUGIN "Sprint"
#define VERSION "1.2"
#define AUTHOR "akcaliberg"

#define TASKID 58964

#define MAX_PLAYERS 32

new bool:IsUserSprinting[MAX_PLAYERS+1];
new 
bool:UserCanSprint[MAX_PLAYERS+1];
new 
gMsgScreenFade;

new 
Float:LastSprintUsed[MAX_PLAYERS+1];
new 
Float:LastKeyPressed[MAX_PLAYERS+1];
new 
Float:LastSprintReleased[MAX_PLAYERS+1];
new 
Float:SprintTime[MAX_PLAYERS+1];
new 
Float:gCooldownFloat:gSprinttimeFloat:gSprintspeed,
Float:gKeyPressInterval,gShowUsage,gBreathinggBlockJumpgScreenFade[9];

new const 
EXHAUSTED_BREATH[] = "player/exhausted_breathing.wav";

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_cvar("sprint_cooldown","5");
    
register_cvar("sprint_timemax","2.5");
    
register_cvar("sprint_speed","400.0");
    
register_cvar("sprint_keylisten_interval","0.2");
    
register_cvar("sprint_blockjump","0");
    
register_cvar("sprint_breathsound","2");
    
register_cvar("sprint_screenfade_enabled","1");
    
register_cvar("sprint_screenfade_rgba","0 20 200 50");
    
register_cvar("sprint_screenfade_rgba2","255 0 0 50");
    
register_cvar("sprint_showusage","1");
    
    
register_event("HLTV","eNewRound","a","1=0","2=0");
    
register_event("TeamInfo""eTeamInfo""a");
    
    
register_forward(FM_PlayerPreThink"fwd_PlayerPreThink");
    
    
RegisterHam(Ham_Spawn,"player","fwd_PlayerSpawnPost",1);
    
    
gMsgScreenFade get_user_msgid("ScreenFade");
    
    
register_concmd("sprint_reloadcvars""CacheCvars"ADMIN_CVAR);
    
    if(
gShowUsageset_task(300.0,"ShowUsage",TASKID, .flags="b");
    
}
public 
plugin_precache() {
    
precache_sound(EXHAUSTED_BREATH)
}
public 
plugin_cfg() {
    
CacheCvars(0,0,0// function will ignore the level check if the id equals 0
}
public 
eNewRound() {
    
CacheCvars(0,0,0)
}
public 
eTeamInfo() {
    new 
id read_data(1);
    
    new 
szTeam[12];
    
read_data(2szTeamcharsmax(szTeam));
    
    
UserCanSprint[id] = (szTeam[0] == 'S' || szTeam[0] == 'U') ? false true;
}
public 
CacheCvars(idlevelcid) {
    
    if(
id != && !cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
    
    gCooldown 
get_cvar_float("sprint_cooldown");
    
gSprinttime get_cvar_float("sprint_timemax");
    
gSprintspeed get_cvar_float("sprint_speed");
    
gKeyPressInterval get_cvar_float("sprint_keylisten_interval");
    
gShowUsage get_cvar_num("sprint_showusage");
    
gBreathing get_cvar_num("sprint_breathsound");
    
gBlockJump get_cvar_num("sprint_blockjump");
    
gScreenFade[0] = get_cvar_num("sprint_screenfade_enabled");
    
    new 
szRGBA[16], szR[4], szG[4], szB[4], szA[4];
    
get_cvar_string("sprint_screenfade_rgba",szRGBA,15);
    
parse(szRGBAszR3szG3szB3szA3);
    
    
gScreenFade[1] = str_to_num(szR);
    
gScreenFade[2] = str_to_num(szG);
    
gScreenFade[3] = str_to_num(szB);
    
gScreenFade[4] = str_to_num(szA);
    
    
get_cvar_string("sprint_screenfade_rgba2",szRGBA,15);
    
parse(szRGBAszR3szG3szB3szA3);
    
    
gScreenFade[5] = str_to_num(szR);
    
gScreenFade[6] = str_to_num(szG);
    
gScreenFade[7] = str_to_num(szB);
    
gScreenFade[8] = str_to_num(szA);
    
    return 
PLUGIN_HANDLED
}
public 
client_putinserver(id) {
    if(
gShowUsageset_task(10.0,"ShowUsage",id+TASKID)
}
public 
fwd_PlayerSpawnPost(id) {
    
SprintTime[id] = 0.0;
}
public 
fwd_PlayerPreThink(id) {
    if(!
UserCanSprint[id]) return;
    
    static 
button,oldbuttons,flagsFloat:speed;
    
    
button pev(idpev_button);
    
oldbuttons pev(idpev_oldbuttons); 
    
pev(idpev_maxspeedspeed);
    
flags pev(idpev_flags);
    
    
    if(!(
flags FL_DUCKING) && speed != 1.0) {
        
        
// Pressed
        
if(button IN_FORWARD && !(oldbuttons IN_FORWARD)) {
            if( (
get_gametime() - LastKeyPressed[id]) < gKeyPressInterval ) {
                if( (
get_gametime() - LastSprintReleased[id]) >= gCooldown)  {
                    
LastSprintUsed[id] = get_gametime();
                    
IsUserSprinting[id] = true;
                    
SprintTime[id] = 0.0
                    
if(gScreenFade[0]) SetScreenFadeEffect(id1)
                }
                else if( 
SprintTime[id] > 0.0 && SprintTime[id] < gSprinttime ) {
                    
LastSprintUsed[id] = get_gametime();
                    
IsUserSprinting[id] = true;
                    if(
gScreenFade[0]) SetScreenFadeEffect(id1)
                }
                
            }
            
LastKeyPressed[id] = get_gametime();
        }
        
// Holding
        
else if( oldbuttons IN_FORWARD && button IN_FORWARD ) {
            if(
IsUserSprinting[id]) {
                if(
speed != gSprintspeedset_pev(idpev_maxspeedgSprintspeed );
                if( ( 
SprintTime[id] + get_gametime() - LastSprintUsed[id] ) > gSprinttime) {
                    
IsUserSprinting[id] = false;
                    
ExecuteHamB(Ham_Item_PreFrameid);
                    
LastSprintReleased[id] = get_gametime();
                    
SprintTime[id] = 0.0;
                    if(
gScreenFade[0]) SetScreenFadeEffect(id2)
                    
                    
// Exhausted breath sound
                    
switch(gBreathing) {
                        case 
1client_cmd(id"spk %s",EXHAUSTED_BREATH);
                        case 
2emit_sound(idCHAN_AUTOEXHAUSTED_BREATHVOL_NORMATTN_NORM0PITCH_NORM); 
                    }
                    
                }
            }
        }
        
// Released
        
else if( oldbuttons IN_FORWARD && !(button IN_FORWARD)) {
            if(
IsUserSprinting[id]) {
                
LastSprintReleased[id] = get_gametime();
                
IsUserSprinting[id] = false;
                
SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
                
ExecuteHamB(Ham_Item_PreFrameid);
                if(
gScreenFade[0]) SetScreenFadeEffect(id0)
            }
        }
        
// Ducking
        
if(IsUserSprinting[id] && button IN_DUCK) {
            
LastSprintReleased[id] = get_gametime();
            
IsUserSprinting[id] = false;
            
SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
            
ExecuteHamB(Ham_Item_PreFrameid);
            if(
gScreenFade[0]) SetScreenFadeEffect(id0)
        }
        
// Jumping
        
if(gBlockJump && IsUserSprinting[id] && button IN_JUMP) {
            
LastSprintReleased[id] = get_gametime();
            
IsUserSprinting[id] = false;
            
SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
            
ExecuteHamB(Ham_Item_PreFrameid);
            if(
gScreenFade[0]) SetScreenFadeEffect(id0)
        }
    }
}
public 
SetScreenFadeEffect(idflag) {
    
    switch(
flag) {
        case 
0: {
            
message_begin(MSG_ONE_UNRELIABLEgMsgScreenFade_id)
            
write_short(0)
            
write_short(0)
            
write_short(0)
            
write_byte(0)
            
write_byte(0)
            
write_byte(0)
            
write_byte(0)
            
message_end()
        }
        case 
1: {
            
message_begin(MSG_ONE_UNRELIABLEgMsgScreenFade_id)
            
write_short(0// duration (will be ignored because of the flag)
            
write_short(0// holdtime
            
write_short(0x0004// FFADE_STAYOUT
            
write_byte(gScreenFade[1]) // r
            
write_byte(gScreenFade[2]) // g
            
write_byte(gScreenFade[3]) // b
            
write_byte(gScreenFade[4]) // alpha
            
message_end()
        }
        case 
2: {
            
message_begin(MSG_ONE_UNRELIABLEgMsgScreenFade_id)
            
write_short(4096// duration
            
write_short(2048// holdtime
            
write_short(0x0000// FFADE_IN
            
write_byte(gScreenFade[5]) // r
            
write_byte(gScreenFade[6]) // g
            
write_byte(gScreenFade[7]) // b
            
write_byte(gScreenFade[8]) // alpha
            
message_end()
        }
    }
}
public 
ShowUsage(id) {
    
id -= TASKID
    client_print
(id,print_chat,"[SPRINT] You can sprint in this server by double-tapping forward (W) key. ");


Last edited by Mikaeel123; 02-14-2019 at 12:28.
Mikaeel123 is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 02-14-2019 , 15:32   Re: vip speed
Reply With Quote #8

Quote:
Originally Posted by Mikaeel123 View Post
this is for all players
i test code but no work
I have no idea what you modified in the plugin, but here.
Attached Files
File Type: sma Get Plugin or Get Source (Sprint.sma - 470 views - 7.3 KB)
Moody92 is offline
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 02-15-2019 , 02:37   Re: vip speed
Reply With Quote #9

Its for flag b ??
Mikaeel123 is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 02-15-2019 , 02:54   Re: vip speed
Reply With Quote #10

No, he used the immunity flag. But calling get_user_flags in a prethink forward isn't a good practice. Use this, edit "#define SPRINT_FLAG ADMIN_RESERVATION" to change the flag. ADMIN_RESERVATION is flag b.

PHP Code:
/* Plugin generated by AMXX-Studio */

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

#define SPRINT_FLAG ADMIN_RESERVATION

#define PLUGIN "Sprint"
#define VERSION "1.2"
#define AUTHOR "akcaliberg"

#define TASKID 58964

#define MAX_PLAYERS 32

new bool:IsUserSprinting[MAX_PLAYERS+1];
new 
bool:UserCanSprint[MAX_PLAYERS+1];
new 
gMsgScreenFade;

new 
Float:LastSprintUsed[MAX_PLAYERS+1];
new 
Float:LastKeyPressed[MAX_PLAYERS+1];
new 
Float:LastSprintReleased[MAX_PLAYERS+1];
new 
Float:SprintTime[MAX_PLAYERS+1];
new 
Float:gCooldownFloat:gSprinttimeFloat:gSprintspeed,
Float:gKeyPressInterval,gShowUsage,gBreathinggBlockJumpgScreenFade[9];

new const 
EXHAUSTED_BREATH[] = "player/exhausted_breathing.wav";

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_cvar("sprint_cooldown","5");
    
register_cvar("sprint_timemax","2.5");
    
register_cvar("sprint_speed","400.0");
    
register_cvar("sprint_keylisten_interval","0.2");
    
register_cvar("sprint_blockjump","0");
    
register_cvar("sprint_breathsound","2");
    
register_cvar("sprint_screenfade_enabled","1");
    
register_cvar("sprint_screenfade_rgba","0 20 200 50");
    
register_cvar("sprint_screenfade_rgba2","255 0 0 50");
    
register_cvar("sprint_showusage","1");
    
    
register_event("HLTV","eNewRound","a","1=0","2=0");
    
register_event("TeamInfo""eTeamInfo""a");
    
    
register_forward(FM_PlayerPreThink"fwd_PlayerPreThink");
    
    
RegisterHam(Ham_Spawn,"player","fwd_PlayerSpawnPost",1);
    
    
gMsgScreenFade get_user_msgid("ScreenFade");
    
    
register_concmd("sprint_reloadcvars""CacheCvars"ADMIN_CVAR);
    
    if(
gShowUsageset_task(300.0,"ShowUsage",TASKID, .flags="b");
    
}
public 
plugin_precache() {
    
precache_sound(EXHAUSTED_BREATH)
}
public 
plugin_cfg() {
    
CacheCvars(0,0,0// function will ignore the level check if the id equals 0
}
public 
eNewRound() {
    
CacheCvars(0,0,0)
}
public 
eTeamInfo() {
    new 
id read_data(1);
    
    new 
szTeam[12];
    
read_data(2szTeamcharsmax(szTeam));
    
    
UserCanSprint[id] = (get_user_flags(id) & SPRINT_FLAG && (szTeam[0] == 'C' || szTeam[0] == 'T')) ? true false;
}
public 
CacheCvars(idlevelcid) {
    
    if(
id != && !cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
    
    gCooldown 
get_cvar_float("sprint_cooldown");
    
gSprinttime get_cvar_float("sprint_timemax");
    
gSprintspeed get_cvar_float("sprint_speed");
    
gKeyPressInterval get_cvar_float("sprint_keylisten_interval");
    
gShowUsage get_cvar_num("sprint_showusage");
    
gBreathing get_cvar_num("sprint_breathsound");
    
gBlockJump get_cvar_num("sprint_blockjump");
    
gScreenFade[0] = get_cvar_num("sprint_screenfade_enabled");
    
    new 
szRGBA[16], szR[4], szG[4], szB[4], szA[4];
    
get_cvar_string("sprint_screenfade_rgba",szRGBA,15);
    
parse(szRGBAszR3szG3szB3szA3);
    
    
gScreenFade[1] = str_to_num(szR);
    
gScreenFade[2] = str_to_num(szG);
    
gScreenFade[3] = str_to_num(szB);
    
gScreenFade[4] = str_to_num(szA);
    
    
get_cvar_string("sprint_screenfade_rgba2",szRGBA,15);
    
parse(szRGBAszR3szG3szB3szA3);
    
    
gScreenFade[5] = str_to_num(szR);
    
gScreenFade[6] = str_to_num(szG);
    
gScreenFade[7] = str_to_num(szB);
    
gScreenFade[8] = str_to_num(szA);
    
    return 
PLUGIN_HANDLED
}
public 
client_putinserver(id) {
    if(
gShowUsageset_task(10.0,"ShowUsage",id+TASKID)
}
public 
fwd_PlayerSpawnPost(id) {
    
SprintTime[id] = 0.0;
}
public 
fwd_PlayerPreThink(id) {
    if(!
UserCanSprint[id]) return;
    
    static 
button,oldbuttons,flagsFloat:speed;
    
    
button pev(idpev_button);
    
oldbuttons pev(idpev_oldbuttons); 
    
pev(idpev_maxspeedspeed);
    
flags pev(idpev_flags);
    
    
    if(!(
flags FL_DUCKING) && speed != 1.0) {
        
        
// Pressed
        
if(button IN_FORWARD && !(oldbuttons IN_FORWARD)) {
            if( (
get_gametime() - LastKeyPressed[id]) < gKeyPressInterval ) {
                if( (
get_gametime() - LastSprintReleased[id]) >= gCooldown)  {
                    
LastSprintUsed[id] = get_gametime();
                    
IsUserSprinting[id] = true;
                    
SprintTime[id] = 0.0
                    
if(gScreenFade[0]) SetScreenFadeEffect(id1)
                }
                else if( 
SprintTime[id] > 0.0 && SprintTime[id] < gSprinttime ) {
                    
LastSprintUsed[id] = get_gametime();
                    
IsUserSprinting[id] = true;
                    if(
gScreenFade[0]) SetScreenFadeEffect(id1)
                }
                
            }
            
LastKeyPressed[id] = get_gametime();
        }
        
// Holding
        
else if( oldbuttons IN_FORWARD && button IN_FORWARD ) {
            if(
IsUserSprinting[id]) {
                if(
speed != gSprintspeedset_pev(idpev_maxspeedgSprintspeed );
                if( ( 
SprintTime[id] + get_gametime() - LastSprintUsed[id] ) > gSprinttime) {
                    
IsUserSprinting[id] = false;
                    
ExecuteHamB(Ham_Item_PreFrameid);
                    
LastSprintReleased[id] = get_gametime();
                    
SprintTime[id] = 0.0;
                    if(
gScreenFade[0]) SetScreenFadeEffect(id2)
                    
                    
// Exhausted breath sound
                    
switch(gBreathing) {
                        case 
1client_cmd(id"spk %s",EXHAUSTED_BREATH);
                        case 
2emit_sound(idCHAN_AUTOEXHAUSTED_BREATHVOL_NORMATTN_NORM0PITCH_NORM); 
                    }
                    
                }
            }
        }
        
// Released
        
else if( oldbuttons IN_FORWARD && !(button IN_FORWARD)) {
            if(
IsUserSprinting[id]) {
                
LastSprintReleased[id] = get_gametime();
                
IsUserSprinting[id] = false;
                
SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
                
ExecuteHamB(Ham_Item_PreFrameid);
                if(
gScreenFade[0]) SetScreenFadeEffect(id0)
            }
        }
        
// Ducking
        
if(IsUserSprinting[id] && button IN_DUCK) {
            
LastSprintReleased[id] = get_gametime();
            
IsUserSprinting[id] = false;
            
SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
            
ExecuteHamB(Ham_Item_PreFrameid);
            if(
gScreenFade[0]) SetScreenFadeEffect(id0)
        }
        
// Jumping
        
if(gBlockJump && IsUserSprinting[id] && button IN_JUMP) {
            
LastSprintReleased[id] = get_gametime();
            
IsUserSprinting[id] = false;
            
SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
            
ExecuteHamB(Ham_Item_PreFrameid);
            if(
gScreenFade[0]) SetScreenFadeEffect(id0)
        }
    }
}
public 
SetScreenFadeEffect(idflag) {
    
    switch(
flag) {
        case 
0: {
            
message_begin(MSG_ONE_UNRELIABLEgMsgScreenFade_id)
            
write_short(0)
            
write_short(0)
            
write_short(0)
            
write_byte(0)
            
write_byte(0)
            
write_byte(0)
            
write_byte(0)
            
message_end()
        }
        case 
1: {
            
message_begin(MSG_ONE_UNRELIABLEgMsgScreenFade_id)
            
write_short(0// duration (will be ignored because of the flag)
            
write_short(0// holdtime
            
write_short(0x0004// FFADE_STAYOUT
            
write_byte(gScreenFade[1]) // r
            
write_byte(gScreenFade[2]) // g
            
write_byte(gScreenFade[3]) // b
            
write_byte(gScreenFade[4]) // alpha
            
message_end()
        }
        case 
2: {
            
message_begin(MSG_ONE_UNRELIABLEgMsgScreenFade_id)
            
write_short(4096// duration
            
write_short(2048// holdtime
            
write_short(0x0000// FFADE_IN
            
write_byte(gScreenFade[5]) // r
            
write_byte(gScreenFade[6]) // g
            
write_byte(gScreenFade[7]) // b
            
write_byte(gScreenFade[8]) // alpha
            
message_end()
        }
    }
}
public 
ShowUsage()
{
    
client_print(0print_chat"[SPRINT] You can sprint in this server by double-tapping forward (W) key.");

PartialCloning 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 18:41.


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