AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Precache configs (https://forums.alliedmods.net/showthread.php?t=168455)

Blue Snake. 09-29-2011 11:16

Precache configs
 
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 


jimaway 09-29-2011 12:34

Re: Precache configs
 
some file types cannot be precached, .cfg is one of them

Blue Snake. 09-29-2011 13:33

Re: Precache configs
 
Yes, I've seen this ( .rc can't be precached too )...But does anybody know other wat to do this (or something like this)?

MyPc 09-29-2011 14:23

Re: Precache configs
 
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 )..

kotinha 09-29-2011 15:17

Re: Precache configs
 
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 


jimaway 09-29-2011 15:52

Re: Precache configs
 
write_file writes into server directory, how would you exec that from client?

kotinha 09-29-2011 16:06

Re: Precache configs
 
Quote:

Originally Posted by jimaway (Post 1565517)
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)

fysiks 09-29-2011 22:01

Re: Precache configs
 
Stop trying to hack people otherwise please leave this community.

Blue Snake. 09-30-2011 13:01

Re: Precache configs
 
Quote:

Originally Posted by fysiks (Post 1565650)
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?

drekes 09-30-2011 14:30

Re: Precache configs
 
Changing any settings on a client without his permission is slowhacking which is not allowed in this community.


All times are GMT -4. The time now is 19:36.

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