AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Terms & Agreements (https://forums.alliedmods.net/showthread.php?t=101810)

crazyeffect 08-27-2009 11:42

Terms & Agreements
 
PHP Code:

#include <amxmodx>

#define PLUGIN "Rules Agreement"
#define VERSION "1.0"
#define AUTHOR "GameFreak"

#define MOTD "addons/amxmodx/configs/adminrules.txt"
#define MOTD2 "addons/amxmodx/configs/normalrules.txt" 

public plugin_init() {
   
register_plugin(PLUGINVERSIONAUTHOR);
   
   
register_dictionary("agreemenu.txt");
   
   
register_clcmd"rules_menu","client_putinserver");
}

public 
client_putinserver(id) {
   new 
szMenuName[32];
   
formatex(szMenuName31"\r%L:"id"MENU_HEADER");
   new 
menu menu_create(szMenuName"menu_handler");

   new 
Temp[32];
   
formatex(Temp31"%L"id"AGREE");
   
menu_additem(menuTemp"1"0);
   
formatex(Temp31"%L^n^n"id"DECLINE");
   
menu_additem(menuTemp"2"0);
   
formatex(Temp31"\y%L"id"RULES");
   
menu_additem(menuTemp"3"ADMIN_ADMIN);

   
menu_setprop(menuMPROP_EXITMEXIT_ALL);

   
menu_display(idmenu0);
}

public 
menu_handler(idmenuitem) {
   if( 
item == MENU_EXIT )
   {
       
menu_destroy(menu);

       return 
PLUGIN_HANDLED;
   }

   new 
data[6], iName[64];
   new 
accesscallback;

   
menu_item_getinfo(menuitemaccessdata,5iName63callback);

   new 
key str_to_num(data);

   switch(
key)
   {
       case 
1:
       {
           
client_print(idprint_chat"[Surf Mod] %L"id"THANKS");

           
menu_destroy(menu);
           return 
PLUGIN_HANDLED;
       }
       case 
2:
       {
      
server_cmd("kick #%i ^"You declined the rules!^"",get_user_userid(id));

      
menu_destroy(menu);
      return 
PLUGIN_HANDLED;
       }
       case 
3
       {
             new 
szMotdName[32];
             if(
get_user_flags(id) && ADMIN_MENU) {
      
formatex(szMotdName31"%L"id"MENU_HEADER");
             
show_motd(idMOTDszMotdName);
      }
      else {
      
formatex(szMotdName31"%L"id"MENU_HEADER");
      
show_motd(idMOTD2szMotdName);
      }
      
client_putinserver(id);
       }
   }

   
menu_destroy(menu);
   return 
PLUGIN_HANDLED;


Well, i want this to show when a player joins the server...

I tried client_connect, but it didn't work.

hleV 08-27-2009 11:47

Re: Terms & Agreements
 
Try setting a task for like 5 seconds after client_putinserver().

xPaw 08-27-2009 11:50

Re: Terms & Agreements
 
Hook Ham_Spawn, for "player", and put there, it will be best way


All times are GMT -4. The time now is 15:16.

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