[FilterScript] Anti ESC (it work)
#1

well, I was looking for a system of anti esc, but I did not find any that were useful to me. For example, I was working with dialog, so I was wondering if the player was in the esc menu, using methods I've seen here, the player had to mess it up if he has put dialog he can not shake and also could not close the dialog is closed by the process would have to finish what he was doing. So I lembreime something that I had read a few days ace this topic https://sampforum.blast.hk/showthread.php?tid=184118 by Slice (I'm a fan of the Slice) that the functions will be performed in wire and they sometimes can not be implemented until and had a part in that said when we heard the ESC so when he returned al game, then I remembered and made ​​this system. I hope you like it and it will be useful. I tested and it works. I used two public because I was only with a SetPlayerHealth GetPlayerHealth and followed and not changed because life was too fast or there was an exchange of information as stated in the topic of the slice

pawn Код:
#include <a_samp>

new timeesc[MAX_PLAYERS];

forward veresc(playerid);
forward verfesc(Float:vida,playerid);

public OnPlayerConnect(playerid)
{
    timeesc[playerid]=SetTimer("veresc",30000,true,"i",playerid);
    return 1;
}
public OnPlayerDisconnect(playerid)
{
    KillTimer(timeesc[playerid]);
    return 1;
}
public veresc(playerid)
{
    new Float:vida;
    GetPlayerHealth(playerid,vida);
    SetTimerEx("verfesc",1000,false,"fi",vida,playerid);
    SetPlayerHealth(playerid,vida - 1.0);
    return 1;
}
public verfesc(Float:vida,playerid)
{
    new Float:vidap;
    GetPlayerHealth(playerid,vidap);
    if(floatcmp(vida,vidap)==0)
    {
        SetPlayerHealth(playerid,vida);
        Kick(playerid);
        return 1;
    }
    SetPlayerHealth(playerid,vida);
    return 0;
}
Reply
#2

So this, kicks the player if he uses ESC? Nice!
I think it's good for minigames servers, to end rounds, etc.

By the way, I have a little doubt, I've never checked that: works GetPlayerHealth while I'm paused (in ESC menu for example)?

Best regards.
Reply
#3

yes work. i tested with SendClientMessage to see the health (i tested with two computers). But the health is chaged when the player back to game. so it's kick of the game, the function SetPlayerHealth is executed but not recivied for the player, making sense when he returns to heath is the same and kick player
Reply
#4

Wow nice , it's worked

EDIT: oh .. it doesn't fully work
Reply
#5

finally got a nice afk sys
looks good....havent tested
Reply
#6

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Wow nice , it's worked

EDIT: oh .. it doesn't fully work
what failed?
Reply
#7

Nice work
Reply
#8

Thank you
Reply
#9

it would be better if you can kill esc player's.
Reply
#10

why i kill esc player's? i wanna know if player is in esc menu. i don't wanna kill. but you can script it
Reply
#11

There is an easier way to check for ESC. Under a timer (preferably 1000ms, but you can do whatever you like), set a variable (something like ESC[playerid]) to 1, without a reason. Then, under OnPlayerUpdate, set the variable to 0.

Logic: OnPlayerUpdate isn't called when the player is in escape mode.

--Edit--

Example script:

pawn Код:
new ESC_Check_Timer;
new ESC[MAX_PLAYERS] = 0;
forward ESC_Check();
//OnGameModeInIt:
ESC_Check_Timer = SetTimer("ESC_Check", 1000, true);
//OnGameModeExit:
KillTimer(ESC_Check_Timer);
//OnPlayerUpdate:
ESC[playerid] = 0;
//ESC Timer:
public ESC_Check()
{
for(new i = 0, ii = GetMaxPlayers(); i < ii; i++)
{
if(IsPlayerConnected(i))
{
ESC[i] = 1;
}
}
}
Good luck, this system for AFK when ESC is also included in my AFK system thread.
Reply
#12

oh yes. i don't remember that...you use the same logic as me but in the different form.
but in my script i used one new function and check the player every 30 seconds. In your script you update a new variavel for one if the player has in esc menu and update to zero if not. every one second + the checks of OnPlayerUpdate...i think my script is lighter than your and more fast...i think
Reply
#13

Quote:
Originally Posted by DJloko
Посмотреть сообщение
what failed?
It should be called anti-alt-tab When i press esc for like a minute or so, nothing happens but when i alt-tab for 1 minute, then im kicked

And it seems you can't lower the time of the timer, i tried and when i was in class selection it already kicked me xD
Reply
#14

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
It should be called anti-alt-tab When i press esc for like a minute or so, nothing happens but when i alt-tab for 1 minute, then im kicked
i test in esc menu...and work, don't test in alt-tab

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
And it seems you can't lower the time of the timer, i tried and when i was in class selection it already kicked me xD
you can create a new variavel ( bool for example ) and assign true if you are in the class selection and false to not, when call the function to detect if the player is on the esc menu you can kick player if variavel is false
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)