SA-MP Forums Archive
Jetpack Command - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Jetpack Command (/showthread.php?tid=276143)



Jetpack Command - Ltz-boy - 12.08.2011

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;
    } 



Re: Jetpack Command - [MG]Dimi - 12.08.2011

Post jetpack command


Re: Jetpack Command - Ltz-boy - 12.08.2011

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;
    } 



Re: Jetpack Command - [MG]Dimi - 12.08.2011

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



- Ltz-boy - 12.08.2011

On the remove jetpack or the other one?

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


Re: Jetpack Command - [MG]Dimi - 12.08.2011

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


Re: Jetpack Command - Ltz-boy - 12.08.2011

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] ?


Re: Jetpack Command - grand.Theft.Otto - 12.08.2011

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.


Re: Jetpack Command - Ltz-boy - 12.08.2011

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


Re: Jetpack Command - grand.Theft.Otto - 12.08.2011

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!");
}