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]);
SCM(playerid, COLOR_GREY, string);
return 1;
}
new tel;
new price;
new ammount;
new level = PlayerInfo[playerid][pDrugsSkill];
if(sscanf(params, "d", ammount))
{
SCM(playerid, COLOR_GRAD2, "USAGE: /get drugs [ammount]");
return 1;
}
if(level >= 0 && level <= 50)
{ tel = 200; if(ammount < 1 || ammount > 6) { SCM(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) { SCM(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) { SCM(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) { SCM(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) { SCM(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);
SCM(playerid, COLOR_LIGHTBLUE, string);
SafeGivePlayerMoney(playerid, -price);
PlayerInfo[playerid][pDrugs] = ammount;
}
else
{
SCM(playerid, COLOR_GREY, "** You cant afford the Drugs !");
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, "** You are not a Drugs Dealer, or not near the Drug Package !");
return 1;
}
}
if(sscanf(x_job, "i", ammount))
{
SCM(playerid, COLOR_GRAD2, "USAGE: /get drugs [ammount]");
return 1;
}
if(sscanf(params, "{s}d", ammount))
{
SCM(playerid, COLOR_GRAD2, "USAGE: /get drugs [ammount]");
return 1;
}
Prueba asi.
pawn Код:
|
YCMD:get(playerid, params[], help)
{
if(help) return SCM(playerid, COLOR_GREY, "Not supported");
if(IsPlayerConnected(playerid))
{
new x_job[128], string[256];
if(sscanf(params, "s[128]", x_job))
{
SCM(playerid, COLOR_WHITE, "|__________________ Get __________________|");
SCM(playerid, COLOR_WHITE, "USAGE: /get [name]");
SCM(playerid, COLOR_GREY, "Available names: Drugs, Fuel");
SCM(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]);
SCM(playerid, COLOR_GREY, string);
return 1;
}
new tel;
new price;
new ammount;
new level = PlayerInfo[playerid][pDrugsSkill];
if(sscanf(params, "d", ammount))
{
SCM(playerid, COLOR_GRAD2, "USAGE: /get drugs [ammount]");
return 1;
}
if(level >= 0 && level <= 50)
{ tel = 200; if(ammount < 1 || ammount > 6) { SCM(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) { SCM(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) { SCM(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) { SCM(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) { SCM(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);
SCM(playerid, COLOR_LIGHTBLUE, string);
SafeGivePlayerMoney(playerid, -price);
PlayerInfo[playerid][pDrugs] = ammount;
}
else
{
SCM(playerid, COLOR_GREY, "** You cant afford the Drugs !");
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, "** You are not a Drugs Dealer, or not near the Drug Package !");
return 1;
}
}
YCMD:get(playerid, params[], help){
if(help) return SCM(playerid, COLOR_GREY, "Not supported");
new x_job[128], string[256], tel, price, amount, level = PlayerInfo[playerid][pDrugsSkill];
if(sscanf(params, "s[128]", x_job)){
SCM(playerid, COLOR_WHITE, "|__________________ Get __________________|");
SCM(playerid, COLOR_WHITE, "USAGE: /get [name]");
SCM(playerid, COLOR_GREY, "Available names: Drugs, Fuel");
SCM(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]);
SCM(playerid, COLOR_GREY, string);
return 1;}
if(sscanf(x_job, "i", amount)){
SCM(playerid, COLOR_GRAD2, "USAGE: /get drugs [amount]");
return 1;}
if(level >= 0 && level <= 50)
{ tel = 200; if(amount < 1 || amount > 6) { SCM(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(amount < 1 || amount > 12) { SCM(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(amount < 1 || amount > 20) { SCM(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(amount < 1 || amount > 30) { SCM(playerid, COLOR_GREY, "** You cant go below 1 or above 30 at your Skill Level!"); return 1; } }
else if(level >= 401)
{ tel = 10; if(amount < 1 || amount > 99) { SCM(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)){
SCM(playerid, COLOR_GREY, "** You aren't near a Drug Package!");
return 1;}
if(PlayerInfo[playerid][pJob] != 4) return SCM(playerid, COLOR_GREY, "** You must be a drug dealer to use this command!");
if(GetPlayerMoney(playerid) < price) return SCM(playerid, COLOR_GREY, "** You cant afford the Drugs!");
price = amount * tel;
format(string, sizeof(string), "* You bought %d grams for $%d.", amount, price);
SCM(playerid, COLOR_LIGHTBLUE, string);
SafeGivePlayerMoney(playerid, - price);
PlayerInfo[playerid][pDrugs] = amount;}
return 1;}