Command Help
#1

Hey guys I am trying to figure out what's the problem with /get drugs. Every body can buy drugs not just people who got;
Код:
Job id: 4
Lets say you buy 6 drugs it doesn't give you a sendclientmessage, "You already have the maximum amount of drugs".

Код:
	if(strcmp(cmd,"/get",true)==0)
    {
        if(IsPlayerConnected(playerid))
	    {
			new x_job[128];
			x_job = strtok(cmdtext, idx);

			if(!strlen(x_job)) {
				SendClientMessage(playerid, COLOR_WHITE, "|__________________ Get __________________|");
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /get [name]");
		  		SendClientMessage(playerid, COLOR_GREY, "Available names: Drugs, Fuel");
				SendClientMessage(playerid, COLOR_GREEN, "|_________________________________________|");
				return 1;
			}

		    if(strcmp(x_job,"drugs",true) == 0)
			{
		        if(PlayerInfo[playerid][pDrugs] > 15)
		        {
		            format(string, sizeof(string), "** You still have %d grams with you, sell them first !", PlayerInfo[playerid][pDrugs]);
					SendClientMessage(playerid, COLOR_GREY, string);
		            return 1;
		        }
		        new tel;
			    new price;
			    new ammount;
			    tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /get drugs [ammount]");
					return 1;
				}
				new level = PlayerInfo[playerid][pDrugsSkill];
				ammount = strval(tmp);
				if(level >= 0 && level <= 50)
				{ tel = 200; if(ammount < 1 || ammount > 6) { SendClientMessage(playerid, COLOR_GREY, "** You cant go below 1 or above 6 at your Skill Level!"); return 1; } }
				else if(level >= 51 && level <= 100)
				{ tel = 150; if(ammount < 1 || ammount > 12) { SendClientMessage(playerid, COLOR_GREY, "**  You cant go below 1 or above 12 at your Skill Level!"); return 1; } }
				else if(level >= 101 && level <= 200)
				{ tel = 100; if(ammount < 1 || ammount > 20) { SendClientMessage(playerid, COLOR_GREY, "** You cant go below 1 or above 20 at your Skill Level!"); return 1; } }
				else if(level >= 201 && level <= 400)
				{ tel = 50; if(ammount < 1 || ammount > 30) { SendClientMessage(playerid, COLOR_GREY, "**  You cant go below 1 or above 30 at your Skill Level!"); return 1; } }
				else if(level >= 401)
				{ tel = 10; if(ammount < 1 || ammount > 99) { SendClientMessage(playerid, COLOR_GREY,"**   You cant go below 1 or above 99 at your Skill Level!"); return 1; } }
			    if (PlayerInfo[playerid][pJob] == 4 && IsPlayerInRangeOfPoint(playerid, 2, 536.6410,2363.5325,-47.2201) || IsPlayerInRangeOfPoint(playerid, 2, 536.6410,2363.5325,-47.2201))
				{
				    price = ammount * tel;
				    if(GetPlayerMoney(playerid) > price)
				    {
				        format(string, sizeof(string), "* You bought %d grams for $%d.", ammount, price);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
				        SafeGivePlayerMoney(playerid, -price);
						PlayerInfo[playerid][pDrugs] = ammount;
				    }
				    else
				    {
				        SendClientMessage(playerid, COLOR_GREY, "** You cant afford the Drugs !");
				        return 1;
				    }
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "** You are not a Drugs Dealer, or not near the Drug Package !");
				    return 1;
				}
			}
Код:
if(PlayerInfo[playerid][pJob] == 4
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)