Witam mam serwer 18 slotowy i chce zeby byly w nim ok 4 zarezerwowanych slotow dla adminow niewidocznych tzn wyswietla sie 18 graczy a moze w sumie wejsc 22
Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
Rezerwacja slotów
Temat rozp.
` ManieK
, 23.09.2009 14:11
4 odpowiedzi w tym temacie
#1
Napisano 23.09.2009 14:11
#2
Napisano 23.09.2009 14:19
Masz serwer 18 slotów, to jakim cudem chcesz zrobić tak, żeby weszło 22?
#3
Napisano 23.09.2009 14:28
dedyk wiec moge. jest ustawione na tyle i tyle ma byc dostepnych dla graczy + rezerwacja dla adminow,
#4
Napisano 23.09.2009 16:01
#include <amxmodx>
#include <amxmisc>
// Comment if you don't want to hide true max_players
#define HIDE_RESERVEDSLOTS
public plugin_init()
{
register_plugin("Slots Reservation","0.9.7","f117bomb")
register_cvar("amx_reservation","1")
#if defined HIDE_RESERVEDSLOTS
set_cvar_num( "sv_visiblemaxplayers" , get_maxplayers() - 4 )
#endif
}
public client_authorized(id) {
new maxplayers = get_maxplayers()
new players = get_playersnum( 1 )
new limit = maxplayers - 1
new resType = get_cvar_num( "amx_reservation" )
new who
if ( players > limit ) //21/20
{
if ( get_user_flags(id) & ADMIN_RESERVATION )
{
switch(resType) {
case 1:
who = kickFresh()
case 2:
who = kickLag()
}
if(who) {
new name[32]
get_user_name( who, name , 31 )
client_cmd(id,"echo ^"* %s - Admin wbil <img src='https://amxx.pl/public/style_emoticons/<#EMO_DIR#>/smile.gif' class='bbc_emoticon' alt=':)' />, Zapraszamy ponownie.^"" ,name )
}
return PLUGIN_CONTINUE
}
if ( is_user_bot(id) )
server_cmd("kick #%d", get_user_userid(id) )
else
client_cmd(id,"echo ^"Serwer jest Pelny^";disconnect")
return PLUGIN_HANDLED // block connect in other plugins (especially in consgreet)
}
return PLUGIN_CONTINUE
}
kickLag() {
new who = 0, ping, loss, worst = -1
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, skip him
get_user_ping(i,ping,loss) // get ping
if ( ping > worst ) {
worst = ping
who = i
}
}
if(who)
if ( is_user_bot(who) )
server_cmd("kick #%d", get_user_userid(who) )
else
client_cmd(who,"echo ^"Rezarwacja slota dla Admina^";disconnect")
return who
}
kickFresh() {
new who = 0, itime, shortest = 0x7fffffff
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, skip him
itime = get_user_time(i) // get user playing time with connection duration
if ( shortest > itime ) {
shortest = itime
who = i
}
}
if(who)
if ( is_user_bot(who) )
server_cmd("kick #%d", get_user_userid(who) )
else
client_cmd(who,"echo ^"Rezarwacja slota dla Admina^";disconnect")
return who
}
#5
Napisano 23.09.2009 16:11
Ustaw na serwerze 22 sloty. Potem, jeśli chcesz, żeby wyświetlało się 18 slotów to wpisz w server.cfg
sv_visiblemaxplayers 18Aby pozostałe 4 sloty były zarezerwowane w amxx.cfg zmień wartość na
amx_reservation 4
Użytkownicy przeglądający ten temat: 0
0 użytkowników, 0 gości, 0 anonimowych


Dodatki SourceMod



Temat jest zamknięty










