Hack crash player
#1

My server seems to be hacked crash when the number reaches 70 80 people, sometimes in one area will crash all the players do not in that area someone or let me code against it

Code onplayerweaponshot mine
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == BULLET_HIT_TYPE_PLAYER && !IsPlayerNPC(hitid))
    {
    	if(!IsAFK{ hitid } && !CoolDown{ playerid })
    	{
            new surf = GetPlayerSurfingVehicleID(playerid), tsurf = GetPlayerSurfingVehicleID(playerid);
            if(surf == INVALID_VEHICLE_ID && tsurf == INVALID_VEHICLE_ID && !IsPlayerInAnyVehicle(hitid))
        	{
         		new Float:targetpkl = NetStats_PacketLossPercent(hitid), Float:playerpkl = NetStats_PacketLossPercent(playerid);

				if(targetpkl < 0.8 && playerpkl < 0.8)
             	{
              		new Float:fOriginXx, Float:fOriginYy, Float:fOriginZz, Float:fHitPosXx, Float:fHitPosYy, Float:fHitPosZz;
                	GetPlayerLastShotVectors(playerid, fOriginXx, fOriginYy, fOriginZz, fHitPosXx, fHitPosYy, fHitPosZz);
                    CheckForAimbot(playerid, fHitPosXx, fHitPosYy, fHitPosZz, hitid);
              	}
          	}

          	new string[128];
			for(new i = 0; i < GetPlayerPoolSize() + 1; i++)
			{
				new epids = CheckEvidence(hitid, playerid);
				if(epids == -1)
				{
					new epid = GetFreeEvidence(hitid);
					if(epid != -1)
					{
						format(string, sizeof(string), "Evidence_Shoot_%d", epid);
						SetPVarInt(hitid, string, playerid);

						format(string, sizeof(string), "Evidence_Shoot_SQL_%d", epid);
						SetPVarInt(hitid, string, GetPlayerSQLId(playerid));

						format(string, sizeof(string), "Evidence_Shoot_Tick_%d", epid);
						SetPVarInt(hitid, string, GetTickCount());

						format(string, sizeof(string), "Evidence_Shoot_Weapon_%d", epid);
						SetPVarInt(hitid, string, weaponid);

						new string2[128];
						format(string2, sizeof(string2), "Evidence_Shoot_%d", epid);
					}
				}
				else
				{
					format(string, sizeof(string), "Evidence_Shoot_Tick_%d", epids);
					SetPVarInt(hitid, string, GetTickCount());

					format(string, sizeof(string), "Evidence_Shoot_Weapon_%d", epids);
					SetPVarInt(hitid, string, weaponid);

					new string2[128];
					format(string2, sizeof(string2), "Evidence_Shoot_%d", epids);
				}
			}
    	}
    }
    if(!GetPVarInt(playerid, "EventToken"))
	{
 		if(GetPVarInt(playerid, "IsInArena") == -1)
	    {
    		new weapons[2];
			GetPlayerWeaponData(playerid, GetWeaponSlot(weaponid), weapons[0], weapons[1]);
		    switch(weaponid)
			{
				case 22 .. 34:
			    {
			        if(weapons[1] == PlayerInfo[playerid][pAmmo][GetAmmoSlot(weaponid)])
			        {
				        if(PlayerInfo[playerid][pAmmo][GetAmmoSlot(weaponid)] > 0 )
				        {
				    		PlayerInfo[playerid][pAmmo][GetAmmoSlot(weaponid)]--;
						}
						else
						{
						    SetPlayerArmedWeapon(playerid, 0);
						    new string[128], wepname[32];
						    GetWeaponName(weaponid, wepname, sizeof(wepname));
						    format(string, sizeof(string), "He thong: Khau sung %s cua ban da het dan Hay mau di nap dan.", wepname);
						    SendClientMessageEx(playerid, COLOR_YELLOW, string);
						}
					}
					else SetPlayerAmmo(playerid, weaponid, PlayerInfo[playerid][pAmmo][GetAmmoSlot(weaponid)]);
				}
			}
		}
	}
    if(weaponid==38)
    {
    if(PlayerInfo[playerid][pAdmin]>=2) return 1;
	Kick(playerid);
	}
    new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);

	//Desync weapon IDs that don't fire bullets
	if (weaponid < 22 || weaponid > 38)
	return 0;

	//Desync shots with Z pos out of bounds
	if(!(-20000.0 <= z <= 20000.0))
	return 0;
	return 1;
}
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=535559
try this maybe, its a fix for it
Reply
#3

Quote:
Originally Posted by FuNkYTheGreat
Посмотреть сообщение
I tried it but no, i checked the server_log then found the error
Код:
Description: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Password UPDATE num = num + 1' at line 1 (index 0
Reply
#4

Try with those:

Код:
public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ )
{
    if( hittype != BULLET_HIT_TYPE_NONE ) // Bullet Crashing uses just this hittype
	{
        if( !( -1000.0 <= fX <= 1000.0 ) || !( -1000.0 <= fY <= 1000.0 ) || !( -1000.0 <= fZ <= 1000.0 ) ) // a valid offset, it's impossible that a offset bigger than 1000 is legit (also less than -1000.0 is impossible, not used by this hack, but still, let's check for it, just for the future, who knows what hacks will appear). The object with biggest offset is having ~700-800 radius.
		{
			/*
				If you want, here you can kick the cheater
			*/
			return 0; // let's desynchronize that bullet, so players won't crash
		}
	}
    return 1;
}
Код:
public OnPlayerUpdate(playerid) 
{ 
    if(GetPlayerCameraMode(playerid) == 53)  
    {  
        new Float:kLibPos[3];  
        GetPlayerCameraPos(playerid, kLibPos[0], kLibPos[1], kLibPos[2]); 
        if ( kLibPos[2] < -50000.0 || kLibPos[2] > 50000.0 )  
        {  
            BanEx(playerid, "WeaponCrasher");  
            return 0;  
        }  
    }   
    return 1; 
}
Код:
Notice: this can safe also if you are not giving vehicle components to players in interior 0.
public OnVehicleMod(playerid, vehicleid, componentid) {
        if(GetPlayerInterior(playerid) == 0)
    {
		Ban(playerid);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)