/wcheck
#1

Yo guys, I go this /wcheck so that admins can know what weapons they have and how much ammo they have on them but the problem is it only says the Weapon ID, so the admin has to look at the weapon IDs to see what gun they have. Can you please help me change the command so that it says the name of the gun as well.

Код:
	if(strcmp(cmd, "/wcheck", true) == 0)
	{
		if (PlayerInfo[playerid][pAdmin] < 1)
	  {
		  SendClientMessage(playerid, COLOR_GREY, "You are not authorized");
		  return 1;
	  }
		tmp = strtok(cmdtext,idx);
		if (!strlen(tmp))
	  {
		  SendClientMessage(playerid, COLOR_GREY, "[USAGE] /wcheck [playerid/partOfName]");
		  return 1;
	  }
		giveplayerid = ReturnUser(tmp);
		if (giveplayerid == INVALID_PLAYER_ID)
	  {
		  SendClientMessage(playerid, COLOR_GREY, "That player is offline");
		  return 1;
	  }
		new sweapon, sammo;
		new giveplayer[MAX_PLAYER_NAME];
	  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
	  format(string, sizeof(string), "%s has the following weapons:", giveplayer);
	  SendClientMessage(playerid, COLOR_YELLOW, string);
		for (new i=0; i<9; i++)
	  {
		  GetPlayerWeaponData(giveplayerid, i, sweapon, sammo);
		  if(sweapon != 0)
		  {
		    format(string, sizeof(string), "%d: %d (%d)", i, sweapon, sammo);
		  	SendClientMessage(playerid, COLOR_GREY, string);
			}
	  }
		return 1;
	}
Reply
#2

https://sampwiki.blast.hk/wiki/GetWeaponName
Reply
#3

Код:
	if(strcmp(cmd, "/wcheck", true) == 0)
	{
		if (PlayerInfo[playerid][pAdmin] < 1)
		{
			SendClientMessage(playerid, COLOR_GREY, "You are not authorized");
			return 1;
		}
		tmp = strtok(cmdtext,idx);
		if (!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_GREY, "[USAGE] /wcheck [playerid/partOfName]");
			return 1;
		}
		giveplayerid = ReturnUser(tmp);
		if(giveplayerid == INVALID_PLAYER_ID)
		{
			SendClientMessage(playerid, COLOR_GREY, "That player is offline");
			return 1;
		}
		new sweapon, sammo, wname[32];
		new giveplayer[MAX_PLAYER_NAME];
		GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
		format(string, sizeof(string), "%s has the following weapons:", giveplayer);
		SendClientMessage(playerid, COLOR_YELLOW, string);
		for(new i=0; i<13; i++)
		{
			GetPlayerWeaponData(giveplayerid, i, sweapon, sammo);
			GetWeaponName(sweapon, wname,32);
			if(sweapon != 0)
			{
				format(string, sizeof(string), "Slot: %d, WName: %s, WID: %d, Ammo: (%d)", i, wname, sweapon, sammo);
				SendClientMessage(playerid, COLOR_GREY, string);
			}
		}
		return 1;
	}
Reply
#4

Thanks alot guys :P
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)