SA-MP Forums Archive
/jetpack help - 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: /jetpack help (/showthread.php?tid=423263)



/jetpack help - WiseRice - 17.03.2013

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


Respuesta: /jetpack help - Parka - 17.03.2013

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



Re: /jetpack help - WiseRice - 17.03.2013

i want one for onplayercommandtext please


Respuesta: /jetpack help - Parka - 17.03.2013

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



Re: /jetpack help - WiseRice - 17.03.2013

i want to /jetpack [playerid] i have the /jetpack but i want it so i can give to other ppl as well


Re: /jetpack help - Denying - 17.03.2013

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.


Re: /jetpack help - WiseRice - 17.03.2013

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


Respuesta: /jetpack help - Parka - 17.03.2013

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



Re: /jetpack help - Denying - 17.03.2013

Plus, make sure that the tmp size is 128 or higher.