Need tip for anti-gun system
#1

Hello guys. So i need a little tip for my anti-gun system. Right now i have anti-gun placed in OnPlayerKeyStateChange. I mean.. when player trying to shoot (KEY_FIRE) weapon been removed. But some players bypass this system and can shoot before system disarms him. I was thinking to use timer to check is player have a weapon, but i think that way will use many memory, becouse timer will be about 500ms. (then player not able to shoot).

So, what way can i use to create anti-gun system without a timer which use many memory and state change?

Help pls

P.S. Sorry for my bad english.
Reply
#2

it shouldn't take long for the server to check if they have the forbidden weapon in their hand.
it will be done in milliseconds, but note that the more the ping the more ms to transferee the data between the client and the server.
Reply
#3

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
it shouldn't take long for the server to check if they have the forbidden weapon in their hand.
it will be done in milliseconds, but note that the more the ping the more ms to transferee the data between the client and the server.
Nonono. I mean now system disarms only when player shoots (KEY_FIRE), not when the weapon in his hands. So players sometimes can shoot.
Do you advice to use timer and callback to disarm player when found weapon in his hands?
Reply
#4

if that is the only way yes,
anoter way its under OnPlayerUpdate and do a fucntion to get the time so it only works like 1 sec timer
pawn Код:
new time = gettime();
    if(GetPVarInt(playerid,"LastCheck") < time)
    {
        //1 second intervals
        SetPVarInt(playerid,"LastCheck",time);
        return 1;//so it does 1 check max on every OnPlayerUdate called
    }
Reply
#5

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
if that is the only way yes,
anoter way its under OnPlayerUpdate and do a fucntion to get the time so it only works like 1 sec timer
pawn Код:
new time = gettime();
    if(GetPVarInt(playerid,"LastCheck") < time)
    {
        //1 second intervals
        SetPVarInt(playerid,"LastCheck",time);
        return 1;//so it does 1 check max on every OnPlayerUdate called
    }
But am i wrong, that onplayerupdate callback refreshes couple thousands times per second?
Reply
#6

currect but the code calls only 1 time in OnPlayerUpdate
like i said
so it does 1 check max on every OnPlayerUdate called
Reply
#7

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
currect but the code calls only 1 time in OnPlayerUpdate
like i said
so it does 1 check max on every OnPlayerUdate called
Okay, thank you very much
Reply
#8

Use the include from this page:
http://forum.sa-mp.com/showthread.ph...ti+weapon+hack

Works good.
Reply
#9

Or you could add SetPlayerArmedWeapon(playerid, 0) Under OnplayerUpdate..!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)