Something like if PlayerHoldingGun
#1

Код:
	if(strcmp(cmd, "/holster", true) == 0)
	{
  new weaponid;
  weaponid = GetPlayerWeapon(playerid);
	SetHolderWeapon(playerid,weaponid);
	GivePlayerWeapon(playerid,weaponid,0);
	return 1;

  }
Thats the code I have for now, but how can I only allow people holding any gun to use the command? And how can I remove the weapon they holstered? I tried with GivePlayerWeapon(playerid,weaponid,0), but didnt work.
Reply
#2

Quote:
Originally Posted by Mo3
Код:
	if(strcmp(cmd, "/holster", true) == 0)
	{
  new weaponid;
  weaponid = GetPlayerWeapon(playerid);
	SetHolderWeapon(playerid,weaponid);
	GivePlayerWeapon(playerid,weaponid,0);
	return 1;

  }
Thats the code I have for now, but how can I only allow people holding any gun to use the command? And how can I remove the weapon they holstered? I tried with GivePlayerWeapon(playerid,weaponid,0), but didnt work.
Huh ? What do you mean ? I didnt understand .. Please explain a bit more
Reply
#3

Iґd like to create a command like /holster and /unholster. When you use /holster, Iґd like the weapon you are holding removed and attached to your back. (Thats the code above for). BUT its only supposed to work if the players actually wears a weapon.
Reply
#4

pawn Код:
if(strcmp(cmd, "/holster", true) == 0)
    {
  new weaponid;
  weaponid = GetPlayerWeapon(playerid);
   if((weaponid >= 1 ) && (weaponid <= 42)) //i dont remember the last weapon id
    {
    SetHolderWeapon(playerid,weaponid);
    GivePlayerWeapon(playerid,weaponid,0);
    return 1;
    }

  }
SOmething like that should work
Reply
#5

Does the holstered weapon get removed from the playersґ inventory then?
Reply
#6

It will be set to 0 ammo
Reply
#7

I think he meant a function that sets a holster variable to true, something like
pawn Код:
SetHolderWeapon(playerid,weaponid,ammo)
{
  bool:PlayerHolster[playerid][weaponid]=true;
  GivePlayerWeapon(playerid,weaponid,ammo);
}

Reply
#8

Quote:
Originally Posted by MenaceX^
I think he meant a function that sets a holster variable to true, something like
pawn Код:
SetHolderWeapon(playerid,weaponid,ammo)
{
  bool:PlayerHolster[playerid][weaponid]=true;
  GivePlayerWeapon(playerid,weaponid,ammo);
}

Hmmm maybe but i still didnt get the point xD
Reply
#9

Quote:
Originally Posted by ►Peter Corneile◄ [hugu-hosting.co.uk
]
Quote:
Originally Posted by MenaceX^
I think he meant a function that sets a holster variable to true, something like
pawn Код:
SetHolderWeapon(playerid,weaponid,ammo)
{
  bool:PlayerHolster[playerid][weaponid]=true;
  GivePlayerWeapon(playerid,weaponid,ammo);
}

Hmmm maybe but i still didnt get the point xD
So do I, I have just hypothesized.
Reply
#10

Quote:
Originally Posted by MenaceX^
Quote:
Originally Posted by ►Peter Corneile◄ [hugu-hosting.co.uk
]
Quote:
Originally Posted by MenaceX^
I think he meant a function that sets a holster variable to true, something like
pawn Код:
SetHolderWeapon(playerid,weaponid,ammo)
{
  bool:PlayerHolster[playerid][weaponid]=true;
  GivePlayerWeapon(playerid,weaponid,ammo);
}

Hmmm maybe but i still didnt get the point xD
So do I, I have just hypothesized.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)