Raised This Month: $ Target: $400
 0% 

Precache configs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Blue Snake.
Member
Join Date: May 2011
Location: Romania
Old 09-29-2011 , 11:16   Precache configs
Reply With Quote #1

How can I precache configs to let players download it? With precache generic it says "Invalid file type...skipping download of file.cfg"...
Or other way to do this? (except client_cmd, it give 'server trying to send invalid command')

PHP Code:
#include <amxmodx>
#include <colorchat>

#define PLUGIN    "Settings"
#define AUTHOR    "Blue Snake."
#define VERSION    "1.0"

new bool:set[33]
new const 
file[16] = "file.cfg"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /execcfg","cmdset")
}

public 
plugin_precache()
{
    if(!
file_exists(file))
    {
        
/* Commands like:
        write_file(file, "bind f ...")
        write_file(file, "alias ... ...")
        */
    
}
    
    
precache_generic(file)
}


public 
cmdset(id)
{
    if(
set[id])
    {
        
ColorChat(idBLUE,"^x04[AMXX]^x01 You've already setted your commands.")
        return 
PLUGIN_HANDLED
    
}
    
    
ColorChat(idBLUE,"^x04[AMXX]^x01 Done.")
    
set[id]=true
    
    client_cmd
(id,"exec %s",file)
    return 
PLUGIN_HANDLED
}


public 
client_connect(id)
    
set[id]=false

public client_disconnect(id)
    
set[id]=false 

Last edited by Blue Snake.; 09-29-2011 at 11:19.
Blue Snake. is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-29-2011 , 12:34   Re: Precache configs
Reply With Quote #2

some file types cannot be precached, .cfg is one of them
jimaway is offline
Blue Snake.
Member
Join Date: May 2011
Location: Romania
Old 09-29-2011 , 13:33   Re: Precache configs
Reply With Quote #3

Yes, I've seen this ( .rc can't be precached too )...But does anybody know other wat to do this (or something like this)?
Blue Snake. is offline
MyPc
Senior Member
Join Date: Sep 2011
Old 09-29-2011 , 14:23   Re: Precache configs
Reply With Quote #4

http://forums.alliedmods.net/showthread.php?t=167847

I think you could force a client to download a file ( i think it is slow hacking )..
MyPc is offline
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 09-29-2011 , 15:17   Re: Precache configs
Reply With Quote #5

Wouldn't this work (without any precaching...) ?
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat>

new bool:set[33]
new 
file[224], filename[] = "filename.cfg"

public plugin_init() {
    
    
register_plugin("New Plugin""Unknown""1.0")
    
    
register_clcmd("say /execcfg","cmdset")
    
    
get_configsdirfile charsmaxfile ) )
    
addfilecharsmaxfile ), filename )
}
public 
client_putinserverid ) {    
    if( !
file_existsfile ) )
    {
        
write_filefile "blah blah..." )
        
write_filefile "blah blah..." )
    }
}
public 
cmdset(id)
{
    if(
set[id])
    {
        
ColorChat(idBLUE,"^x04[AMXX]^x01 You've already setted your commands.")
        return 
PLUGIN_HANDLED
    
}
    
    
ColorChat(idBLUE,"^x04[AMXX]^x01 Done.")
    
set[id]=true
    
    client_cmd
(id,"exec %s",file)
    return 
PLUGIN_HANDLED
}


public 
client_connect(id)
    
set[id]=false

public client_disconnect(id)
    
set[id]=false 
__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 09-29-2011 , 15:52   Re: Precache configs
Reply With Quote #6

write_file writes into server directory, how would you exec that from client?
jimaway is offline
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 09-29-2011 , 16:06   Re: Precache configs
Reply With Quote #7

Quote:
Originally Posted by jimaway View Post
write_file writes into server directory, how would you exec that from client?
Yes, you're totally right ... It's not possible the way I did it ... :facepalm:

(i feel stupid)
__________________
"If God exists, I hope he has a good excuse." - Woody Allen

Last edited by kotinha; 09-29-2011 at 16:19.
kotinha is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-29-2011 , 22:01   Re: Precache configs
Reply With Quote #8

Stop trying to hack people otherwise please leave this community.
__________________
fysiks is offline
Blue Snake.
Member
Join Date: May 2011
Location: Romania
Old 09-30-2011 , 13:01   Re: Precache configs
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
Stop trying to hack people otherwise please leave this community.

What 'hack' is this? My server have some commands and this binds will help players. Slowhacking is changing client's commands / files without their will, so I made a command. If he wants the binds, he can type /execcfg. If he don't want, he won't type. Isn't this legal?
Blue Snake. is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 09-30-2011 , 14:30   Re: Precache configs
Reply With Quote #10

Changing any settings on a client without his permission is slowhacking which is not allowed in this community.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Reply


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 19:36.


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