Raised This Month: $ Target: $400
 0% 

[Req] Admin_Access


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VenomMix
Member
Join Date: Nov 2018
Old 08-29-2019 , 07:54   [Req] Admin_Access
Reply With Quote #1

Can you make these binds work only for admins with immunity?
eg. ADMIN_ACCESS ADMIN_IMMUNITY

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

new bool:is_sprinting[33] = false

public plugin_init() { 
	register_plugin("Speed","1.3","Unknown")
	register_clcmd("+sprint","start_speed") 
	register_clcmd("-sprint","end_speed") 
}

public start_speed(id){ 
	is_sprinting[id] = true
	return PLUGIN_HANDLED;
}
public end_speed(id){
	is_sprinting[id] = false
	return PLUGIN_HANDLED;
}

public server_frame(){
	for(new i=0; i < get_maxplayers(); i++) {
		if(is_sprinting[i] == true){
			set_speed(i);
		}
	}
}

public set_speed(id){
	if(!is_user_alive(id)) return PLUGIN_HANDLED;
	new Float:returnV[3], Float:Original[3]

	VelocityByAim ( id,600, returnV )
	pev(id,pev_velocity,Original)
	returnV[2] = Original[2]
	
	set_pev(id,pev_velocity,returnV)
	return PLUGIN_HANDLED;
}
VenomMix is offline
thEsp
BANNED
Join Date: Aug 2017
Old 08-29-2019 , 07:57   Re: [Req] Admin_Access
Reply With Quote #2

Code:
// Next time use proper () tags to put the code on. #include <amxmodx> #include <engine> #include <fakemeta> new bool:is_sprinting[33] = false public plugin_init() {     register_plugin("Speed","1.3","Unknown")     register_clcmd("+sprint","start_speed")     register_clcmd("-sprint","end_speed") } public start_speed(id) if(get_user_flags(id) & ADMIN_IMMUNITY){     is_sprinting[id] = true     return PLUGIN_HANDLED; } public end_speed(id){     is_sprinting[id] = false     return PLUGIN_HANDLED; } public server_frame(){     for(new i=0; i < get_maxplayers(); i++) {         if(is_sprinting[i] == true){             set_speed(i);         }     } } public set_speed(id){     if(!is_user_alive(id)) return PLUGIN_HANDLED;     new Float:returnV[3], Float:Original[3]     VelocityByAim ( id,600, returnV )     pev(id,pev_velocity,Original)     returnV[2] = Original[2]         set_pev(id,pev_velocity,returnV)     return PLUGIN_HANDLED; }
thEsp is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-29-2019 , 08:12   Re: [Req] Admin_Access
Reply With Quote #3

Quote:
Originally Posted by thEsp View Post
Code:
// Next time use proper () tags to put the code on. #include <amxmodx> #include <engine> #include <fakemeta> new bool:is_sprinting[33] = false public plugin_init() {     register_plugin("Speed","1.3","Unknown")     register_clcmd("+sprint","start_speed")     register_clcmd("-sprint","end_speed") } public start_speed(id) if(get_user_flags(id) & ADMIN_IMMUNITY){     is_sprinting[id] = true     return PLUGIN_HANDLED; } public end_speed(id){     is_sprinting[id] = false     return PLUGIN_HANDLED; } public server_frame(){     for(new i=0; i < get_maxplayers(); i++) {         if(is_sprinting[i] == true){             set_speed(i);         }     } } public set_speed(id){     if(!is_user_alive(id)) return PLUGIN_HANDLED;     new Float:returnV[3], Float:Original[3]     VelocityByAim ( id,600, returnV )     pev(id,pev_velocity,Original)     returnV[2] = Original[2]         set_pev(id,pev_velocity,returnV)     return PLUGIN_HANDLED; }
Use get_players() instead of looping from 1 to MaxPlayers, or at least cache get_maxplayers() into a global variable in plugin_init()
__________________
edon1337 is offline
thEsp
BANNED
Join Date: Aug 2017
Old 08-29-2019 , 09:15   Re: [Req] Admin_Access
Reply With Quote #4

Quote the op, please.
thEsp is offline
VenomMix
Member
Join Date: Nov 2018
Old 08-30-2019 , 04:09   Re: [Req] Admin_Access
Reply With Quote #5

Work!
VenomMix is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-30-2019 , 05:28   Re: [Req] Admin_Access
Reply With Quote #6

Quote:
Originally Posted by thEsp View Post
Quote the op, please.
to initial a start value for an array

You should do this
PHP Code:

new bool:is_sprinting[33] = {false, ...} 
INSTEAD OF
PHP Code:

new bool:is_sprinting[33] = false
I quoted you just to clarify you see this.

This is a common mistake alot of people fell into.


OP : also why are you using server_frame ?

You could use ham_deploy or any other forward that's called on weapon switch. It will be more efficient.

And also you should change maxspeed and not applying a velocity in the player direction that is aiming at, so if I'm aiming forward and moving right or left my sprinting will effect my movement.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 08-30-2019 at 05:36.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 19:50.


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