Equip?
#1

Aye i need help i wanted to do stuff like /armyequip that gives that ammount and that in the pos i want and i dunnoh how to do it could anyone help me?
Reply
#2

Can you help me & put this in understandable English?
Reply
#3

Okay well now what i mean is to do a command only for a faction. Something like cops do duty but in other and smaller way so like

when im the position where i want to do /armyequip it will give me like 3 weapons
Reply
#4

Top of the script:
pawn Код:
#define ARMY_POSITION 123.0, 123.0, 123.0 // Your coords here.
Command:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/armyequip", true) == 0)
  {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, ARMY_POSITION)) // You can change the range from 3.0 to anything you'd like.
    {
      GivePlayerWeapon(playerid, 24, 100); // Give deagle with 100 ammo.
      GivePlayerWeapon(playerid, 29, 300); // Give MP5 with 300 ammo.
      GivePlayerWeapon(playerid, 31, 400); // Give M4 with 400 ammo.
      return SendClientMessage(playerid, 0xFFFFFFFF, "You got the weapons.");
    }
    return SendClientMessage(playerid, 0xFFFFFFFF, "You're not at the army position.");
  }
  return 1;
}
Reply
#5

yep thanks mate
Reply
#6

Quote:
Originally Posted by Finn
Top of the script:
pawn Код:
#define ARMY_POSITION 123.0, 123.0, 123.0 // Your coords here.
Command:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/armyequip", true) == 0)
  {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, ARMY_POSITION)) // You can change the range from 3.0 to anything you'd like.
    {
      GivePlayerWeapon(playerid, 24, 100); // Give deagle with 100 ammo.
      GivePlayerWeapon(playerid, 29, 300); // Give MP5 with 300 ammo.
      GivePlayerWeapon(playerid, 31, 400); // Give M4 with 400 ammo.
      return SendClientMessage(playerid, 0xFFFFFFFF, "You got the weapons.");
    }
    return SendClientMessage(playerid, 0xFFFFFFFF, "You're not at the army position.");
  }
  return 1;
}
Why so many returns?
Reply
#7

am and i got a problem

error 047: array sizes do not match, or destination array is too small

is it bad?
Reply
#8

Quote:
Originally Posted by MenaceX^
Why so many returns?
What do you mean?
Reply
#9

Quote:
Originally Posted by Finn
Quote:
Originally Posted by MenaceX^
Why so many returns?
What do you mean?
You have unnecessary returns. This would be enough:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/armyequip", true) == 0)
  {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, ARMY_POSITION)) // You can change the range from 3.0 to anything you'd like.
    {
      GivePlayerWeapon(playerid, 24, 100); // Give deagle with 100 ammo.
      GivePlayerWeapon(playerid, 29, 300); // Give MP5 with 300 ammo.
      GivePlayerWeapon(playerid, 31, 400); // Give M4 with 400 ammo.
      SendClientMessage(playerid, 0xFFFFFFFF, "You got the weapons.");
    }
    else SendClientMessage(playerid, 0xFFFFFFFF, "You're not at the army position.");
  }
  return 1;
}
Reply
#10

Quote:
Originally Posted by ∈ⅹitus
You have unnecessary returns. This would be enough:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/armyequip", true) == 0)
  {
    if(IsPlayerInRangeOfPoint(playerid, 3.0, ARMY_POSITION)) // You can change the range from 3.0 to anything you'd like.
    {
      GivePlayerWeapon(playerid, 24, 100); // Give deagle with 100 ammo.
      GivePlayerWeapon(playerid, 29, 300); // Give MP5 with 300 ammo.
      GivePlayerWeapon(playerid, 31, 400); // Give M4 with 400 ammo.
      SendClientMessage(playerid, 0xFFFFFFFF, "You got the weapons.");
    }
    else SendClientMessage(playerid, 0xFFFFFFFF, "You're not at the army position.");
  }
  return 1;
}
Looks better in my eyes with the 'unnecessary' returns.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)