Raised This Month: $ Target: $400
 0% 

A more advanced slot plugin...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kaksi
Junior Member
Join Date: Apr 2004
Old 05-27-2004 , 13:16   A more advanced slot plugin...
Reply With Quote #1

I currently have this slot plugin:

Code:
/* AMX Mod Script 
* Script Name: Simple Slots (Simple Slot Reservation System) 
* Coded By: DynAstY 
* This file is provided as is (no warranties). 
* 
* simpleslots.sma - simpleslots.amx 
* 
* Basically, you set your server variable max players to whatever + 1 
* We will use an 18 player max server as an example here. Example: If 
* you run an 18 player server you have to set the max players to 19. 
* This plugin allows everyone to connect up until you hit 18 players total 
* If someone connects on the 19th slot who is not assigned a reserved slot 
* they cannot join game. If someone connects who does have a reserved slot 
* it will kick the shortest time player without a reservation. If the server 
* is filled with 18 reserved users only a reserved user can fill the 19th slot. 
* There are no assignable variables needed by this plugin. Remove any 
* cfg settings relating to reservations including amx_reserved_slots. Very 
* fast method since it only has to run if the server is at capacity in this 
* example 18.The 19th slot is considered a checking slot. This plugin 
* works completely with the AMX users.ini file settings. Anti-Flood makes sure 
* players can't hammer the server for 1 minute after being kicked. 
* 
* To install drop AMX file in to plugins directory and add line to plugins.ini. 
* !!MAKE SURE TO ADD PLUGIN BELOW ADMIN.AMX!! 
* 
* FULLY HLSW COMPATIBLE 
* 
*/ 

#include <amxmod> 

// Comment if you don't want to TEMP ban (Disable Anti-Hammer Logic) 
#define TEMP_BAN 

public plugin_init() { 
   register_plugin("Simple Slots", "1.6.1", "DynAstY") 
} 

OpenSlot() { 
   new who = 0, mytime, shortest = 999999999 
   new maxplayers = get_maxplayers() 
   for(new i = 1; i <= maxplayers; ++i){ 
      if (!is_user_connected(i) && !is_user_connecting(i)) continue // not used slot    
      if (get_user_flags(i) & ADMIN_RESERVATION) continue // has reservation (don't touch)
      if (get_user_flags(i) & ADMIN_IMMUNITY) continue // has immunity (don't touch)
      mytime = get_user_time(i) // get user playing time with connection duration    
      if (shortest > mytime)   { 
         shortest = mytime 
         who = i 
      } 
   } 
   return who 
} 

public client_authorized(id) { 
   client_cmd(id, "echo * Simple Slots Activated") 
   if ((get_playersnum(1)) == get_maxplayers()) { 
      if (get_user_flags(id) & ADMIN_RESERVATION) { 
         new KickedID = OpenSlot() 
         if (KickedID != 0) { 
            new name[32] 
            get_user_name(KickedID, name, 31) 
#if defined TEMP_BAN 
            new KickedPlayer = get_user_userid(KickedID) 
            server_cmd("banid 1 #%d", KickedPlayer) 
#endif 
            client_cmd(KickedID, "echo ^"SLOT RESERVATION - SERVER NOW FULL^"; disconnect") 
            client_cmd(id, "echo * Welcome, %s was disconnected to free this slot!", name) 
         } 
      } 
      else { 
#if defined TEMP_BAN 
         new KickedPlayer = get_user_userid(id) 
         server_cmd("banid 1 #%d", KickedPlayer) 
#endif 
         client_cmd(id, "echo ^"SLOT RESERVATION - SERVER FULL^"; disconnect") 
         return PLUGIN_HANDLED 
      } 
   } 
   return PLUGIN_CONTINUE 
}
But I want to modify it a bit. I want to have three level of users: admin, poweruser (from userdatabase) and normal user.

If the server is full I want the plugin to kick normal users before it kicks powerusers.

So of the server is full and a poweruser wants to join a normal user will be kicked. If there are no more normal users the connecting poweruser will be disconnected.

If an admin joins the plugin should start to look for normal users and kick one if it find one. If there are no normal users it will kick a poweruser...

The admin userright is set by the admin plugin... How do I set the poweruser rights? And what should they be set to?

Anyone that could help me with this plugin?
kaksi is offline
av
Junior Member
Join Date: Dec 2005
Old 01-01-2006 , 10:20  
Reply With Quote #2

*** bump ***

I also need this functionality.

right now the simpleslots.sma distinguish only 2 types of players:

- normal player without any rights
- normal player with a reservation or admin with immunity

poweruser would be just a normal player with a reservation.

we need this plugin to recognize 3 types of players:

- normal player without any rights
- normal player with a reservation
- admin with immunity

please help.

thanks in advance!!
av is offline
av
Junior Member
Join Date: Dec 2005
Old 01-01-2006 , 17:05  
Reply With Quote #3

my friend helped me fix this, please review:

Code:
/* AMX Mod Script * Script Name: Simple Slots (Simple Slot Reservation System) * Coded By: DynAstY * This file is provided as is (no warranties). * * simpleslots.sma - simpleslots.amx * * Basically, you set your server variable max players to whatever + 1 * We will use an 18 player max server as an example here. Example: If * you run an 18 player server you have to set the max players to 19. * This plugin allows everyone to connect up until you hit 18 players total * If someone connects on the 19th slot who is not assigned a reserved slot * they cannot join game. If someone connects who does have a reserved slot * it will kick the shortest time player without a reservation. If the server * is filled with 18 reserved users only a reserved user can fill the 19th slot. * There are no assignable variables needed by this plugin. Remove any * cfg settings relating to reservations including amx_reserved_slots. Very * fast method since it only has to run if the server is at capacity in this * example 18.The 19th slot is considered a checking slot. This plugin * works completely with the AMX users.ini file settings. Anti-Flood makes sure * players can't hammer the server for 1 minute after being kicked. * * To install drop AMX file in to plugins directory and add line to plugins.ini. * !!MAKE SURE TO ADD PLUGIN BELOW ADMIN.AMX!! * * FULLY HLSW COMPATIBLE * * modded by kruku & av * distinguish admins with immunity from players with reservation: * if the server is full of admins and players with slot reservation * then make space for yet another admin * */ #include <amxmod> // Comment if you don't want to TEMP ban (Disable Anti-Hammer Logic) #define TEMP_BAN public plugin_init() {    register_plugin("Simple Slots", "1.6.1", "DynAstY") } OpenSlot() {    new who = 0, mytime, shortest = 999999999    new maxplayers = get_maxplayers()    for(new i = 1; i <= maxplayers; ++i){       if (!is_user_connected(i) && !is_user_connecting(i)) continue // not used slot         if (get_user_flags(i) & ADMIN_RESERVATION) continue // has reservation (don't touch)       if (get_user_flags(i) & ADMIN_IMMUNITY) continue // has immunity (don't touch)       mytime = get_user_time(i) // get user playing time with connection duration         if (shortest > mytime)   {          shortest = mytime          who = i       }    }    if ( who == 0 )    {     for(new i = 1; i <= maxplayers; ++i){       if (!is_user_connected(i) && !is_user_connecting(i)) continue // not used slot         if (get_user_flags(i) & ADMIN_IMMUNITY) continue // has immunity (don't touch)       mytime = get_user_time(i) // get user playing time with connection duration         if (shortest > mytime)   {          shortest = mytime          who = i       }     }    }    return who } public client_authorized(id) {    client_cmd(id, "echo * Simple Slots Activated")    if ((get_playersnum(1)) == get_maxplayers()) {       if (get_user_flags(id) & ADMIN_RESERVATION) {          new KickedID = OpenSlot()          if (KickedID != 0) {             new name[32]             get_user_name(KickedID, name, 31) #if defined TEMP_BAN             new KickedPlayer = get_user_userid(KickedID)             server_cmd("banid 1 #%d", KickedPlayer) #endif             client_cmd(KickedID, "echo ^"SLOT RESERVATION - SERVER NOW FULL^"; disconnect")             client_cmd(id, "echo * Welcome, %s was disconnected to free this slot!", name)          }       }       else { #if defined TEMP_BAN          new KickedPlayer = get_user_userid(id)          server_cmd("banid 1 #%d", KickedPlayer) #endif          client_cmd(id, "echo ^"SLOT RESERVATION - SERVER FULL^"; disconnect")          return PLUGIN_HANDLED       }    }    return PLUGIN_CONTINUE }
av is offline
av
Junior Member
Join Date: Dec 2005
Old 01-03-2006 , 06:04  
Reply With Quote #4

anybody?
please!
av is offline
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 07:03.


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