SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 17/03/2013, 06:48 AM   #1
WiseRice
Big Clucker
 
WiseRice's Avatar
 
Join Date: Dec 2012
Location: In the Milky-Way
Posts: 135
Reputation: -10
Exclamation /jetpack help

Code:
if(strcmp(cmdtext,"/jetpack",true) == 0)
	{
		if(PlayerInfo[playerid][pAdmin] == 3 || PlayerInfo[playerid][pAdmin] == 4 || PlayerInfo[playerid][pAdmin] == 5 || PlayerInfo[playerid][pAdmin] == 6 || PlayerInfo[playerid][pAdmin] == 1337 || PlayerInfo[playerid][pAdmin] == 1338 )
		{
			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, "* You Have Spawned A Jetpack");
		}
		else
		{
			SendClientMessage(playerid, 0xAA0000AA, "You Are Not Authorized To Use This Command!");
		}
		return 1;
	}
i want to give jetpack to player id so /jetpack [playerid] can someone help please
WiseRice is offline   Reply With Quote
Old 17/03/2013, 06:52 AM   #2
Parka
High-roller
 
Parka's Avatar
 
Join Date: Aug 2011
Location: Argentina
Posts: 1,666
Reputation: 318
Default Respuesta: /jetpack help

pawn Code:
CMD:jetpack(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
    if( sscanf( params, "u", params[0] ) )
    {
    SetPlayerSpecialAction(playerid, 2);
    }
    else
    {
    SetPlayerSpecialAction(params[0], 2);
    SendClientMessageEx(params[0] , COLOR_BLUE ," admin %s you gave a jetpack"  , Name(playerid) );
    }
    } else return SendClientMessage(playerid, COLOR_RED , "you are not an administrator with sufficient level to use this command");
    return 1;
}
Parka is offline   Reply With Quote
Old 17/03/2013, 06:52 AM   #3
WiseRice
Big Clucker
 
WiseRice's Avatar
 
Join Date: Dec 2012
Location: In the Milky-Way
Posts: 135
Reputation: -10
Default Re: /jetpack help

i want one for onplayercommandtext please
WiseRice is offline   Reply With Quote
Old 17/03/2013, 07:01 AM   #4
Parka
High-roller
 
Parka's Avatar
 
Join Date: Aug 2011
Location: Argentina
Posts: 1,666
Reputation: 318
Default Respuesta: /jetpack help

pawn Code:
if(strcmp(cmd, "/jetpack", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
    new tmp[256], forplayerid;
    tmp = strtok(cmdtext, idx);
   
    if(!strlen(tmp))
    {
    SetPlayerSpecialAction(playerid, 2);
    return 1;
    }
   
    forplayerid = strval(tmp);
    SetPlayerSpecialAction(forplayerid, 2);
    }
    return 1;
}
Parka is offline   Reply With Quote
Old 17/03/2013, 07:45 AM   #5
WiseRice
Big Clucker
 
WiseRice's Avatar
 
Join Date: Dec 2012
Location: In the Milky-Way
Posts: 135
Reputation: -10
Default Re: /jetpack help

i want to /jetpack [playerid] i have the /jetpack but i want it so i can give to other ppl as well
WiseRice is offline   Reply With Quote
Old 17/03/2013, 07:49 AM   #6
Denying
Gangsta
 
Join Date: Feb 2013
Posts: 541
Reputation: 13
Default Re: /jetpack help

pawn Code:
if(strcmp("/jetpack", cmdtext, true) == 0)
{
    new tmp[128];
    tmp = strtok(cmdtext, idx);
    SetPlayerSpecialAction(strval(tmp), 2);
    return 1;
}

You need the strtok function to use this.
Denying is offline   Reply With Quote
Old 17/03/2013, 08:10 AM   #7
WiseRice
Big Clucker
 
WiseRice's Avatar
 
Join Date: Dec 2012
Location: In the Milky-Way
Posts: 135
Reputation: -10
Default Re: /jetpack help

Quote:
C:\Users\Andrew\Desktop\GTA Server iRealLife\iRealLife\gamemodes\larp.pwn(24489) : warning 219: local variable "tmp" shadows a variable at a preceding level
help please
WiseRice is offline   Reply With Quote
Old 17/03/2013, 08:23 AM   #8
Parka
High-roller
 
Parka's Avatar
 
Join Date: Aug 2011
Location: Argentina
Posts: 1,666
Reputation: 318
Default Respuesta: /jetpack help

pawn Code:
if(strcmp("/jetpack", cmdtext, true) == 0)
{
    tmp = strtok(cmdtext, idx);
    SetPlayerSpecialAction(strval(tmp), 2);
    return 1;
}
Parka is offline   Reply With Quote
Old 17/03/2013, 08:38 AM   #9
Denying
Gangsta
 
Join Date: Feb 2013
Posts: 541
Reputation: 13
Default Re: /jetpack help

Plus, make sure that the tmp size is 128 or higher.
Denying is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Jetpack Neil. Scripting Help 6 23/01/2013 01:30 PM
Jetpack Edin Black Scripting Help 5 09/05/2012 02:57 PM
About JetPack... MasterJoker Scripting Help 18 29/01/2012 02:54 AM
/jetpack Garc1a Help Archive 2 30/10/2010 12:39 AM
Jetpack FreeSoul Help Archive 2 09/05/2009 09:23 AM


All times are GMT. The time now is 09:42 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.