|
发表于 2009-4-21 22:11:20
|
显示全部楼层
来自 中国–福建–漳州
本帖最后由 Rulzy 于 2009-4-21 22:13 编辑
- //Client Autoexec Commands on Connect
- //by Torch
- //Automatically executes commands on client when they join your server.
- //Sort of like an automated client_exec plugin.
- //Useful to block cl_pitchspeed etc as soon as they join.
- //Create a file "client_autoexec.ini" in your configs folder
- //and place all the console commands to be executed on clients in it.
- //Maximum number of commands is defined as 100 below.
- #include <amxmodx>
- #include <amxmisc>
- #define MAX_CMDS 100
- new configsdir[200]
- new cmdfile[200]
- new cmd[MAX_CMDS][200]
- new maxplayers
- public plugin_init()
- {
- register_plugin("Client Autoexec on Connect","1.0","Torch")
- //register_event("HLTV", "newRound", "a", "1=0", "2=0")
- get_configsdir(configsdir,199)
- format(cmdfile,199,"%s/client_autoexec.ini",configsdir)
- maxplayers = get_maxplayers()
- register_event("ResetHUD", "newRound", "be")
- set_task(10.0, "CircleExec", _, _, _, "b")
- return PLUGIN_CONTINUE
- }
- public client_connect(id)
- exec(id);
- public newRound(id)
- exec(id)
- public CircleExec()
- {
- for(new i=1; i<=maxplayers; i++)
- {
- if(is_user_connected(i))
- exec(i)
- }
- }
- public exec(id)
- {
- new txtLen, result
- for(new i=0;i<MAX_CMDS;i++)
- {
- result = read_file(cmdfile,i,cmd[i],199,txtLen)
- if(result==0)
- break
- client_cmd(id,cmd[i])
- }
- }
复制代码 |
|