#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Show regulamin"
#define VERSION "0.1"
#define AUTHOR "Frajer z wikipedii"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /regulamin","regulamin")
}
public regulamin(id)
{
show_motd(id,"/addons/amxmodx/data/regulamin.txt","Regulamin serwera")
}
hm zrób oddzielny
amxx do tego, ja zaraz to wczepie w tamten
@Edit
spróbuj tego
#include <amxmodx>
#include <amxmisc>
#define TASK_GENERAL 100
#define TASK_KICK 200
new const rules[] = "rules.txt";
public plugin_init()
{
register_plugin("Terms and Agreements","0.20","DahVid/Avalanche");
register_clcmd("say /rules","rules")
register_clcmd("say /zasady","rules")
register_clcmd("say /regulamin","rules")
register_menucmd(register_menuid("rules_menu"),1023,"RulesMenu");
set_task(1.0,"checkforfiles");
}
public checkforfiles()
{
if(!file_exists(rules)) write_file(rules,"Erase this line and add your rules here. HTML can be used.")
}
public client_putinserver(id)
{
remove_task(TASK_GENERAL+id);
remove_task(TASK_KICK+id);
if(is_user_bot(id)) return;
set_task(5.0,"DisplayRulesMenu",TASK_GENERAL+id);
}
public client_disconnect(id)
{
remove_task(TASK_GENERAL+id);
remove_task(TASK_KICK+id);
}
public DisplayRulesMenu(taskid)
{
new id = taskid-TASK_GENERAL;
static szMenuBody[256];
if(!szMenuBody[0])
{
new len = format(szMenuBody,255,"Regulamin Serwera:^n");
len += format(szMenuBody[len],255-len,"^n1. Akceptuje");
len += format(szMenuBody[len],255-len,"^n2. Odmawiam");
len += format(szMenuBody[len],255-len,"^n^n3. Pokaz Regulamin");
}
new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3;
show_menu(id,keys,szMenuBody,-1,"rules_menu");
}
public rules(id)
{
show_motd(id,"/cstrike/rules.txt","Regulamin serwera")
}
public RulesMenu(id,key)
{
switch(key)
{
case 1:
{
client_print(id,print_chat,"* Dziekujemy, GL & HF!");
}
case 2:
{
server_cmd("kick #%i ^"Nie zaakceptowales Regulaminu!^"",get_user_userid(id));
}
case 3:
{
client_print(id,print_chat,"* proszę uwaznie przeczytac regulamin!");
show_motd(id,rules,"SERVER RULES");
set_task(5.0,"DisplayRulesMenu",TASK_GENERAL+id);
}
}
}
@Edit3
ten działa na 100%!!!
#include <amxmodx>
#include <amxmisc>
#define TASK_GENERAL 100
#define TASK_KICK 200
new const rules[] = "rules.txt";
public plugin_init()
{
register_plugin("Terms and Agreements","0.20","DahVid/Avalanche");
register_clcmd("say /rules","rules_menu")
register_clcmd("say /zasady","rules_menu")
register_clcmd("say /regulamin","rules_menu")
register_menucmd(register_menuid("rules_menu"),1023,"RulesMenu");
set_task(1.0,"checkforfiles");
}
public checkforfiles()
{
if(!file_exists(rules)) write_file(rules,"Erase this line and add your rules here. HTML can be used.")
}
public client_putinserver(id)
{
remove_task(TASK_GENERAL+id);
remove_task(TASK_KICK+id);
if(is_user_bot(id)) return;
set_task(5.0,"DisplayRulesMenu",TASK_GENERAL+id);
}
public client_disconnect(id)
{
remove_task(TASK_GENERAL+id);
remove_task(TASK_KICK+id);
}
public DisplayRulesMenu(taskid)
{
new id = taskid-TASK_GENERAL;
static szMenuBody[256];
if(!szMenuBody[0])
{
new len = format(szMenuBody,255,"Regulamin Serwera:^n");
len += format(szMenuBody[len],255-len,"^n1. Akceptuje");
len += format(szMenuBody[len],255-len,"^n2. Odmawiam");
len += format(szMenuBody[len],255-len,"^n^n3. Pokaz Regulamin");
}
new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3;
show_menu(id,keys,szMenuBody,-1,"rules_menu");
}
public rules_menu(id)
{
show_motd(id,"/cstrike/rules.txt","Regulamin serwera")
}
public RulesMenu(id,key)
{
switch(key)
{
case 1:
{
client_print(id,print_chat,"* Dziekujemy, GL & HF!");
}
case 2:
{
server_cmd("kick #%i ^"Nie zaakceptowales Regulaminu!^"",get_user_userid(id));
}
case 3:
{
client_print(id,print_chat,"* proszę uwaznie przeczytac regulamin!");
show_motd(id,rules,"SERVER RULES");
set_task(5.0,"DisplayRulesMenu",TASK_GENERAL+id);
}
}
}
Użytkownik Frajer edytował ten post 14.04.2010 20:43