This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Changing speed (in a .ini file)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KiimpaN
Member
Join Date: Jun 2005
Location: Sweden
Old 04-02-2007 , 13:05   Changing speed (in a .ini file)
Reply With Quote #1

Hello, I'm searching a plugin that changes the speed of a player. But like when i add admins in users.ini it should be a file like speed.ini were i can type in peoples steam:id's when i want them to be faster. Can anyone make a plugin like this? I would be very happy
KiimpaN is offline
Deviance
Veteran Member
Join Date: Nov 2004
Location: Sweden
Old 04-02-2007 , 13:26   Re: Changing speed (in a .ini file)
Reply With Quote #2

Make a file named speed.ini in configs, Then put the steamid and how fast they are in the file like:

"STEAM_0:0:123456" "460.0"

Code:
/*
--------------------------------------------------------------
----------------------  Made by Deviance ---------------------
--------------------- www.the-place.co.nr --------------------
--------------------------------------------------------------
*/

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define Plugin "Speed"
#define Version "1.0"
#define Author "Doombringer"

new Float:speed[32], bool:has_speed[32]
public plugin_init()
{
	register_plugin(Plugin, Version, Author)
	register_event("CurWeapon","set_speed","be")
}

public check_file(id, steamid[])
{	
	new configsdir[64], path[132]
	get_configsdir(configsdir, 63)
	
	format(path, 131, "%s/speed.ini", configsdir)
	new file = fopen(path, "rt")
	
	if(!file)
	{
		server_print("Could not find the donators.ini file!")
		return PLUGIN_HANDLED
	}
	
	new Rtext[166], file_steamid[38], file_speed[19]
	
	while(!feof(file))
	{
		fgets(file, Rtext, 165)
		
		if( (strlen(Rtext) < 2) || (contain(Rtext, "//") != -1) )
		continue;
		
		parse(Rtext, file_steamid, 37, file_speed, 18)
		
		if(equal(file_steamid, steamid))
		{
			has_speed[id] = true
			speed[id] = str_to_float(file_speed)
						
			break;
		}
	}
        
	fclose(file)	
	return PLUGIN_CONTINUE
}

public client_putinserver(id)
{
	new steamid[38]
	get_user_authid(id, steamid, 37)
	
	check_file(id, steamid)
	
	if(has_speed[id])
	{
		set_user_maxspeed(id, get_user_maxspeed(id) + speed[id])
	}
}

public set_speed(id)
{
	if(has_speed[id])
	{
		set_user_maxspeed(id, get_user_maxspeed(id) + speed[id])
	}
}
Deviance is offline
KiimpaN
Member
Join Date: Jun 2005
Location: Sweden
Old 04-02-2007 , 15:00   Re: Changing speed (in a .ini file)
Reply With Quote #3

Thank you!
KiimpaN 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:42.


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