SA-MP Forums Archive
auto kick by login in PRRP GM - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: auto kick by login in PRRP GM (/showthread.php?tid=582959)



auto kick by login in PRRP GM - RedLabel - 24.07.2015

When I'll try to login to the panel control of the server, I just get kick from the server.
says "Server closed conaction" (Is the PR-RP gamemodes)
(I'll try to put a new plugins but notinhg help's me.)

Thanks for helping me!


Re: auto kick by login in PRRP GM - XVlaDX - 24.07.2015

Look around OnPlayerConnect, you might find the reason as to why it's kicking you.


Re: auto kick by login in PRRP GM - RedLabel - 24.07.2015

Quote:
Originally Posted by XVlaDX
Посмотреть сообщение
Look around OnPlayerConnect, you might find the reason as to why it's kicking you.
Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    new string[128], user[128], day, month, year, hour, minute, second;
    new num = GetMaxIPs(playerid);
    if(num >= 2 && !IsPlayerNPC(playerid)) return Kick(playerid);
    OnConnectInit(playerid);
    //furn system
    gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;

    for(new x=0; x < SELECTION_ITEMS; x++) {
        gSelectionFurns[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
	}

	gFurnAt[playerid] = 0;
    if(!NameIsRP(PlayerName(playerid)))
	{
		SendClientMessage(playerid, COLOR_LIGHTRED, "Your name is not acceptable please use the format: Firstname_Lastname.");
		KickEx(playerid);
		return 1;
	}
	GetPlayerHost(playerid); // Gets the DNS Data
	SetPlayerColor(playerid,COLOR_GREY);
	format(string, sizeof(string),"%s (%d) connected to the server.", PlayerName(playerid), playerid);
	if(GetPVarInt(playerid, "Admin") > 0 || GetPVarInt(playerid, "Helper") > 0 || GetPVarInt(playerid, "RegTeam") > 0)
	{
		LoginLog(string);
	}
	foreach (Player,i)
	{
	    if(GetPVarInt(i, "CntNames") == 1)
	    {
	        SendClientMessage(i,COLOR_WHITE,string);
	    }
	}
	ResetPlayerWeapons(playerid);
	CheckIP(playerid);
	gettime(hour,minute,second), FixHour(hour), hour = shifthour, getdate(year,month,day);
    format(user, sizeof(user), "users/%s.ini", PlayerName(playerid));
	if(DOF2_FileExists(user) && DOF2_GetInt(user, "Banned") == 1)
	{
        if(DOF2_GetInt(user, "TempYear") > 0 && DOF2_GetInt(user, "TempMonth") > 0 && DOF2_GetInt(user, "TempDay") > 0)
        {
		    new proceed = 0;
		    if(year > DOF2_GetInt(user, "TempYear")) // If the year is over your tempban year.
	        {
		        DOF2_SetInt(user, "Banned", 0);
	    	    DOF2_SetInt(user, "TempYear", 0);
		        DOF2_SetInt(user, "TempMonth", 0);
		        DOF2_SetInt(user, "TempDay", 0);
		        DOF2_WriteFile();
		        format(string, sizeof(string),"unbanip %s", DOF2_GetString(user, "IP"));
		        SendRconCommand(string);
		        SendRconCommand("reloadbans");
		        format(string, sizeof(string),"AdmWarn: %s was un-temp banned from Project-Bot.", PlayerName(playerid));
		        SendAdminMessage(COLOR_YELLOW,string);
		        proceed=1;
		    }
		    if(month > DOF2_GetInt(user, "TempMonth")) // If the month is over your tempban month.
		    {
		        DOF2_SetInt(user, "Banned", 0);
		        DOF2_SetInt(user, "TempYear", 0);
		        DOF2_SetInt(user, "TempMonth", 0);
		        DOF2_SetInt(user, "TempDay", 0);
		        DOF2_WriteFile();
		        format(string, sizeof(string),"unbanip %s", DOF2_GetString(user, "IP"));
		        SendRconCommand(string);
		        SendRconCommand("reloadbans");
		        format(string, sizeof(string),"AdmWarn: %s was un-temp banned from Project-Bot.", PlayerName(playerid));
		        SendAdminMessage(COLOR_YELLOW,string);
		        proceed=1;
		    }
		    if(month >= DOF2_GetInt(user, "TempMonth") && day >= DOF2_GetInt(user, "TempDay")) // If the day is your tempban undue day or above.
		    {
		        DOF2_SetInt(user, "Banned", 0);
		        DOF2_SetInt(user, "TempYear", 0);
		        DOF2_SetInt(user, "TempMonth", 0);
		        DOF2_SetInt(user, "TempDay", 0);
		        DOF2_WriteFile();
		        format(string, sizeof(string),"unbanip %s", DOF2_GetString(user, "IP"));
		        SendRconCommand(string);
		        SendRconCommand("reloadbans");
		        format(string, sizeof(string),"AdmWarn: %s was un-temp banned from Project-Bot.", PlayerName(playerid));
		        SendAdminMessage(COLOR_YELLOW,string);
		        proceed=1;
		    }
		    if(proceed == 0)
		    {
		        new mtext[50];
		        switch(DOF2_GetInt(user, "TempMonth"))
		        {
		            case 1: mtext = "January";
		            case 2: mtext = "February";
		            case 3: mtext = "March";
		            case 4: mtext = "April";
		            case 5: mtext = "May";
		            case 6: mtext = "June";
		            case 7: mtext = "July";
		            case 8: mtext = "August";
		            case 9: mtext = "September";
		            case 10: mtext = "October";
		            case 11: mtext = "November";
	                case 12: mtext = "December";
		        }
		        if(DOF2_GetInt(user, "TempDay") < 10) format(string, sizeof(string),"You are temporarily banned until %s-0%d-%d.", mtext, DOF2_GetInt(user, "TempDay"), DOF2_GetInt(user, "TempYear"));
		        else format(string, sizeof(string),"You are temporarily banned until %s-%d-%d.", mtext, DOF2_GetInt(user, "TempDay"), DOF2_GetInt(user, "TempYear"));
		        SendClientMessage(playerid, COLOR_LIGHTRED, string);
                return Kick(playerid);
            }
        }
	}
	return 1;
}
Can see whats wrong here?


Re: auto kick by login in PRRP GM - TenTen - 24.07.2015

Login's name?


Re: auto kick by login in PRRP GM - RedLabel - 24.07.2015

Quote:
Originally Posted by TenTen
Посмотреть сообщение
Login's name?
An roleplay's named, Jason_Winston.


Re: auto kick by login in PRRP GM - JaydenJason - 24.07.2015

Updated plugins/includes? Does crashdetect detect anything?


Re: auto kick by login in PRRP GM - RedLabel - 24.07.2015

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
Updated plugins/includes? Does crashdetect detect anything?
yes sir.


Re: auto kick by login in PRRP GM - xVIP3Rx - 24.07.2015

Try this and tell me what does it say before closing the connection
pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    new string[128], user[128], day, month, year, hour, minute, second;
    new num = GetMaxIPs(playerid);
    if(num >= 2 && !IsPlayerNPC(playerid))
    {
        SendClientMessage(playerid, -1, "kicked cause num >= 2");
    }
    OnConnectInit(playerid);
    //furn system
    gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;

    for(new x=0; x < SELECTION_ITEMS; x++) {
        gSelectionFurns[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
    }

    gFurnAt[playerid] = 0;
    if(!NameIsRP(PlayerName(playerid)))
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "Your name is not acceptable please use the format: Firstname_Lastname.");
        KickEx(playerid);
        return 1;
    }
    GetPlayerHost(playerid); // Gets the DNS Data
    SetPlayerColor(playerid,COLOR_GREY);
    format(string, sizeof(string),"%s (%d) connected to the server.", PlayerName(playerid), playerid);
    if(GetPVarInt(playerid, "Admin") > 0 || GetPVarInt(playerid, "Helper") > 0 || GetPVarInt(playerid, "RegTeam") > 0)
    {
        LoginLog(string);
    }
    foreach (Player,i)
    {
        if(GetPVarInt(i, "CntNames") == 1)
        {
            SendClientMessage(i,COLOR_WHITE,string);
        }
    }
    ResetPlayerWeapons(playerid);
    CheckIP(playerid);
    gettime(hour,minute,second), FixHour(hour), hour = shifthour, getdate(year,month,day);
    format(user, sizeof(user), "users/%s.ini", PlayerName(playerid));
    if(DOF2_FileExists(user) && DOF2_GetInt(user, "Banned") == 1)
    {
        if(DOF2_GetInt(user, "TempYear") > 0 && DOF2_GetInt(user, "TempMonth") > 0 && DOF2_GetInt(user, "TempDay") > 0)
        {
            new proceed = 0;
            if(year > DOF2_GetInt(user, "TempYear")) // If the year is over your tempban year.
            {
                DOF2_SetInt(user, "Banned", 0);
                DOF2_SetInt(user, "TempYear", 0);
                DOF2_SetInt(user, "TempMonth", 0);
                DOF2_SetInt(user, "TempDay", 0);
                DOF2_WriteFile();
                format(string, sizeof(string),"unbanip %s", DOF2_GetString(user, "IP"));
                SendRconCommand(string);
                SendRconCommand("reloadbans");
                format(string, sizeof(string),"AdmWarn: %s was un-temp banned from Project-Bot.", PlayerName(playerid));
                SendAdminMessage(COLOR_YELLOW,string);
                proceed=1;
            }
            if(month > DOF2_GetInt(user, "TempMonth")) // If the month is over your tempban month.
            {
                DOF2_SetInt(user, "Banned", 0);
                DOF2_SetInt(user, "TempYear", 0);
                DOF2_SetInt(user, "TempMonth", 0);
                DOF2_SetInt(user, "TempDay", 0);
                DOF2_WriteFile();
                format(string, sizeof(string),"unbanip %s", DOF2_GetString(user, "IP"));
                SendRconCommand(string);
                SendRconCommand("reloadbans");
                format(string, sizeof(string),"AdmWarn: %s was un-temp banned from Project-Bot.", PlayerName(playerid));
                SendAdminMessage(COLOR_YELLOW,string);
                proceed=1;
            }
            if(month >= DOF2_GetInt(user, "TempMonth") && day >= DOF2_GetInt(user, "TempDay")) // If the day is your tempban undue day or above.
            {
                DOF2_SetInt(user, "Banned", 0);
                DOF2_SetInt(user, "TempYear", 0);
                DOF2_SetInt(user, "TempMonth", 0);
                DOF2_SetInt(user, "TempDay", 0);
                DOF2_WriteFile();
                format(string, sizeof(string),"unbanip %s", DOF2_GetString(user, "IP"));
                SendRconCommand(string);
                SendRconCommand("reloadbans");
                format(string, sizeof(string),"AdmWarn: %s was un-temp banned from Project-Bot.", PlayerName(playerid));
                SendAdminMessage(COLOR_YELLOW,string);
                proceed=1;
            }
            if(proceed == 0)
            {
                new mtext[50];
                switch(DOF2_GetInt(user, "TempMonth"))
                {
                    case 1: mtext = "January";
                    case 2: mtext = "February";
                    case 3: mtext = "March";
                    case 4: mtext = "April";
                    case 5: mtext = "May";
                    case 6: mtext = "June";
                    case 7: mtext = "July";
                    case 8: mtext = "August";
                    case 9: mtext = "September";
                    case 10: mtext = "October";
                    case 11: mtext = "November";
                    case 12: mtext = "December";
                }
                if(DOF2_GetInt(user, "TempDay") < 10) format(string, sizeof(string),"You are temporarily banned until %s-0%d-%d.", mtext, DOF2_GetInt(user, "TempDay"), DOF2_GetInt(user, "TempYear"));
                else format(string, sizeof(string),"You are temporarily banned until %s-%d-%d.", mtext, DOF2_GetInt(user, "TempDay"), DOF2_GetInt(user, "TempYear"));
                SendClientMessage(playerid, COLOR_LIGHTRED, string);
                return Kick(playerid);
            }
        }
    }
    return 1;
}
Edited, thanks to JaydenJason

I knew this happens with dialogs, but after a 3seconds search I found out its for client messages too, thanks.


Re: auto kick by login in PRRP GM - JaydenJason - 24.07.2015

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
Try this and tell me what does it say before closing the connection
pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    new string[128], user[128], day, month, year, hour, minute, second;
    new num = GetMaxIPs(playerid);
    if(num >= 2 && !IsPlayerNPC(playerid))
    {
        SendClientMessage(playerid, -1, "kicked cause num >= 2");
        return Kick(playerid);
    }
    OnConnectInit(playerid);
    //furn system
    gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;

    for(new x=0; x < SELECTION_ITEMS; x++) {
        gSelectionFurns[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
    }

    gFurnAt[playerid] = 0;
    if(!NameIsRP(PlayerName(playerid)))
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "Your name is not acceptable please use the format: Firstname_Lastname.");
        KickEx(playerid);
        return 1;
    }
    GetPlayerHost(playerid); // Gets the DNS Data
    SetPlayerColor(playerid,COLOR_GREY);
    format(string, sizeof(string),"%s (%d) connected to the server.", PlayerName(playerid), playerid);
    if(GetPVarInt(playerid, "Admin") > 0 || GetPVarInt(playerid, "Helper") > 0 || GetPVarInt(playerid, "RegTeam") > 0)
    {
        LoginLog(string);
    }
    foreach (Player,i)
    {
        if(GetPVarInt(i, "CntNames") == 1)
        {
            SendClientMessage(i,COLOR_WHITE,string);
        }
    }
    ResetPlayerWeapons(playerid);
    CheckIP(playerid);
    gettime(hour,minute,second), FixHour(hour), hour = shifthour, getdate(year,month,day);
    format(user, sizeof(user), "users/%s.ini", PlayerName(playerid));
    if(DOF2_FileExists(user) && DOF2_GetInt(user, "Banned") == 1)
    {
        if(DOF2_GetInt(user, "TempYear") > 0 && DOF2_GetInt(user, "TempMonth") > 0 && DOF2_GetInt(user, "TempDay") > 0)
        {
            new proceed = 0;
            if(year > DOF2_GetInt(user, "TempYear")) // If the year is over your tempban year.
            {
                DOF2_SetInt(user, "Banned", 0);
                DOF2_SetInt(user, "TempYear", 0);
                DOF2_SetInt(user, "TempMonth", 0);
                DOF2_SetInt(user, "TempDay", 0);
                DOF2_WriteFile();
                format(string, sizeof(string),"unbanip %s", DOF2_GetString(user, "IP"));
                SendRconCommand(string);
                SendRconCommand("reloadbans");
                format(string, sizeof(string),"AdmWarn: %s was un-temp banned from Project-Bot.", PlayerName(playerid));
                SendAdminMessage(COLOR_YELLOW,string);
                proceed=1;
            }
            if(month > DOF2_GetInt(user, "TempMonth")) // If the month is over your tempban month.
            {
                DOF2_SetInt(user, "Banned", 0);
                DOF2_SetInt(user, "TempYear", 0);
                DOF2_SetInt(user, "TempMonth", 0);
                DOF2_SetInt(user, "TempDay", 0);
                DOF2_WriteFile();
                format(string, sizeof(string),"unbanip %s", DOF2_GetString(user, "IP"));
                SendRconCommand(string);
                SendRconCommand("reloadbans");
                format(string, sizeof(string),"AdmWarn: %s was un-temp banned from Project-Bot.", PlayerName(playerid));
                SendAdminMessage(COLOR_YELLOW,string);
                proceed=1;
            }
            if(month >= DOF2_GetInt(user, "TempMonth") && day >= DOF2_GetInt(user, "TempDay")) // If the day is your tempban undue day or above.
            {
                DOF2_SetInt(user, "Banned", 0);
                DOF2_SetInt(user, "TempYear", 0);
                DOF2_SetInt(user, "TempMonth", 0);
                DOF2_SetInt(user, "TempDay", 0);
                DOF2_WriteFile();
                format(string, sizeof(string),"unbanip %s", DOF2_GetString(user, "IP"));
                SendRconCommand(string);
                SendRconCommand("reloadbans");
                format(string, sizeof(string),"AdmWarn: %s was un-temp banned from Project-Bot.", PlayerName(playerid));
                SendAdminMessage(COLOR_YELLOW,string);
                proceed=1;
            }
            if(proceed == 0)
            {
                new mtext[50];
                switch(DOF2_GetInt(user, "TempMonth"))
                {
                    case 1: mtext = "January";
                    case 2: mtext = "February";
                    case 3: mtext = "March";
                    case 4: mtext = "April";
                    case 5: mtext = "May";
                    case 6: mtext = "June";
                    case 7: mtext = "July";
                    case 8: mtext = "August";
                    case 9: mtext = "September";
                    case 10: mtext = "October";
                    case 11: mtext = "November";
                    case 12: mtext = "December";
                }
                if(DOF2_GetInt(user, "TempDay") < 10) format(string, sizeof(string),"You are temporarily banned until %s-0%d-%d.", mtext, DOF2_GetInt(user, "TempDay"), DOF2_GetInt(user, "TempYear"));
                else format(string, sizeof(string),"You are temporarily banned until %s-%d-%d.", mtext, DOF2_GetInt(user, "TempDay"), DOF2_GetInt(user, "TempYear"));
                SendClientMessage(playerid, COLOR_LIGHTRED, string);
                return SendClientMessage(playerid, -1, "kicked cause proceed == 0"), Kick(playerid);
            }
        }
    }
    return 1;
}
Replace SendClientMessage with print, the player won't be able to see those messages.


Re: auto kick by login in PRRP GM - RedLabel - 24.07.2015

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
Replace SendClientMessage with print, the player won't be able to see those messages.
stil server closed.