Abuse Money bug
#1

i have a problem , i tryed to fix it, not fixed

this bug is player can get 999999kk$ , ex: i he did /getdrugs 999999999 or 100000000 .. he will get money , and sometimes he get -999999$$

pawn Код:
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]");
        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;
}
Reply
#2

Can you show script for GivePlayerCash?
Reply
#3

Quote:
Originally Posted by bondowocopz
Посмотреть сообщение
Can you show script for GivePlayerCash?
pawn Код:
stock GivePlayerCash(playerid, money) return Cash[playerid] += money;
stock GetPlayerCash(playerid) return Cash[playerid];
stock ResetPlayerCash(playerid) return Cash[playerid] = 0;
Reply
#4

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:
Код:
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;
}
Reply
#5

Quote:
Originally Posted by bondowocopz
Посмотреть сообщение
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:
Код:
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;
}
Thanks bro + rep,

and if you want please to help me with this: when i make this sendforall, i get error
Код:
: error 035: argument type mismatch (argument 2)
in this:
Код:
SCMTA(id, COLOR_LIGHTRED, string);
and when i make just not for all is not gived me error "SCM"

and this my define
pawn Код:
#define SCM SendClientMessage
#define SCMTA SendClientMessageToAll
pawn Код:
CMD:rmute(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] > 1)
        {
            new helptext[250], id, sendername[80], name[80], minutes, string[128];
            GetPlayerName(id, name, sizeof(name));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            if(sscanf(params, "uis[250]",id,minutes,helptext)) return SCM(playerid,COLOR_WHITE,"Syntax: /rmute <ID> <minute> <reason>");
            new string1[128];
            format(string1, sizeof(string1), "*You have been muted from report by %s for %d minutes, reason: %s", name, minutes, helptext);
            SCM(playerid, COLOR_LIGHTRED, string1);
            format(string, sizeof(string), "* has been muted from /report by Admin %s for %d minutes, reason: %s", sendername, minutes, helptext);
            SCMTA(id, COLOR_LIGHTRED, string);
            PlayerInfo[id][pReportMute] += minutes*60;
            Update(id, pReportMutex);
            return 1;
        }
    }
    return 1;
}
Reply
#6

Код:
SCMTA(COLOR_LIGHTRED, string);
Just remove 'id' mate
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)