givegun command help
#2

okay its working fine, but i added isplayernearplayer, but when i try to /givegun it says " player is too far away " even if he is near me
pawn Код:
CMD:givegun(playerid,params[])
{
  new id, playerb, wam;
  if(sscanf(params, "ui", id, wam))return SendClientMessage(playerid,-1,"usage: /givegun [playerid] [bullets]");
  if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid,-1,"invalid player id!");
  if(GetPlayerWeapon(playerid) == 0)return SendClientMessage(playerid, -1, "You have no weapon in your hand you could pass!");
  if(!IsPlayerNearPlayer(playerid, playerb, 5)) return SendClientMessage(playerid, COLOR_GREY, "You are too far away from that player.");
  if(GetPlayerAmmo(playerid) < wam)return SendClientMessage(playerid,-1,"You do not have enough Munnition");
  GiveZaiatWeapon(id, GetPlayerWeapon(playerid), wam);
  SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), GetPlayerAmmo(playerid) - wam);
  new string[128], sendername[24], sendername1[24], weaponname[24];
  GetPlayerName(playerid, sendername, 24),GetPlayerName(id, sendername1, 24), GetWeaponName(GetPlayerWeapon(playerid), weaponname, 24);
  format(string, sizeof(string), "* %s has gave %s a %s with $s bullets.", NORPN(playerb), NORPN(playerid), weaponname, wam);
  SendNearbyMessage(playerid, 6, string, COLOR_LIGHTBLUE, COLOR_LIGHTBLUE, COLOR_LIGHTBLUE, COLOR_LIGHTBLUE, COLOR_LIGHTBLUE);
  /*format(string, sizeof(string), "Player %s has given you the weapon %s with %i each shot!", sendername, weaponname, wam);
  SendClientMessage(id, -1, string);
  format(string, sizeof(string), "You have the players  %s %s handed over the weapon with each shot i%",sendername1, weaponname, wam);
  SendClientMessage(playerid,COLOR_GREY,string);*/

  return 1;
}
can u help?
Reply


Messages In This Thread
givegun command help - by Rabea - 12.11.2014, 08:47
Re: givegun command help - by Rabea - 12.11.2014, 09:17
Re: givegun command help - by Ahmad45123 - 12.11.2014, 09:18
Re: givegun command help - by Rabea - 12.11.2014, 09:24
Re: givegun command help - by Rabea - 12.11.2014, 09:26
Re: givegun command help - by Quickie - 12.11.2014, 09:36
Re: givegun command help - by Rabea - 12.11.2014, 09:47

Forum Jump:


Users browsing this thread: 2 Guest(s)