Jump to content
  • 0

Un bug la fdrugs si fmats


Ch1NeZu

Question

Salut am pe srv un deposit de drugs/materials dar am un bug la el.... de ex:

Am la mine 6 grame de  droguri si ma duc si pun 1 gram de drog in deposit iar cand scot nu se goleste depositul adik pot sa scot din 1 gram de drog cat vreau eu si 100 , si la materiale la fel...... ce trb facut ? :((

Si sunt sigur ca nu e doar 1 bug in acest cod credk sunt mai multe va rog uitativa si facetil va multumesc...! aveti +1 de la mine daca ma ajutati

Acesta e codul

//---------------------------------[F-DEPOSIT-SITEM]-------------------------------------
	if(strcmp(cmd, "/fdrugs", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(IsAMember(playerid))
	        {
				new x;
				x = PlayerInfo[playerid][pMember] + PlayerInfo[playerid][pLeader];
	            if(PlayerInfo[playerid][pRank] < 3)
	            {
	                SCM(playerid, COLOR_GREY, "   You need to be Rank 2 or Higher for this action !");
	                return 1;
	            }
	            /*if(DynamicFactions[x][fSafe] <= 0)
				{
					SCM(playerid, COLOR_WHITE, "The leader must buy a SAFE first !");
					return 1;
				}*/
	            new x_nr[256];
				x_nr = strtok(cmdtext, idx);
				if(!strlen(x_nr))
				{
					if(PTP(5.0,playerid,DynamicFactions[x][fX],DynamicFactions[x][fY],DynamicFactions[x][fZ]))
					{
						format(string, sizeof(string), "Faction Drugs: $%d.", DynamicFactions[x][fDrugs]);
						SCM(playerid, COLOR_WHITE, string);
					}
					SCM(playerid, COLOR_WHITE, "|______________________FactionsDrugs___________________|");
					SCM(playerid, COLOR_WHITE, "| USAGE: /fdrugs [name] [ammount]");
			  		SCM(playerid, COLOR_GREY, " | Available names: Take , Put");
					SCM(playerid, COLOR_WHITE, "|______________________________________________________|");
					return 1;
				}
				GetPlayerName(playerid, sendername, sizeof(sendername));
				GetPlayerName(giveplayerid, playername, sizeof(playername));
			    if(strcmp(x_nr,"take",true) == 0)
				{
					tmp = strtok(cmdtext, idx);
					if(!strlen(tmp))
					{
						SCM(playerid, COLOR_GREY, "[USAGE:] /fdrugs take [amount]");
						return 1;
					}
					new materialsdeposit = strval(tmp);
					if(!strlen(tmp))
					{
						SCM(playerid, COLOR_GREY, "[USAGE:] /fdrugs take [amount]");
						return 1;
					}
					if(PTP(5.0,playerid,DynamicFactions[x][fX],DynamicFactions[x][fY],DynamicFactions[x][fZ]))
					{
					    if(materialsdeposit <=DynamicFactions[x][fDrugs])
					    {
							PlayerInfo[playerid][pDrugs] += materialsdeposit;
							DynamicFactions[x][fDrugs]=DynamicFactions[x][fDrugs]-materialsdeposit;
							format(string, sizeof(string), "You have taken %d drugs from the storage facility, Drugs Total: %d ", materialsdeposit,DynamicFactions[x][fDrugs]);
							SCM(playerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string),  "%s has just taken %d drugs from the faction storage facility.",sendername,materialsdeposit);
							SendFamilyMessage(x, TEAM_AZTECAS_COLOR, string);
							SaveDynamicFactions();
							return 1;
						}
			 			else
						{
							SCM(playerid, COLOR_GREY, "There isn't that much drugs in storage!");
						}
					}
					else
					{
						SCM(playerid, COLOR_GREY	, "You are not at the faction storage facility!");
					}
				}
    			else if(strcmp(x_nr,"put",true) == 0)
				{
					tmp = strtok(cmdtext, idx);
					if(!strlen(tmp))
					{
						SCM(playerid, COLOR_GREY, "[USAGE:] /fdrugs put [amount]");
						return 1;
					}
					new materialsdeposit = strval(tmp);
					if(!strlen(tmp))
					{
						SCM(playerid, COLOR_GREY, "[USAGE:] /fdrugs put [amount]");
						return 1;
					}
					if(PTP(5.0,playerid,DynamicFactions[x][fX],DynamicFactions[x][fY],DynamicFactions[x][fZ]))
					{
					    if(materialsdeposit <= PlayerInfo[playerid][pDrugs])
					    {
							PlayerInfo[playerid][pDrugs] =PlayerInfo[playerid][pDrugs]-materialsdeposit;
							DynamicFactions[x][fDrugs] +=materialsdeposit;
							format(string, sizeof(string), "You putted %d drugs from the storage facility, Drugs Total: %d ", materialsdeposit,DynamicFactions[x][fDrugs]);
							SCM(playerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string),  "%s has just putted %d drugs from the faction storage facility.",sendername,materialsdeposit);
							SendFamilyMessage(x, TEAM_AZTECAS_COLOR, string);
							SaveDynamicFactions();
							return 1;
						}
			 			else
						{
							SCM(playerid, COLOR_GREY, "You don't have that much drugs on you!");
						}
					}
					else
					{
						SCM(playerid, COLOR_GREY, "You are not at the faction storage facility!");
					}
				}
				else
				{
					SCM(playerid, COLOR_GREY, "Unknown fDrugs name !");
					return 1;
				}
	        }
	        else
	        {
	            SCM(playerid, COLOR_GREY, "You are not a gang member !");
	            return 1;
	        }
	    }
	    return 1;
	}
	if(strcmp(cmd, "/fmats", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(IsAMember(playerid))
	        {
	        	new x;
				x = PlayerInfo[playerid][pMember] + PlayerInfo[playerid][pLeader];
	            if(PlayerInfo[playerid][pRank] < 3)
	            {
	                SCM(playerid, COLOR_GREY, "   You need to be Rank 3 or Higher for this action !");
	                return 1;
	            }
	            /*if(DynamicFactions[x][fSafe] <= 0)
				{
					SCM(playerid, COLOR_WHITE, "The leader must buy a SAFE first !");
					return 1;
				}*/
	            new x_nr[256];
				x_nr = strtok(cmdtext, idx);
				if(!strlen(x_nr))
				{
					if(PTP(5.0,playerid,DynamicFactions[x][fX],DynamicFactions[x][fY],DynamicFactions[x][fZ]))
					{
						format(string, sizeof(string), "Faction Mats: $%d.", DynamicFactions[x][fMats]);
						SCM(playerid, COLOR_WHITE, string);
					}
					SCM(playerid, COLOR_WHITE, "|________________________fMats_________________________|");
					SCM(playerid, COLOR_WHITE, "| USAGE: /fmats [name] [ammount]");
			  		SCM(playerid, COLOR_GREY, " | Available names: Take , Put");
					SCM(playerid, COLOR_WHITE, "|______________________________________________________|");
					return 1;
				}
				GetPlayerName(playerid, sendername, sizeof(sendername));
				GetPlayerName(giveplayerid, playername, sizeof(playername));
			    if(strcmp(x_nr,"take",true) == 0)
				{
					tmp = strtok(cmdtext, idx);
					if(!strlen(tmp))
					{
						SCM(playerid, COLOR_GREY, "[USAGE:] /fmats take [amount]");
						return 1;
					}
					new materialsdeposit = strval(tmp);
					if(!strlen(tmp))
					{
						SCM(playerid, COLOR_GREY, "[USAGE:] /fmats take [amount]");
						return 1;
					}
					if(PTP(5.0,playerid,DynamicFactions[x][fX],DynamicFactions[x][fY],DynamicFactions[x][fZ]))
					{
					    if(materialsdeposit <=DynamicFactions[x][fMats])
					    {
							PlayerInfo[playerid][pMats] += materialsdeposit;
							DynamicFactions[x][fMats]=DynamicFactions[x][fMats]-materialsdeposit;
							format(string, sizeof(string), "You have taken %d mats from the storage facility, Materials Total: %d ", materialsdeposit,DynamicFactions[x][fMats]);
							SCM(playerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string),  "%s has just taken %d mats from the faction storage facility.",sendername,materialsdeposit);
							SendFamilyMessage(x, TEAM_AZTECAS_COLOR, string);
							SaveDynamicFactions();
							return 1;
						}
			 			else
						{
							SCM(playerid, COLOR_GREY, "There isn't that much mats in storage!");
						}
					}
					else
					{
						SCM(playerid, COLOR_GREY	, "You are not at the faction storage facility!");
					}
				}
    			else if(strcmp(x_nr,"put",true) == 0)
				{
					tmp = strtok(cmdtext, idx);
					if(!strlen(tmp))
					{
						SCM(playerid, COLOR_GREY, "[USAGE:] /fmats put [amount]");
						return 1;
					}
					new materialsdeposit = strval(tmp);
					if(!strlen(tmp))
					{
						SCM(playerid, COLOR_GREY, "[USAGE:] /fmats put [amount]");
						return 1;
					}
					if(PTP(5.0,playerid,DynamicFactions[x][fX],DynamicFactions[x][fY],DynamicFactions[x][fZ]))
					{
					    if(materialsdeposit <= PlayerInfo[playerid][pMats])
					    {
							PlayerInfo[playerid][pMats] =PlayerInfo[playerid][pMats]-materialsdeposit;
							DynamicFactions[x][fMats] +=materialsdeposit;
							format(string, sizeof(string), "You putted %d mats from the storage facility, Materials Total: %d ", materialsdeposit,DynamicFactions[x][fMats]);
							SCM(playerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string),  "%s has just putted %d mats from the faction storage facility.",sendername,materialsdeposit);
							SendFamilyMessage(x, TEAM_AZTECAS_COLOR, string);
							SaveDynamicFactions();
							return 1;
						}
			 			else
						{
							SCM(playerid, COLOR_GREY, "You don't have that much mats on you!");
						}
					}
					else
					{
						SCM(playerid, COLOR_GREY, "You are not at the faction storage facility!");
					}
				}
				else
				{
					SCM(playerid, COLOR_GREY, "Unknown fMats name !");
					return 1;
				}
	        }
	        else
	        {
	            SCM(playerid, COLOR_GREY, "You are not a gang member !");
	            return 1;
	        }
	    }
	    return 1;
	}

Samp.OnlyPro.ro - RolePlay - Join Us !

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.