SA-MP Forums Archive
/Explode to stop health hacks - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /Explode to stop health hacks (/showthread.php?tid=248897)



/Explode to stop health hacks - ryan_parkour - 16.04.2011

Hi all

I was wondering wether someone could tell me how to make a /explode command. You type /explode [playerid] and it makes an explosion by them to see if they are hacking.

Thanks


Re: /Explode to stop health hacks - Vince - 16.04.2011

Sscanf
GetPlayerPos
CreateExplosion


Re: /Explode to stop health hacks - Skylar Paul - 16.04.2011

pawn Код:
COMMAND:explode(playerid, params[])
{
    new
        Player,
        Radius[11],
        Float:TheirPos[3];
       
    if(sscanf(params, "uS(Medium)[11]", Player, Radius)) {
        SendClientMessage(playerid, c_white, "[USAGE] /Explode [Player ID] [Radius (Optional - Very Small, Small, Medium, Large)]");
        SendClientMessage(playerid, c_orange, "[FUNCTION] Creates an explosion on the player. Can be used to check for health hacks.");
        return 1;
    }
    GetPlayerPos(Player, TheirPos[0], TheirPos[1], TheirPos[2]);
    if(strcmp(Radius, "Very Small", true) == 0) {
        CreateExplosion(TheirPos[0], TheirPos[1], TheirPos[2], 12, 5);
    }
    else if(strcmp(Radius, "Small", true) == 0) {
        CreateExplosion(TheirPos[0], TheirPos[1], TheirPos[2], 11, 5);
    }
    else if(strcmp(Radius, "Medium", true) == 0) {
        CreateExplosion(TheirPos[0], TheirPos[1], TheirPos[2], 1, 5);
    }
    else if(strcmp(Radius, "Large", true) == 0) {
        CreateExplosion(TheirPos[0], TheirPos[1], TheirPos[2], 10, 5);
    }
    else return SendClientMessage(playerid, c_red, "Invalid Parameter! (Radius)");
    printf("[EXPLODE] Administrator %s has exploded %s. [Type: %s]", pName(playerid), pName(Player), Radius);
    return 1;
}
Straight out of my admin filterscript, so please, if you do end up using it, keep the credits by the side of the command.


Re: /Explode to stop health hacks - Calgon - 16.04.2011

There are some types of hacks that can circumvent explosions, but for the most part I suppose /explode would work, since most people haven't figured it out yet.

However, the command itself is pretty simple to create, simply use the CreateExplosion function to get it to work.

With zcmd/sscanf, this should work (untested):
pawn Код:
CMD:explode(playerid, params[]) {
    new
        iTarget;
       
    if(sscanf(params, "u", iTarget))
        return 1; // The player didn't type a name or an ID
       
    if(iTarget == INVALID_PLAYER_ID)
        return 1; // Not connected.

    if(!IsPlayerAdmin(playerid))
        return 1; // The person typing this is not an admin.

    new
        Float: fExplosionPosition[3]; // Create some variables so we can store the position of where the explosion will be

    GetPlayerPos(iTarget, fExplosionPosition[0], fExplosionPosition[1], fExplosionPosition[2]); // Get the position that we'll set the explosion for
    CreateExplosion(fExplosionPosition[0], fExplosionPosition[1], fExplosionPosition[2], 2, 10.0); // Create the explosion with the SA-MP CreateExplosion function
    return 1;
}
EDIT: Damn, beaten x2.


Re: /Explode to stop health hacks - ryan_parkour - 16.04.2011

Can ypu please make it a downloadable file? I'm a n00b. Don't know where anything goes.


Re: /Explode to stop health hacks - Skylar Paul - 16.04.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
There are some types of hacks that can circumvent explosions, but for the most part I suppose /explode would work, since most people haven't figured it out yet.

However, the command itself is pretty simple to create, simply use the CreateExplosion function to get it to work.

With zcmd/sscanf, this should work (untested):
pawn Код:
CMD:explode(playerid, params[]) {
    new
        iTarget;
       
    if(sscanf(params, "u", iTarget))
        return 1; // The player didn't type a name or an ID
       
    if(iTarget == INVALID_PLAYER_ID)
        return 1; // Not connected.

    if(!IsPlayerAdmin(playerid))
        return 1; // The person typing this is not an admin.

    new
        Float: fExplosionPosition[3]; // Create some variables so we can store the position of where the explosion will be

    GetPlayerPos(iTarget, fExplosionPosition[0], fExplosionPosition[1], fExplosionPosition[2]); // Get the position that we'll set the explosion for
    CreateExplosion(fExplosionPosition[0], fExplosionPosition[1], fExplosionPosition[2], 2, 10.0); // Create the explosion with the SA-MP CreateExplosion function
    return 1;
}
EDIT: Damn, beaten x2.
Not so much, you explained it better - Not to mention, I like your way of getting positions better; never knew you could do that. Thank you, I shall be using that from now on!


Re: /Explode to stop health hacks - ryan_parkour - 16.04.2011

Quote:
Originally Posted by Skylar Paul
Посмотреть сообщение
Not so much, you explained it better - Not to mention, I like your way of getting positions better; never knew you could do that. Thank you, I shall be using that from now on!
Downloadable? Don't know where to put this??


Re: /Explode to stop health hacks - ryan_parkour - 16.04.2011

None of them work


Re: /Explode to stop health hacks - Calgon - 16.04.2011

As a file, http://www.fwright.com/files/explosions.amx (save file as) - It works as a filterscript, so put it in your filterscripts folder, update your server.cfg, restart your server and make sure you're logged in as an RCON admin so you can use it.


Re: /Explode to stop health hacks - ryan_parkour - 16.04.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
As a file, http://www.fwright.com/files/explosions.amx (save file as) - It works as a filterscript, so put it in your filterscripts folder, update your server.cfg, restart your server and make sure you're logged in as an RCON admin so you can use it.
That's a .amx file. it only works with .pwn