Need tip for anti-gun system -
beasty - 14.01.2013
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.
Re: Need tip for anti-gun system -
park4bmx - 14.01.2013
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.
Re: Need tip for anti-gun system -
beasty - 14.01.2013
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?
Re: Need tip for anti-gun system -
park4bmx - 14.01.2013
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
}
Re: Need tip for anti-gun system -
beasty - 14.01.2013
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?
Re: Need tip for anti-gun system -
park4bmx - 14.01.2013
currect but the code calls only 1 time in OnPlayerUpdate
like i said
so it does 1 check max on every OnPlayerUdate called
Re: Need tip for anti-gun system -
beasty - 14.01.2013
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
Re: Need tip for anti-gun system -
Spicey - 14.01.2013
Use the include from this page:
http://forum.sa-mp.com/showthread.ph...ti+weapon+hack
Works good.
Re: Need tip for anti-gun system -
RajatPawar - 14.01.2013
Or you could add SetPlayerArmedWeapon(playerid, 0) Under OnplayerUpdate..!