Anti jetpack - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Anti jetpack (
/showthread.php?tid=663378)
Anti jetpack -
SymonClash - 29.01.2019
So, i made a little anti jetpack system where players if spawn a jetpack they'll be banned.
I've added a bool:
ServerJetpack.
Where i set to true if i give manually a jetpack to player with SetPlayerSpecialAction.
The sistem works, if i give manually a jetpack to a player, they don't get banned, BUT.
If they remove their manually given jetpack and they get it again, they'll be banned.
How to avoid this?
Re: Anti jetpack -
Nathan94 - 29.01.2019
How do you detect the player removing their jetpack?
Re: Anti jetpack -
SymonClash - 30.01.2019
I don't, because i don't know how to do it.
Re: Anti jetpack -
Kaliber - 30.01.2019
Actually you have 2 simple solutions:
1. You could simple remove the jetpack completly, if he presses return. (so he cant get it on again)
2. You check if he gets a new jetpack, and if its in the range of the old position..it is okay again.
Re: Anti jetpack -
SymonClash - 30.01.2019
Can you give me an example on how to do the first solution? Seems more simple and faster.
Re: Anti jetpack -
Kaliber - 30.01.2019
Just something like this:
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_SECONDARY_ATTACK) && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z),SetPlayerPos(playerid, X, Y, Z);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
return 1;
}
Re: Anti jetpack -
Florin48 - 30.01.2019
solved?
Re: Anti jetpack -
SymonClash - 30.01.2019
Quote:
Originally Posted by Kaliber
Just something like this:
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_SECONDARY_ATTACK) && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z),SetPlayerPos(playerid, X, Y, Z);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
return 1;
}
|
Ok but where do i place the ServerJetpack bool to check it?
Quote:
Originally Posted by Florin48
solved?
|
Not yet.
Re: Anti jetpack -
Kaliber - 30.01.2019
Quote:
Ok but where do i place the ServerJetpack bool to check it?
|
You can set it there to false, because there he will loose the jetpack.
Re: Anti jetpack -
Florin48 - 30.01.2019
you could make Jetpack for as long as you want and when it's time to get jetpack gets kicked.