SA-MP Forums Archive
Problem with /mget - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with /mget (/showthread.php?tid=267767)



Problem with /mget - BartDashio - 09.07.2011

ummmm i have a problem with my code /mget how can i make it so its like /mget A for one loction /mget B, and /mget C .......here is my current code
Код:
		new MatsGet[MAX_PLAYERS];
		if (strcmp(cmd, "/mgetA", true)==0)
		{
	    if (!IsPlayerConnected(playerid)) return 1;
	    if (PlayerInfo[playerid][pJob] != 9)
		{
		    SendClientMessage(playerid,COLOR_GREY," You are not a Arms Dealer!");
		    return 1;
		}
		new matget = 0;
		new matsmult = 1;
		for (new i=0; i<MAX_MATPOINTS; i++)
		{
		    if (PlayerToPoint(3.0, playerid, MatsPickup[i][Matsx], MatsPickup[i][Matsy], MatsPickup[i][Matsz])) matget = i+1;
		}
		if (matget > 0)
		{
		    new point_pickup = -1;
		    new point_drop = -1;
		    for (new i=0; i<MAX_POINTS; i++)
		    {
			    if (Points[i][Type] == 1 && Points[i][MatPoint] == matget)
			    {
			        point_pickup = i;
			    }
			    if (Points[i][Type] == 2 && Points[i][MatPoint] == matget)
			    {
			        point_drop = i;
			    }
		    }

			if (point_pickup >=0 && point_drop >= 0 && PlayerInfo[playerid][pFMember] < MAX_FAMILY)
			{
			    new fam = PlayerInfo[playerid][pFMember];
			    if (strcmp(Points[point_pickup][Owner], FamilyInfo[fam][FamilyName], true) == 0 && strcmp(Points[point_drop][Owner], FamilyInfo[fam][FamilyName], true) == 0)
			    {
			        matsmult = 2;
			    }
	        }

	        if(MatsHolding[playerid] >= 20)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "You can't hold any more Materials Packages!");
		        return 1;
	        }
			moneys = MatsPickup[matget-1][MatsAmount] * matsmult;
			new price = moneys * 20;
			if(GetPlayerMoney(playerid) > price)
			{
			    format(string, sizeof(string), "* You bought %d Packages for $%d.", moneys, price);
			    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			    GivePlayerMoney(playerid, - price);
			    MatsHolding[playerid] = moneys;
			    MatsGet[playerid] = matget;
			}
			else
			{
			    format(string, sizeof(string), "You can't afford the $%d!", price);
			    SendClientMessage(playerid, COLOR_GREY, string);
			    return 1;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "  You need to Exercise Hut on Santa Maria Beach (Near Pier)!");
			return 1;
		}
		return 1;
	}