can i create a Key F11 and F12 ?
#1

so , with https://sampwiki.blast.hk/wiki/Keys . dont have Value of keys F11 and F12 (s 0be it hack ). i want to when player Press F11/F12 they get slap to death , and get banned

SO CAN I CREATE THE KEY F11 F12 TO USE FOR OnPlayerKeyStateChange .
Plz help me

how this guys can do it ? https://www.youtube.com/watch?v=1dTClxd4bO0
Reply
#2

You can't do it.
Reply
#3

u can but only if the player has some work with that key. What you ask CAN'T be done in samp script. Try other softwares
Reply
#4

Those keys aren't used by the game so unless you install a plugin that detects which key the player has pressed (I doubt cheaters will download and install something like that just to cheat on your server) you won't have the chance of doing that.
You could obviously find other solutions if someone is cheating on your server / crashing it by abusing functions that are called by the SA-MP client, here's something I can provide you:

pawn Код:
/* Purpose: Controlling overall flood on the server */

/* Defines */
#define FLOODCMD_COOLDOWN 0.1
#define MAX_CMD_FLOOD_WARNS 8
#define INTERIOR_COOLDOWN 2
#define MAX_INTERIOR_WARNS 8
#define CARDEATH_COOLDOWN 2
#define MAX_CARDEATH_WARNS 3
#define PLAYERDEATH_COOLDOWN 2
#define MAX_PLAYERDEATH_WARNS 3
#define debug 0
//-----------

/* New's */
new cmdFloodWarns[MAX_PLAYERS];
new interiorWarns[MAX_PLAYERS];
new carDeathWarns[MAX_PLAYERS];
new playerDeathWarns[MAX_PLAYERS];
//-----------

/* Functions */
forward KickPlayer(playerid);
public KickPlayer(playerid) Kick(playerid);

KickEx(playerid, color, message[]) {
    SendClientMessage(playerid, color, message);
    SetTimerEx("KickPlayer", 1000, 0, "d", playerid); //Set the delay
}

/*
The correct way of using this is:
if(isFloodingCommands(playerid)) {
    //Process whatever you have to process
    //It's useful if you're using the ******'s YCMD command processor.
}
*/

isFloodingCommands(playerid) { //returns 1 if a player is flooding commands and 0 if not. If 1, it assigns a command flood warn and doesn't allow the player to perform any commands
    new time = GetPVarInt(playerid, "CommandCoolDown");
    new timenow = gettime();
    if(FLOODCMD_COOLDOWN-(timenow-time) > 0) {
        assignAndCheckFloodWarns(playerid);
        #if debug
        printf("Last Spam: Time: %f", FLOODCMD_COOLDOWN-(timenow-time));
        #endif
        return 1;
    }
    cmdFloodWarns[playerid] = 0; //If the above doesn't happen
    SetPVarInt(playerid, "CommandCoolDown", gettime());
    return 0;
}

assignAndCheckFloodWarns(playerid) {
    if(++cmdFloodWarns[playerid] > MAX_CMD_FLOOD_WARNS) {
        KickEx(playerid, COLOR_GREY, "You have been kicked for flooding commands."); //Kick
    }
    return 1;
}

/*
You should only use this if you're using OnPlayerInteriorChange and it goes under there.
*/

onInteriorFloodCheck(playerid) {
    new time = GetPVarInt(playerid, "InteriorCoolDown");
    new timenow = gettime();
    if(INTERIOR_COOLDOWN-(timenow-time) > 0) {
        assignAndCheckInteriorWarns(playerid);
        return 1;
    }
    SetPVarInt(playerid, "InteriorCoolDown", gettime());
    return 1;
}

assignAndCheckInteriorWarns(playerid) {
    if(++interiorWarns[playerid] > MAX_INTERIOR_WARNS) {
        KickEx(playerid, COLOR_GREY, "You have been kicked for Interior Spamming."); //Kick
    }
    return 1;
}

/*
The correct way of using this is:
if(!isFloodingCarDeaths(playerid)) {
    //Process whatever you have to process
}
*/


isFloodingCarDeaths(playerid) { //returns 1 if a player is flooding car deaths and 0 if not. If 1, it assigns a car death flood warn
    if(playerid != INVALID_PLAYER_ID) {
        new time = GetPVarInt(playerid, "CarDeathCoolDown");
        new timenow = gettime();
        if(CARDEATH_COOLDOWN-(timenow-time) > 0) {
            checkCarFloodWarns(playerid);
            #if debug
            printf("Last Spam: Time: %f", CARDEATH_COOLDOWN-(timenow-time));
            #endif
            return 1;
        }
        carDeathWarns[playerid] = 0; //If the above doesn't happen
        SetPVarInt(playerid, "CarDeathCoolDown", gettime());
    }
    return 0;
}

checkCarFloodWarns(playerid) {
    if(++carDeathWarns[playerid] > MAX_CARDEATH_WARNS) {
        KickEx(playerid, COLOR_GREY, "You have been kicked for Spamming Car Deaths."); //Kick
    }
    return 1;
}

/*
The correct way of using this is:
if(!isFloodingPlayerDeaths(playerid)) {
    //Process whatever you have to process
}
*/

isFloodingPlayerDeaths(playerid) { //returns 1 if a player is flooding car deaths and 0 if not. If 1, it assigns a car death flood warn
    new time = GetPVarInt(playerid, "PlayerDeathCoolDown");
    new timenow = gettime();
    if(PLAYERDEATH_COOLDOWN-(timenow-time) > 0) {
        checkPlayerDeathFloodWarns(playerid);
        #if debug
        printf("Last Spam: Time: %f", PLAYERDEATH_COOLDOWN-(timenow-time));
        #endif
        return 1;
    }
    playerDeathWarns[playerid] = 0; //If the above doesn't happen
    SetPVarInt(playerid, "PlayerDeathCoolDown", gettime());
    return 0;
}

checkPlayerDeathFloodWarns(playerid) {
    if(++playerDeathWarns[playerid] > MAX_PLAYERDEATH_WARNS) {
        KickEx(playerid, COLOR_GREY, "You have been kicked for Spamming Fake Deaths."); //Kick
    }
    return 1;
}

//Call this OnPlayerDisconnect as: onFloodCheckerDisconnect(playerid, reason);
onFloodCheckerDisconnect(playerid, reason) {
    #pragma unused reason
    if(reason != 3) {
        DeletePVar(playerid, "CommandCoolDown");
        DeletePVar(playerid, "InteriorCoolDown");
        DeletePVar(playerid, "CarDeathCoolDown");
        DeletePVar(playerid, "PlayerDeathCoolDown");
        cmdFloodWarns[playerid] = 0;
        interiorWarns[playerid] = 0;
        carDeathWarns[playerid] = 0;
        playerDeathWarns[playerid] = 0;
    }
    return 1;
}
The code is a bit repetitive but it works as it should.
Reply
#5

how this guys can do it ? https://www.youtube.com/watch?v=1dTClxd4bO0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)