Raised This Month: $ Target: $400
 0% 

A more advanced slot plugin...


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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