/givegun (not admin cmd)
#1

Код:
dcmd_givegun(playerid, params[])
{
	new wep,player;
 	if(sscanf(params, "ud", player,wep)) return SCM(playerid, CMD, "Usage: /givegun [PlayerName/ID] [Weapon ID]");
 	if(wep == 38 || wep == 35 || wep == 36 || wep == 37 || wep == 9 || wep == 26 || wep == 39) return 1;
 	new weapons[13][2];
	for (new i = 0; i < 13; i++)
	{
  GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
	if(wep != weapons[i][0])
	{
	  SCM(playerid,LIGHTRED,"You don't have that weapon.");
	}
	else
	{
	  GivePlayerWeapon(player, wep, weapons[i][1]);
	}
	}
 	return 1;
}
I failed. I wanted to check for "wep" if he has it and give it to some player.
Result: spam + doesnt get a gun
Reply
#2

bump
Reply
#3

Bump please help. I dont know what to do anymore.
Reply
#4

Nvm I got it wrong. Sorry
Reply
#5

Quote:
Originally Posted by Seif_
Quote:
Originally Posted by Rules
b) Do not bump
Some people apparently think they are important enough to bump their own topic after 10 minutes.
You can bump topics when the last reply is at least 12 hours old.
You're not being clear enough.
I am not ??

-/givegun [ID] [Gun]

It is a rp command for players to give their guns to others. I am using GetPlayerWeaponDate to check if that player has the [Gun] he entered into the command.

Reply
#6

Well, why you don't just use getplayerweapon?
So he have to scroll the weapon that he wants to give.
And u can use this:
Код:
 stock RemovePlayerWeapon(playerid, weaponid)
{
  new plyWeapons[12];
  new plyAmmo[12];
  for(new slot = 0; slot != 12; slot++)
  {
    new wep, ammo;
    GetPlayerWeaponData(playerid, slot, wep, ammo);
    if(wep != weaponid)
    {
      GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
    }
  }
  ResetPlayerWeapons(playerid);
  for(new slot = 0; slot != 12; slot++)
  {
    GivePlayerWeapon(playerid, plyWeapons[slot], MAX_AMMO);
  }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)