Remove Jetpack
#1

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.
Reply
#2

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;

Reply
#3

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?
Reply
#4

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))) 
Reply
#5

Thanks, Rep++ ^.^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)