Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hello! I have a problem in onplayerconnect (SAMP) #645

Open
twinc7 opened this issue May 31, 2023 · 1 comment
Open

hello! I have a problem in onplayerconnect (SAMP) #645

twinc7 opened this issue May 31, 2023 · 1 comment

Comments

@twinc7
Copy link

twinc7 commented May 31, 2023

First of all, sorry for my English, I'm from Argentina.

Sorry for the inconvenience, I have an error detected by crashdetected.so ocurrs people enter my server, I recently updated YSI completely (con sscanf, streamer tambien claro) but it continues to happen

The curious thing is that this error is not thrown with all the entries, only with a certain number of players, and it is repetitive, that is, if a player X is thrown that error in the log when entering, if he leaves and rejoin the error pops up again with this player

example in server_log

[join] akt.Smoke_ has joined the server (3:177.245.103.176)
> [debug] Run time error 5: "Invalid memory access"
> [debug] AMX backtrace:
> [debug] #0 00037a9c in public OnPlayerConnect () in ladminv5.amx

in onfilterscriptinit ladminv5.pwn

	foreach(new i : Player)
	{
		 if(IsPlayerConnected(i))
		 {
			CallRemoteFunction("OnPlayerConnect", "i", i);
		 }
	}

in onplayerconnect ladminv5.pwn

public OnPlayerConnect(playerid)
{
	SetPlayerScore(playerid, 0);
	PlayerInfo[playerid][Score] = 0;
    SetPlayerColor(playerid, RandomColor());
	new pame[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pame, sizeof(pame));
	SetTimerEx("Cuenta", 10,0,"d",playerid);
	new connecting_ip[32+1];
	GetPlayerIp(playerid,connecting_ip,32);
	AntiNicks(playerid);

	if(!strcmp("con",pame,true) || !strcmp("aux",pame,true) || !strcmp("prn",pame,true) || !strcmp("lptn",pame,true) || !strcmp("nul",pame,true) || !strcmp("clock$",pame,true))
	{
		format(StupidGlobalStr2, sizeof(StupidGlobalStr2), "{FF8000}* %s Fue baneado automaticamente Razon: (Nombre reservado de Windows)", pame);
		printf(StupidGlobalStr2);
		CambiarNickNoob(playerid);
	}

	if(NickSpam(pame))
	{
		format(StupidGlobalStr2, sizeof(StupidGlobalStr2), "{FF8000}* (%i) Fue baneado automaticamente Razon: (NickName Spam)", playerid);
		printf(StupidGlobalStr2);
		CambiarNickNoob(playerid);
	}

	if(PlayerInfo[playerid][Level] == 0 && AntiMinigunHack[playerid] == 0 && GetPlayerVirtualWorld(playerid) != 1)
	{
		AntiMinigunHack[playerid] = 1;
		return 1;
	}

	YaDijoHola[playerid]=0;
	YaDijoAdios[playerid]=0;
	YaUsoHesoyam[playerid]=0;
	scoredado[playerid] = 0;
	minigunguerra[playerid] = 0;
	banworld[playerid] = 0;
	gHascoloreslocoEnabled[playerid] = false;
	KillTimer(gcoloreslocoTimer[playerid]);
	FireShotON[playerid] =                   false;
	UsarCMD[playerid] =                      false;
	CMDSpecial[playerid] =                   false;
	BonusScore[playerid] =                   false;
	NOComandos[playerid]=                    false;
	ADpm[playerid] =                         false;
	PlayerInfo[playerid][Deaths] =           false;
	PlayerInfo[playerid][Kills] =            false;
	PlayerInfo[playerid][Experiencia] =      false;
	PlayerInfo[playerid][Jailed] =           false;
	PlayerInfo[playerid][Frozen] =           false;
	PlayerInfo[playerid][Level] =            false;
	PlayerInfo[playerid][pVip] =             false;
	PlayerInfo[playerid][SpecialUser] =      false;
	PlayerInfo[playerid][userzombie] =       false;
	PlayerInfo[playerid][vHide] =            false;//by wes
	PlayerInfo[playerid][Hide] =             false;
	PlayerInfo[playerid][LoggedIn] =         false;
	PlayerInfo[playerid][Registered] =       false;
	PlayerInfo[playerid][God] =              false;
	PlayerInfo[playerid][GodCar] =           false;
	PlayerInfo[playerid][Spawned] =          false;
	PlayerInfo[playerid][TimesSpawned] =     false;
	PlayerInfo[playerid][Muted] =            false;
	PlayerInfo[playerid][MuteWarnings] =     false;
	PlayerInfo[playerid][Warnings] =         false;
	PlayerInfo[playerid][Caps] =             false;
	PlayerInfo[playerid][DoorsLocked] =      false;
	EventoCmd[playerid] = 0;
	PlayerInfo[playerid][SpamCount] =        false;
	PlayerInfo[playerid][SpamTime] =         false;
	PlayerInfo[playerid][FailLogin] =        false;
	HaReportado[playerid]=                   false;
	XDeaths[playerid] =                      false;
	LastDeath[playerid] =                    false;
	warneded[playerid] =                     false;
	InitFly(playerid);
	EstaEnFly[playerid] =                    false;
	DudaEnviada[playerid] = 0;
	Colorcadmin[playerid] = 0;
	Voted[playerid]= 0  ;
	modoevento[playerid]= 0 ;
	YaUsoNuclear[playerid]=                  false;
	BuscadoPorNuclear[playerid]=             false;
	HanDesactivadaoLaBomba[playerid]=        false;
	reply[playerid] =                        false;
	TempBanCheck(playerid);
	AceleracionBrutal[playerid] =            false;
	#if EnableTwoRcon == true
	PlayerInfo[playerid][MaxRcon] =          false;
	#endif


	PlayerInfo[playerid][ConnectTime] = gettime();

	//------------------------------------------------------
	new PlayerName[MAX_PLAYER_NAME], IP[16];
	GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
	GetPlayerIp(playerid,StupidGlobalTemp3,50);
	GetPlayerIp(playerid, IP, sizeof IP);
	//-----------------------------------------------------
	//-----------------------------------------------------
	if(ServerInfo[ConnectMessages] == 1)
	{
		new
		IPA[16], StupidGlobalStr5[128];
		GetPlayerIp(playerid, IPA, sizeof IPA);
	    new pAKA[256]; pAKA = dini_Get("ladmin/config/aka.txt",StupidGlobalTemp3);
		if (strlen(pAKA) < 3) format(StupidGlobalStr5,sizeof(StupidGlobalStr5),"*** %s (%d) has joined the server | IP: %s | PAIS: %s", PlayerName, playerid, IPA, IpToCountry_db(IPA));
		else if (!strcmp(pAKA,PlayerName,true)) format(StupidGlobalStr5,sizeof(StupidGlobalStr5),"*** %s (%d) has joined the server | IP: %s | PAIS: %s", PlayerName, playerid, IPA, IpToCountry_db(IPA));
		else format(StupidGlobalStr5,sizeof(StupidGlobalStr5),"*** %s (%d) has joined the server (aka %s) (ip %s)", PlayerName, playerid, pAKA, IPA);

		foreach(new i : Player) if(IsPlayerConnected(i) && playerid != i)
		{
			if(PlayerInfo[i][Level] > 1)
			{
				SendClientMessage(i,grey,StupidGlobalStr5);
			}
			else return 1;
		}
	}
	//---------------------------- [ entrada al servidor ] -----------------------//
	//-----------------------------------------------------
	if (dUserINT(pName(playerid)).("banned") == 1)
	{
		SendClientMessage(playerid, 0xFF8000C8, "* Este nombre esta baneado de este servidor");
		format(StupidGlobalStr2,sizeof(StupidGlobalStr2),"%s (%d) ha sido auto Kickeado. Razon: Nombre baneado del servidor",PlayerName,playerid);
		foreach(new i : Player) if(IsPlayerConnected(i) && playerid != i)
		{
			if(PlayerInfo[i][Level] > 1) SendClientMessage(i,grey,StupidGlobalStr2);
		}
		SaveToFile("KickLog",StupidGlobalStr2);  Kick(playerid);
	}
	//-----------------------------------------------------
	if(ServerInfo[NameKick] == 1)
	{
		for(new s = 0; s < BadNameCount; s++)
		{
			if(!strcmp(BadNames[s],PlayerName,true))
			{
				SendClientMessage(playerid,0xFF8000C8, "* Tu nombre esta blqueado en este servidor");
				format(StupidGlobalStr2,sizeof(StupidGlobalStr2),"%s (%d) ha sido auto kickeado. Razon: (Nombre prohibido)",PlayerName,playerid);
				foreach(new i : Player) if(IsPlayerConnected(i) && playerid != i)
				{
					if(PlayerInfo[i][Level] > 1) SendClientMessage(i,grey,StupidGlobalStr2);
				}
				crashear(playerid);
				SaveToFile("KickLog",StupidGlobalStr2);
				Kick(playerid);
				return 1;
			}
		}
	}
	//-----------------------------------------------------
	if(ServerInfo[PartNameKick] == 1)
	{
		for(new s = 0; s < BadPartNameCount; s++)
		{
			new pos;
			while((pos = strfind(PlayerName,BadPartNames[s],true)) != -1) for(new i = pos, j = pos + strlen(BadPartNames[s]); i < j; i++)
			{
				SendClientMessage(playerid,0xFF8000C8, "* Su nombre esta bloqueado en este servidor");
				format(StupidGlobalStr2,sizeof(StupidGlobalStr2),"%s (%d) ha sido auto kickeado. (Razon: Nombre prohibido)",PlayerName,playerid);
				foreach(new a : Player) if(IsPlayerConnected(a) && playerid != i)
				{
					if(PlayerInfo[a][Level] > 1) SendClientMessage(a,grey,StupidGlobalStr2);
				}
				print(StupidGlobalStr2);
				SaveToFile("KickLog",StupidGlobalStr2);  Kick(playerid);
				return 1;
			}
		}
	}
	//-----------------Super Ban Serial----------------------
	new sHD[100], pSHD[256];
	gpci(playerid, sHD, sizeof(sHD));

	pSHD = dini_Get("ladmin/config/SHD.txt",sHD);

	if(strcmp(pSHD,sHD,true))
	{
		new StupidGlobalStr3[128], Nombre[MAX_PLAYER_NAME];
		GetPlayerName(playerid, Nombre, sizeof(Nombre));
		SendClientMessage(playerid, 0xFF8000C8, "* Has sido baneado del servidor anteriormente, si es injusto, comunicate al discord discord.gg/Hr65BHvtpZ.");
		Ban(playerid);
		format(StupidGlobalStr3,sizeof(StupidGlobalStr3),"* Usuario %s fue automaticamente baneado. Razon {FFFFFF}[Evadir ban]", Nombre);
		SendClientMessageToAll(0xFF0000FF, StupidGlobalStr3);
		SaveToFile("BanLog",StupidGlobalStr3);
	}
	//------------------------------------------------
	if(ServerInfo[Locked] == 1)
	{
		PlayerInfo[playerid][AllowedIn] = false;
		SendClientMessage(playerid,0xFF8000C8,"El Servidor esta cerrado por mantenimiento. Tiene 20 seg para ingresar la contraseña del servidor antes de ser kickeado");
		SendClientMessage(playerid,red,"usa /password [contraseña] para poder jugar");
		LockKickTimer[playerid] = SetTimerEx("AutoKick", 20000, 0, "i", playerid);
	}
	//-----------------------------------------------------
	if(strlen(dini_Get("ladmin/config/aka.txt", StupidGlobalTemp3)) == 0) dini_Set("ladmin/config/aka.txt", StupidGlobalTemp3, PlayerName);
	else
	{
		if( strfind( dini_Get("ladmin/config/aka.txt", StupidGlobalTemp3), PlayerName, true) == -1 )
		{
			format(StupidGlobalStr2,sizeof(StupidGlobalStr2),"%s,%s", dini_Get("ladmin/config/aka.txt",StupidGlobalTemp3), PlayerName);
			dini_Set("ladmin/config/aka.txt", StupidGlobalTemp3, StupidGlobalStr2);
		}
	}
	return 1;
}

//==============================================================================
forward Cuenta(playerid);
public Cuenta(playerid)
{
	new pame[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pame, sizeof(pame));
	new IP[16];
	GetPlayerIp(playerid,StupidGlobalTemp3,50);
	GetPlayerIp(playerid, IP, sizeof IP);
	PlayerPlaySound(playerid,1139,0.0,0.0,0.0);
	new dialogStupidGlobalStr[2000];
	if(!udb_Exists(pName(playerid)))
	{
		format(dialogStupidGlobalStr,sizeof(dialogStupidGlobalStr),"{FFFFFF}Bienvenido a {F6A000}| DESTRUCCION-TOTAL FREEROAM | {ffffff}\n\n{ffffff}Nick: %s  {ffffff}IP: %s\n{F20000}Usuario Nuevo\n\n{ffffff}Es obligatorio que te registres! Ingresa una contraseña para poder {00FF00}Jugar",pame,IP);
		ShowPlayerDialog(playerid, 9049, DIALOG_STYLE_PASSWORD, "{F6A000}|»| {FFFFFF}USUARIO NUEVO NO REGISTRADO {F6A000}|«|", dialogStupidGlobalStr, "Aceptar", "");
	}
	else
	{
		new file[44 + 1];
		PlayerInfo[playerid][Registered] = 1;
		format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(pame));
		StupidGlobalTemp2 = dini_Get(file,"ip");
		if( (!strcmp(StupidGlobalTemp3,StupidGlobalTemp2,true)) && (ServerInfo[AutoLogin] == 1) )
		{
			LoginPlayer(playerid);
			if(PlayerInfo[playerid][Level] >= 1)
			{
       			if(PlayerInfo[playerid][Level] >= 10)
       			{
    				format(StupidGlobalStr2,sizeof(StupidGlobalStr2),"* [ADMINISTRADOR]{FF8000} Has sido logueado automaticamente [Nivel:{FFFFFF} 10{FF8000}]");
					SendClientMessage(playerid,0xFFFFFFAA,StupidGlobalStr2);
       			}
       			else
       			{
					format(StupidGlobalStr2,sizeof(StupidGlobalStr2),"* [ADMINISTRADOR]{FF8000} Has sido logueado automaticamente [Nivel:{FFFFFF} %d{FF8000}]", PlayerInfo[playerid][Level] );
					SendClientMessage(playerid,0xFFFFFFAA,StupidGlobalStr2);
				}
			}
			else SendClientMessage(playerid,0xFFFFFFAA,"[BIENVENIDO] {FF8000}Has sido logeado automaticamente!");
		}
		else format(dialogStupidGlobalStr,sizeof(dialogStupidGlobalStr),"{FFFFFF}Bienvenido nuevamente a {F6A000}| DESTRUCCION-TOTAL FREEROAM | {ffffff}\n\n{ffffff}Nick: %s    {ffffff}IP: %s  {ffffff}Pais: %s\n{00FF00}Usuario Ya Registrado Anteriormente!\n\n{ffffff}Tu cuenta esta guardada, ingresa tu contraseña para poder {F20000}Jugar", pame,IP,IpToCountry_db(IP)), ShowPlayerDialog(playerid, 9048, DIALOG_STYLE_PASSWORD, "{F6A000}|»| {FFFFFF}USUARIO REGISTRADO {F6A000}|»|", dialogStupidGlobalStr, "Entrar", "");
	}
	return 1;
}

forward AutoKick(playerid);
public AutoKick(playerid)
{
	if( IsPlayerConnected(playerid) && ServerInfo[Locked] == 1 && PlayerInfo[playerid][AllowedIn] == false)
	{
		SendClientMessage(playerid,0xFF8000C8,"Has sido automaticamente sacado del servidor. Razon: Servidor Bloqueado, Comunicate al discord discord.gg/Hr65BHvtpZ");
		format(StupidGlobalStr2,sizeof(StupidGlobalStr2),"%s (%d) fue automaticamente kickeado. Razon: Servidor Bloqueado",pName(playerid),playerid);
		SaveToFile("KickLog",StupidGlobalStr2);  Kick(playerid);
		SendClientMessageToAll(grey, StupidGlobalStr2); print(StupidGlobalStr2);
	}
	return 1;
}

importants includes in ladminv5.pwn

#include <a_samp>
#include <YSI_Data\y_iterate>
#include <YSI_Coding\y_va>
#include <lethaldudb2>
#include <streamer>
#include <sscanf2>
#include <xFireworks>
#include <YSI_Coding\y_remote>

If u need any more information, I'm glad to know, write me, thank u very much

@shierru
Copy link

shierru commented Jul 27, 2023

Try using the '-d3' argument when compiling and repeat this error again. In theory, it should display information about where this happened (not exactly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants