SA-MP Forums Archive
Remove 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: Remove Jetpack (/showthread.php?tid=588785)



Remove Jetpack - AnnaSB - 12.09.2015

Hi, I have a problem with adding an removing jetpacks.
As it goes, I add the jetpack without any problem (Special Action).
But the user has some options to remove it, they can use the Eject command (which ejects them high a meter), or they can use the RETURN button.
The Eject button is all okay, because no trace will remain and further steps can be carried by the AntiHack engine to detect hackers safely, but the RETURN button leaves a pickup for the player to regain the jetpack.
However the jetpack is unavailable for other players, the AntiHack engine will be unable to detect if the player is accessing her own jetpack pickup or it's a hack.
Any idea how to remove the pickup? or detect if the player is using the pickup?
Thanks.


Re: Remove Jetpack - Michael B - 12.09.2015

Try this out:

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if (
PRESSED(KEY_SECONDARY_ATTACK)) && if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
    {
        new 
Float:XFloat:YFloat:Z
        
GetPlayerPos(playeridXYZ); 
        
SetPlayerPos(playeridXYZ); 
        
SetPlayerSpecialAction(playeridSPECIAL_ACTION_NONE); 
        
SendClientMessage(playerid, -1"Your jetpack has been removed!."); 
    }
    return 
1;




Re: Remove Jetpack - AnnaSB - 12.09.2015

Quote:
Originally Posted by Michael B
Посмотреть сообщение
Try this out:

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if (
PRESSED(KEY_SECONDARY_ATTACK)) && if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
    {
        new 
Float:XFloat:YFloat:Z
        
GetPlayerPos(playeridXYZ); 
        
SetPlayerPos(playeridXYZ); 
        
SetPlayerSpecialAction(playeridSPECIAL_ACTION_NONE); 
        
SendClientMessage(playerid, -1"Your jetpack has been removed!."); 
    }
    return 
1;

Oh thanks a lot, seems a nice idea if the network lag doesn't interrupt us, anyway, PRESSED? Why is that needed?


Re: Remove Jetpack - Michael B - 12.09.2015

That is to determinate if the player is either pressing, holding or releasing a key.
You have to define this, by the way:

PHP код:
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 



Re: Remove Jetpack - AnnaSB - 12.09.2015

Thanks, Rep++ ^.^