Command Help
#1

Hey mates /get drugs is driving me crazy I can't understand what is the problem, it says that only players which have Job id: 4 can buy the drugs but that's not true, when I go ingame every one can buy drugs. I need to remove this command cause it is silly and make a new simple one. Can some one help me do it all I want is:

1. If player is in range of: he can use /get drugs.
2. Drugs costs 25$ each grams.
3. You can not have more then 100grams of drugs on you.
4. Only members with job id 4 can buy drugs.

The other system I want to remove:

Код:
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, 523.6057,-1812.9794,6.5713) || IsPlayerInRangeOfPoint(playerid, 2, 1424.1729,-1317.9955,13.5547))
				{
				    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;
				}
			}
Reply
#2

Quote:
Originally Posted by Unknown1195
Посмотреть сообщение
4. Only members with job id 4 can buy drugs.
First you say you get crazy that only players which have job id 4 can use it.
Second you want a cmd that is only working vor members which have job id 4.

So I guess you made a mistake and you want it for everyone possible so thats what I did
Here you got it:
pawn Код:
if(strcmp(x_job,"drugs",true) == 0)
        {
                if(PlayerInfo[playerid][pDrugs] > 100)
                {
                    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 = 25; 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 = 25; 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 = 25; 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 = 5; 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 = 25; if(ammount < 1 || ammount > 99) { SendClientMessage(playerid, COLOR_GREY,"**   You cant go below 1 or above 99 at your Skill Level!"); return 1; } }
                if (IsPlayerInRangeOfPoint(playerid, 2, 523.6057,-1812.9794,6.5713) || IsPlayerInRangeOfPoint(playerid, 2, 1424.1729,-1317.9955,13.5547))
                {
                    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 near the Drug Package !");
                    return 1;
                }
            }
Reply
#3

You understood wrong, I said that in the script it says that only members which have Job id 4 can /get drugs but in game every one could buy the drugs...
Reply
#4

pawn Код:
if(strcmp(x_job,"drugs",true) == 0)
        {
                if(PlayerInfo[playerid][pDrugs] > 100)
                {
                    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 = 25; 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 = 25; 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 = 25; 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 = 5; 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 = 25; 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, 523.6057,-1812.9794,6.5713) || PlayerInfo[playerid][pJob] == 4 && IsPlayerInRangeOfPoint(playerid, 2, 1424.1729,-1317.9955,13.5547))
                {
                    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 near the Drug Package or you are not a drug dealer !");
                    return 1;
                }
            }
This should work, if this doesn't work then everyone is job id 4.
Reply
#5

Edit: The Co-ordinates where wrong and I thought it worked but it didn't ;//
Reply
#6

Fixed on my own thanks anyways
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)