Slot question
#1

I is it possilbe to save 1 slot for me becouse sometimes server is full and i (admin) can't get in
Reply
#2

well first off, what host do you use.

and you can always set a timer that checks for a particular name or admin level and make a random name getting enum and simply replay it untill a player or two get kicked.
Reply
#3

Quote:
Originally Posted by SloStunter
Посмотреть сообщение
I is it possilbe to save 1 slot for me becouse sometimes server is full and i (admin) can't get in
Just buy some more slots, better than messing around with the script

_
Spammers above, retarded much? You are probably mad that his server is full and you ain't get 2 players with your stupid script
Reply
#4

If random kicks don't work on connecting (I don't know PAWN, so I don't know when the connection is triggered) then you could always keep one player slot all of the time open and each time someone joins with that particular ID, kick him.

Imo that's not very playerfriendly, but it's your server.
Reply
#5

Or...you can make it where only the server limits like 49/50..and if your a certain admin level you can bypass that..it's possible!
Reply
#6

pawn Код:
if( ( g_ConnectedPlayers++ ) >= MAX_PLAYERS )
{
    if( p_AdminLevel[ playerid ] < 1 )
    {
        //message
        return Kick( playerid ), 1;
    }
}
Under your register box I assume it'll go

You can remove the "++" within the if statement if doing so since it can bug.
Reply
#7

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
pawn Код:
if( ( g_ConnectedPlayers++ ) >= MAX_PLAYERS )
{
    if( p_AdminLevel[ playerid ] < 1 )
    {
        //message
        return Kick( playerid ), 1;
    }
}
Under your register box I assume it'll go

You can remove the "++" within the if statement if doing so since it can bug.
You may also do:

pawn Код:
public OnPlayerConnect(playerid)
{
    if(!IsPlayerAdmin(playerid)) if(playerid == MAX_PLAYERS-1) Kick(playerid);
    return 1;
}
Reply
#8

pawn Код:
#include <a_samp>

main()
{
    print("\n----------------------------------");
    print("  Bare Script\n");
    print("----------------------------------\n");
}
#define RESERVED_SLOTS 1 //Amount of reserved slots
#define DIALOG_ID 10 //Dialog ID to use for ReservedDialog
#define RESERVED_PASSWORD "yarhar" //Reserver Slots Password, case sensitive
#undef MAX_PLAYERS
#define MAX_PLAYERS 500 //Set this to the amount of slots your server has
new SlotsRemaining;
new ReservedList[RESERVED_SLOTS][MAX_PLAYER_NAME]=
{
    //"Other_Names",
    "Joe_Staff"
};
forward ReservedDialog(playerid,timeremaining,NameMatch);
public ReservedDialog(playerid,timeremaining,NameMatch)
{

    //Compare Name to Reserved List
    new tmp[256];

    if(NameMatch==0)
    {
        GetPlayerName(playerid,tmp,24);
        for(new name;name<RESERVED_SLOTS;name++)if(!strcmp(tmp,ReservedList[name]))NameMatch=1;
    }

    //If timeremaining = 0 then kick
    if(timeremaining<=0)return Kick(playerid);

    //if player's id doesn't reach the reserved slots range, let continue
    if(playerid<=MAX_PLAYERS-SlotsRemaining)
    {
        if(NameMatch)SlotsRemaining--;
        return 0;
    }else{
        if(NameMatch)
        {
            format(tmp,256,"Please type in the server's reserved slot password.\nYou have %02d seconds remaining...");
            ShowPlayerDialog(playerid,DIALOG_ID,DIALOG_STYLE_MSGBOX,"Reserved Slot Password",tmp,"Submit","Cancel");
            SetTimerEx("ReservedDialog",1000,0,"dd",playerid,timeremaining-1,1);
        }else{
            format(tmp,256,"This server has %d reserved slots. You must wait until more slots are available");
            SendClientMessage(playerid,0xFFFFFF00,tmp);
            return Kick(playerid);
        }
    }
    return 0;
}
public OnGameModeInit()
{
    SlotsRemaining=RESERVED_SLOTS;
}
public OnPlayerConnect(playerid)
{
    ReservedDialog(playerid,30,0);
}
public OnPlayerDisconnect(playerid,reason)
{
    new tmp[24];
    GetPlayerName(playerid,tmp,24);
    for(new name;name<RESERVED_SLOTS;name++)if(!strcmp(tmp,ReservedList[name]))SlotsRemaining++;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid!=DIALOG_ID)return 1;
    if(!response)return Kick(playerid);
    if(strcmp(inputtext,RESERVED_PASSWORD))
    {
        SendClientMessage(playerid,0xFFFFFF00,"Incorrect Password. Please wait until more slots are available");
        Kick(playerid);
        return 0;
    }
    SlotsRemaining--;
    return 0;
}
Not tested, just something I built in the browser window.

To be honest I'm not sure if ShowPlayerDialog can even be called in OnPlayerConnect...




Edit: I think I'm going to put "Official Thread Killer" at the end of my posts from now on.
Reply
#9

ok thanks i'll try it
Reply
#10

Quote:
Originally Posted by Dripac
Посмотреть сообщение
Just buy some more slots, better than messing around with the script

_
Spammers above, retarded much? You are probably mad that his server is full and you ain't get 2 players with your stupid script
Nice "suggestion". If the person cant afford more slots, its WAY more easier to make a simple script.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)