Give gun question.
#1

Hello, I have this command which makes the player give another with /give gun [playerid] [amount]

How do i remove the amount the player can give so it just be /give gun [playerid] and it gives the whole gun to him?


Код:
			if(strcmp(x_nr,"gun",true) == 0)
			{
			    tmp = strtok(cmdtext, idx);
			    if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /give gun [playerid/PartOfName] [amount]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
				        new Float:x, Float:y, Float:z;
			            GetPlayerPos(giveplayerid,x,y,z);
				        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			            if(!IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
			            {
			                SendClientMessage(playerid, COLOR_GRAD1, "** Player is not near you!");
			                return 1;
			            }
						tmp = strtok(cmdtext, idx);
						if(!strlen(tmp))
						{
							SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /give gun [playerid/PartOfName] [amount]");
							return 1;
						}
						new sammo = GetPlayerAmmo(playerid);
						new weapon = GetPlayerWeapon(playerid);
						new ammo = strval(tmp);
						if(ammo > sammo)
						{
							SendClientMessage(playerid, COLOR_GREY, "* You don't have so many bullets.");
							return 1;
						}
						SafeGivePlayerWeapon(giveplayerid, weapon, ammo);
						SafeGivePlayerWeapon(playerid, weapon, -ammo);
						if(PlayerInfo[playerid][pSex] == 1)
						{
							format(string, sizeof(string), "* %s takes out his weapon and hands it to %s with %d bullets.", sendername, giveplayer, ammo);
						}
						else
						{
							format(string, sizeof(string), "* %s takes out her weapon and hands it to %s with %d bullets.", sendername, giveplayer, ammo);
						}
						ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
				        new y1, m, d;
						new h,mi,s;
						getdate(y1,m,d);
						gettime(h,mi,s);
						format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /give gun %s %d",d,m,y1,h,mi,s,sendername,giveplayer, ammo);
						CommandLog(string);
					}
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GRAD1, "   Player is Offline!");
				    return 1;
				}
			}
Reply
#2

Bump, Any ideas?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)