Raised This Month: $ Target: $400
 0% 

Help: Allowing downloads based on map size.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
JonnyH
Junior Member
Join Date: Apr 2004
Old 07-05-2004 , 13:15   Help: Allowing downloads based on map size.
Reply With Quote #1

Hi, Im trying to write a plugin for a friend, he wants ppl to be able to download any map less than 4mb is size from the server, otherwise he wants them to get a messages telling them where the map pack is.

So far, I have come up with the following, im not worrying about the message yet. This code is in plugin_init().

Code:
new mapname[64], mappath[128]
get_mapname(mapname,63)
format(mappath,127,"/maps/%s.bsp",mapname)
if (file_size(mappath, 0)>=4000)
	{
		server_cmd("sv_allowdownload 0")
	} else {
		server_cmd("sv_allowdownload 1")
	}
For some reason it doesnt work, I have tried loads of variations for the path of the map, with no luck, I am sure that it is not seeing the map, as if I do a "file_exists" I get 0.

Any idea how AMXX file_size would let me refer to a file in the maps directory, or where it starts its relative paths from (the AMXX dir, root or cs root)?

Thanks for any help,

Jonny
JonnyH is offline
 


Thread Tools
Display Modes

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 14:39.


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