14.05.2015, 01:19
You must make a limit for getdrugs, you've same problems with my server before.
Because they can use this /getdrugs -1000000 and they get the money.
Try this script:
Because they can use this /getdrugs -1000000 and they get the money.
Try this script:
Код:
CMD:getdrugs(playerid,params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You need to login first.");
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] != 4) return SCM(playerid,COLOR_WHITE,"{FFF8C6}You are not a Drugs Dealer.");
if(!IsPlayerInRangeOfPoint(playerid, 5.0, 322.9745,1119.4409,1083.8828)) return SCM(playerid,COLOR_WHITE,"{FFF8C6}You are not the place where you can get drugs.");
new points;
new dpoints = PlayerInfo[playerid][pDrugs];
if(sscanf(params, "i", points)) return SCM(playerid, COLOR_WHITE, "Usage: /getdrugs [amount]");
if(points > 1000 || points < 1) return SCM(playerid, COLOR_WHITE, "Please insert 0 - 1000");
new totaldrugs = dpoints + points;
if(totaldrugs > 99) return SCM(playerid, COLOR_WHITE, "You can not hold so many drugs to you.");
new money = points * 1000;
if(GetPlayerCash(playerid) < money) return SCM(playerid,COLOR_WHITE,"You do not have enough money.");
PlayerInfo[playerid][pDrugs] += points;
GivePlayerCash(playerid,-money);
new string[64];
format(string,sizeof(string),"You bought %d grams of drugs $%s",points,FormatNumber(money));
SCM(playerid,COLOR_WHITE,string);
new str2[128];
format(str2,sizeof(str2),"UPDATE users SET `Money`='%d',`Drugs`='%d' WHERE `name`='%s'",GetPlayerCash(playerid),PlayerInfo[playerid][pDrugs],PlayerInfo[playerid][pNormalName]);
mysql_query(SQL,str2);
return 1;
}
return 1;
}

