/Explode to stop health hacks
#1

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
Reply
#2

Sscanf
GetPlayerPos
CreateExplosion
Reply
#3

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.
Reply
#4

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.
Reply
#5

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

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!
Reply
#7

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??
Reply
#8

None of them work
Reply
#9

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.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)