How to make a Anti C-Bug System ! -
HY - 15.10.2014
Introduction:
--> Hello, I will show you, how to make a Anti C-Bug System ( You can't do C-BUG ) !
--> This it's a simple tutorial !
Start:
--> We need to go under :
pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
--> Something like this in pawno :
--> We find it more simple by "CTRL + F" and write in box "OnPlayerStateChange"
After that, under OnPlayerKeyStateChange, etc we need to add:
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate) // public
{ // open brackelet
if ((oldkeys KEY_FIRE) && (newkeys & KEY_CROUCH)) // if they press Left Mouse Button (key fire) and "C" button, look down
{ // open brackelet
new weapon = GetPlayerWeapon(playerid); // will get his weapon (deagle in our case)
if(weapon == 24) // ID 24 = Deagle, change in what C-Bug gun do you want !
{ // open brackelet *2
ApplyAnimation(playerid,"GYMNASIUM","gym_tread_falloff",1.0,0,0,0,0,0); // will apply a animation, wich he will fall down !
GameTextForPlayer(playerid, "~r~Stop c-bug !", 5000, 1); // he will saw on screen "Stop C-Bug" and will remove his deagle (gun)
} // close brackelet
} // close brackelet *2
return 1; // return value
} // close last brackelet *3
--> Something like this in pawno (all code) :
Last Words:
--> It's a simple tutorial, for newbies I think it's usefull !
--> Don't judge me if you don't like, just leave the thread !
Re: How to make a Anti C-Bug System ! -
Abagail - 16.10.2014
You put OnPlayerStateChange in some places, - yet you use oldkeys, and newkeys which would give undefined symbol errors. You want to use OnPlayerKEYStateChange.
Re: How to make a Anti C-Bug System ! -
Th3UnKnOwN - 19.10.2014
Code:
C:\Users\PhantoM21\Desktop\Cops and Robbers\gamemodes\CNR.pwn(492) : error 012: invalid function call, not a valid address
C:\Users\PhantoM21\Desktop\Cops and Robbers\gamemodes\CNR.pwn(492) : error 029: invalid expression, assumed zero
C:\Users\PhantoM21\Desktop\Cops and Robbers\gamemodes\CNR.pwn(492) : error 029: invalid expression, assumed zero
C:\Users\PhantoM21\Desktop\Cops and Robbers\gamemodes\CNR.pwn(492) : fatal error 107: too many error messages on one line
Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((oldkeys KEY_FIRE) && (newkeys & KEY_CROUCH)) //<--- Line 492
{
new weapon = GetPlayerWeapon(playerid);
if(weapon == 24)
{
ApplyAnimation(playerid,"GYMNASIUM","gym_tread_falloff",1.0,0,0,0,0,0);
GameTextForPlayer(playerid, "~r~Stop c-bug !", 5000, 1);
}
}
return 1;
}
Re: How to make a Anti C-Bug System ! -
Glossy42O - 19.10.2014
PHP Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((oldkeys & KEY_FIRE) && (newkeys & KEY_CROUCH)) //<--- Line 492
{
new weapon = GetPlayerWeapon(playerid);
if(weapon == 24)
{
ApplyAnimation(playerid,"GYMNASIUM","gym_tread_falloff",1.0,0,0,0,0,0);
GameTextForPlayer(playerid, "~r~Stop c-bug !", 5000, 1);
}
}
return 1;
}
Re: How to make a Anti C-Bug System ! -
Rudy_ - 19.10.2014
Topic name is wrong, It should be
' How to make
an Anti C-Bug System ! '
Re: How to make a Anti C-Bug System ! -
TwinkiDaBoss - 21.10.2014
Its okay but it will glitch. Lets say for example that you are shooting and you press C key once and continue shooting it will detect it as Cbugging. Add a check or such that will add up to certain variable when they do that action. If variable lets say reaches 2-3 times in maximum of 6-7 seconds then detect it as C-bug.
Its a nice tutorial but I think you rushed it a bit. You messed up at few places, like it was asked before, why did you use OnPlayerStateChange? You are detecting player keys, not detecting their movement or such.
Respuesta: How to make a Anti C-Bug System ! -
aoEXE - 21.10.2014
this is better
pawn Code:
if((newkeys & (KEY_FIRE | KEY_CROUCH)) == (KEY_FIRE | KEY_CROUCH) && (oldkeys & (KEY_FIRE | KEY_CROUCH)) != (KEY_FIRE | KEY_CROUCH))
source
OnPlayerKeyStateChange
Re: Respuesta: How to make a Anti C-Bug System ! -
Crayder - 22.10.2014
Quote:
Originally Posted by aoEXE
this is better
pawn Code:
if((newkeys & (KEY_FIRE | KEY_CROUCH)) == (KEY_FIRE | KEY_CROUCH) && (oldkeys & (KEY_FIRE | KEY_CROUCH)) != (KEY_FIRE | KEY_CROUCH))
source OnPlayerKeyStateChange
|
Even better use the keystate defines,
pawn Code:
if(PRESSED(KEY_FIRE | KEY_CROUCH))
This is still quite glitchy, can be improved...
Respuesta: How to make a Anti C-Bug System ! -
aoEXE - 22.10.2014
Precisely why I added the link, I put the code to be understood. Add a define does not explain, the post can be read.
The glitchy can be fixed with variables