Jetpack Command
#1

Hey everyone.

I have just made an Jetpack command, but I want to do so I can remove it also. I got one command, but after some few secounds the jetpack spawns again.
Here is the code to remove:

PHP код:
if(strcmp(cmdtext,"/rjetpack",true) == 0// By Ltzboy
    
{
        if(
PlayerInfo[playerid][pAdmin] == 1338)
        {
         new 
Float:XFloat:YFloat:Z;
        
GetPlayerPos(playeridXYZ);
        
SetPlayerPos(playeridXYZ);
        
SetPlayerSpecialAction(playeridSPECIAL_ACTION_NONE);
        
SendClientMessage(playeridRED"Jetpack Removed.");
        }
        else
        {
                  
SendClientMessage(playerid0xAA0000AA"You Have To Be A Level 1338 Admin To Use This!");
        }
        return 
1;
    } 
Reply
#2

Post jetpack command
Reply
#3

Here it is:

PHP код:
if(strcmp(cmdtext,"/jetpack",true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] == 1338 )
        {
        new 
Float:X,Float:Y,Float:Z;
        
GetPlayerPos(playerid,X,Y,Z);
        
SetPlayerPos(playeridXYZ);
        
CreatePickup(370,2,X,Y,Z);
        
SendClientMessage(playeridCOLOR_GREY"* Spawned Jetpack");
        }
        else
        {
              
SendClientMessage(playerid0xAA0000AA"You Have To Be A Level 1338 Admin To Use This!");
        }
        return 
1;
    } 
Reply
#4

Maybe coz you used Create Pickup?
replace
PHP код:
CreatePickup(370,2,X,Y,Z); 
with
PHP код:
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK); 
Reply
#5

On the remove jetpack or the other one?

Is it possible to make it dissapear automaticly when you take it off?
Reply
#6

Remove CreatePickup from command to spawn jetpack and add my code
PHP код:
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK); 
Don't touch /rjetpack
Reply
#7

Okay, thanks. It worked!

Do you know how I can make the command so I can put jetpack on others, instead of my self? Like /jetpack [ID] and /rjetpack [ID] ?
Reply
#8

I made this so you can give it to a player..

pawn Код:
if(strcmp(cmdtext,"/jetpack",true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] == 1338)
    {
        if(isnull(cmdtext))
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            SetPlayerPos(playerid, X, Y, Z);
            SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
            SendClientMessage(playerid, COLOR_GREY, "* Spawned Jetpack For Yourself. You Can Also Do /jetpack [id].");
        }
        else
        {
            new id, string[128], aname[24], pname[24];
           
            id = strval(cmdtext);
           
            if(!strlen(cmdtext)) return SendClientMessage(playerid, COLOR, "USAGE:  /jetpack [id] - Enter A Valid Player ID.");
           
            GetPlayerName(playerid,aname,24); // admin name
            GetPlayerName(id,pname,24); // player name

            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            SetPlayerPos(playerid, X, Y, Z);
            SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
           
            format(string,128,"You Have Given  %s (%d)  A Jetpack.",pname,id); SendClientMessage(playerid, COLOR, string);
            format(string,128,"Administrator  %s (%d)  Has Given You A Jetpack.",aname,playerid); SendClientMessage(id, COLOR, string);
            return 1;
        }
    } else return SendClientMessage(playerid, 0xAA0000AA, "You Have To Be A Level 1338 Admin To Use This!");
}
If you don't have isnull defined, add it to the top of your script.

pawn Код:
#define isnull(%1) \
    ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
This is UNTESTED.
Reply
#9

Thank you very much! Ill try it! Is it possible to make a remove jetpack command also?
Reply
#10

By default, if you stand on the ground and press enter, it will automatically remove it (GTA SA Default).

But here is an untested command to remove it:

pawn Код:
if(strcmp(cmdtext,"/rjetpack",true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] == 1338)
    {
        if(isnull(cmdtext))
        {
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            SetPlayerPos(playerid, X, Y, Z);
            SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
            SendClientMessage(playerid, COLOR_GREY, "* Removed Jetpack From Yourself. You Can Also Do /rjetpack [id].");
        }
        else
        {
            new id, string[128], aname[24], pname[24];
           
            id = strval(cmdtext);
           
            if(!strlen(cmdtext)) return SendClientMessage(playerid, COLOR, "USAGE:  /rjetpack [id] - Enter A Valid Player ID.");
           
            GetPlayerName(playerid,aname,24); // admin name
            GetPlayerName(id,pname,24); // player name

            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid,X,Y,Z);
            SetPlayerPos(playerid, X, Y, Z);
            SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
           
            format(string,128,"You Have Removed  %s (%d)'s  Jetpack.",pname,id); SendClientMessage(playerid, COLOR, string);
            format(string,128,"Administrator  %s (%d)  Has Removed Your Jetpack.",aname,playerid); SendClientMessage(id, COLOR, string);
            return 1;
        }
    } else return SendClientMessage(playerid, 0xAA0000AA, "You Have To Be A Level 1338 Admin To Use This!");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)