/jetpack help
#1

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

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;
}
Reply
#3

i want one for onplayercommandtext please
Reply
#4

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;
}
Reply
#5

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

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

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
Reply
#8

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)