Little help
#1

Hello, I'm trying to make the command /jetpack available for the person who typed it,
and for the Player ID who I want to give him.

PHP код:
CMD:jetpack(playeridparams[])
{
  new 
pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], targetidstring[128];
  if(
pInfo[playerid][Adminlevel] < 4) return SendClientMessage(playerid0xFFFFFFFF"{FF0000}[Server]: {7F7F7F} You are not authorized to use this command.");
  if(
playerid != INVALID_PLAYER_ID)
  {
    
SetPlayerSpecialAction(playeridSPECIAL_ACTION_USEJETPACK);
    
SendClientMessage(playerid0xFFFFFFFF"{FF0000}[Server]: {7F7F7F} You have spawned jetpack, You can also /jetpack [PlayerID]");
  }
  else if(
sscanf(params"u"targetid)) 
  {
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid0xFFFFFFFF"{FF0000}[Server]: {7F7F7F}Player is not connected.");
    else
    {
    
SetPlayerSpecialAction(playeridSPECIAL_ACTION_USEJETPACK);
    
GetPlayerName(targetidpNamesizeof(pName));
    
format(stringsizeof(string), "{FF0000}[Server]: {7F7F7F}You have given %s Jetpack."pName);
    
SendClientMessage(playerid0xFFFFFFFFstring);
    
GetPlayerName(playeridaNamesizeof(aName));
    
format(stringsizeof(string), "{FF0000}[Server]: {7F7F7F}Admin %s has given you Jetpack"aName);
    
SendClientMessage(targetid0xFFFFFFFFstring);
    }
  }
  return 
1;

Anyone help please?
Reply
#2

PHP код:
CMD:jetpack(playeridparams[])
{
  new 
pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], targetidstring[128];
  if(
pInfo[playerid][Adminlevel] < 4) return SendClientMessage(playerid0xFFFFFFFF"{FF0000}[Server]: {7F7F7F} You are not authorized to use this command.");
  if(
playerid != INVALID_PLAYER_ID)
  {
    
GivePlayerWeapon(playerid191);
    
SetPlayerSpecialAction(playeridSPECIAL_ACTION_USEJETPACK);
    
SendClientMessage(playerid0xFFFFFFFF"{FF0000}[Server]: {7F7F7F} You have spawned jetpack, You can also /jetpack [PlayerID]");
  }
  else if(
sscanf(params"u"targetid)) 
  {
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid0xFFFFFFFF"{FF0000}[Server]: {7F7F7F}Player is not connected.");
    else
    {
    
SetPlayerSpecialAction(targetidSPECIAL_ACTION_USEJETPACK);
        
GivePlayerWeapon(targetid191);
    
GetPlayerName(targetidpNamesizeof(pName));
    
format(stringsizeof(string), "{FF0000}[Server]: {7F7F7F}You have given %s Jetpack."pName);
    
SendClientMessage(playerid0xFFFFFFFFstring);
    
GetPlayerName(playeridaNamesizeof(aName));
    
format(stringsizeof(string), "{FF0000}[Server]: {7F7F7F}Admin %s has given you Jetpack"aName);
    
SendClientMessage(targetid0xFFFFFFFFstring);
    }
  }
  return 
1;

Reply
#3

Nope, when I typed 2 on PlayerID its still give me Jetpack.

What I want to do is to if the admin didn't typed PlayerID it will spawn jetpack for him,
and if he typed PlayerID then Jetpack should spawn for PlayerID
Reply
#4

PHP код:
CMD:jetpack(playeridparams[])
{
  new 
pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], targetidstring[128];
  if(
pInfo[playerid][Adminlevel] < 4) return SendClientMessage(playerid0xFFFFFFFF"{FF0000}[Server]: {7F7F7F} You are not authorized to use this command.");
  if(
sscanf(params"u"targetid)) 
  {
    if(!
IsPlayerConnected(targetid)) 
    {
            
GivePlayerWeapon(playerid191);
            
SetPlayerSpecialAction(playeridSPECIAL_ACTION_USEJETPACK);
            
SendClientMessage(playerid0xFFFFFFFF"{FF0000}[Server]: {7F7F7F} You have spawned jetpack, You can also /jetpack [PlayerID]");
    }
    else
    {
        
GivePlayerWeapon(targetid191);
    
SetPlayerSpecialAction(targetidSPECIAL_ACTION_USEJETPACK);
    
GetPlayerName(targetidpNamesizeof(pName));
    
format(stringsizeof(string), "{FF0000}[Server]: {7F7F7F}You have given %s Jetpack."pName);
    
SendClientMessage(playerid0xFFFFFFFFstring);
    
GetPlayerName(playeridaNamesizeof(aName));
    
format(stringsizeof(string), "{FF0000}[Server]: {7F7F7F}Admin %s has given you Jetpack"aName);
    
SendClientMessage(targetid0xFFFFFFFFstring);
    }
  }
  return 
1;

Reply
#5

Код:
CMD:jetpack(playerid, params[]) 
{ 
  	if(pInfo[playerid][Adminlevel] < 4) 
  		return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[Server]: {7F7F7F} You are not authorized to use this command."); 

  	new 
  		pName[MAX_PLAYER_NAME], 
  		aName[MAX_PLAYER_NAME], 
  		targetid, 
  		string[128]
  	;

  	if(sscanf(params, "u", targetid)) 
  	{
  		// No ID was entered
  		SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK); 
    	SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[Server]: {7F7F7F} You have spawned jetpack, You can also /jetpack [PlayerID]"); 

  		return 1;
  	}

  	// Something was entered
    if(!IsPlayerConnected(targetid)) 
    	return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[Server]: {7F7F7F}Player is not connected."); 

    // Is online:
    SetPlayerSpecialAction(targetid, SPECIAL_ACTION_USEJETPACK); 

    GetPlayerName(targetid, pName, sizeof(pName)); 
    format(string, sizeof(string), "{FF0000}[Server]: {7F7F7F}You have given %s Jetpack.", pName); 
    SendClientMessage(playerid, 0xFFFFFFFF, string); 
    
    GetPlayerName(playerid, aName, sizeof(aName)); 
    format(string, sizeof(string), "{FF0000}[Server]: {7F7F7F}Admin %s has given you Jetpack", aName); 
    SendClientMessage(targetid, 0xFFFFFFFF, string); 

 	return 1; 
}
Reply
#6

Thanks Ralfie, +rep for you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)