abuse money
#1

hello

i have bug in /free , when any cops , is free player, EX : /free [id ] [price ] , /free 25 150000000 , and player is not

have this money is can accept free ,and cop will get this price all$$ , and get out .... - , ex : player have 200 , and cop is free him for 500$ , will have -300$ , cop will get 500$

pawn
pawn Код:
CMD:free(playerid, params[])
{
    new id, amount, szDialogString[250];
    if(sscanf(params, "ui", id, amount)) return SCM(playerid, -1, "Syntax: /free [playerid] [price]");
    if(IsPlayerInRangeOfPlayer(playerid, id, 10.0))
    {
        if(playerVariables[playerid][pGroup] == 1 || playerVariables[playerid][pGroup] == 2 || playerVariables[playerid][pGroup] == 3 ||  playerVariables[playerid][pGroup] == 5)
        {
            if(playerVariables[playerid][pRobPoints] >= 3)
            {
                GetPlayerName(id, szPlayerName, MAX_PLAYER_NAME);
                format(szMessage, sizeof(szMessage), "You offered %s a free, with a price of: %d$", szPlayerName, amount);
                SCM(playerid, COLOR_LIGHTGREEN, szMessage);

                GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

                SetPVarInt(id, "fID", playerid);
                SetPVarInt(id, "fPrice", amount);

                format(szDialogString, 250, "%s is offering you a free at a price of $%d. Do you wish to accept?", szPlayerName, amount);
                ShowPlayerDialog(id, DIALOG_FREE, DIALOG_STYLE_MSGBOX, "Server: Free", szDialogString, "Accept", "Decline");
            }
            else return SCM(playerid, -1,"Nu ai destule lawer points");
        }
        else
        {
            SCM(playerid, -1, "You are not a cop!");
        }
    }
    else
    {
        SCM(playerid, -1, "You need to be near the player you wish to free!");
    }
    return 1;
}
pawn Код:
case DIALOG_FREE:
        {
            new copid = GetPVarInt(playerid, "fID");
            new price = GetPVarInt(playerid, "fPrice");
            if(response)
            {
                if(IsPlayerConnected(copid))
                {
                    new group;
                    group = playerVariables[copid][pGroup];
                    if(group == 1 || group == 2 || group == 3 || group == 5)
                    {
                        playerVariables[copid][pMoney] += price;
                        playerVariables[playerid][pMoney] -= price;
                        playerVariables[playerid][pPrisonID] = 0;
                        playerVariables[playerid][pPrisonTime] = 0;
                        ResetPlayerMoney(playerid);
                        GivePlayerMoney(playerid, playerVariables[playerid][pMoney]);

                        ResetPlayerMoney(copid);
                        GivePlayerMoney(copid, playerVariables[copid][pMoney]);
                        GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

                        format(szMessage, sizeof(szMessage), "%s has accepted your free ($%d)", szPlayerName, price);
                        SCM(copid, COLOR_LIGHTGREEN, szMessage);
                        DeletePVar(playerid, "fID");
                        DeletePVar(playerid, "fPrice");
                        SetPlayerPos(playerid, 1546.2699,-1675.8907,13.5620);
                        SetPlayerInterior(playerid, 0);
                        SetPlayerVirtualWorld(playerid, 0);
                        SetPlayerHealth(playerid, 99);
                        SetPlayerArmour(playerid, 0.0);
                    }
                    else
                    {
                        SCM(playerid, -1, "This player is not a cop!");
                    }
                }
                else
                {
                    SCM(playerid, -1, "This player is not connected!");
                }
            }
            else
            {
                if(IsPlayerConnected(copid))
                {
                    new group;
                    group = playerVariables[playerid][pGroup];
                    if(groupVariables[group][gGroupType] == 1)
                    {
                        GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

                        format(szMessage, sizeof(szMessage), "%s has declined your free.", szPlayerName);
                        SCM(copid, COLOR_LIGHTGREEN, szMessage);
                    }
                }
            }
        }
Reply
#2

You should check the player's money to see whether he can afford the price or not.
If not, send him a message or something that he doesn't have enough money.

For example:
pawn Код:
if(GetPlayerMoney(playerid) < price)
{
    return SendClientMessage(playerid, /*COLOR*/, "You don't have enough money to pay the price.");
}
Reply
#3

Quote:
Originally Posted by Bible
Посмотреть сообщение
You should check the player's money to see whether he can afford the price or not.
If not, send him a message or something that he doesn't have enough money.

For example:
pawn Код:
if(GetPlayerMoney(playerid) < price)
{
    return SendClientMessage(playerid, /*COLOR*/, "You don't have enough money to pay the price.");
}
how ? ( , i want make max is can free 4500$
Reply
#4

Hope this would do. just uncomment line 5 and 6
Код:
CMD:free(playerid, params[])
{
    new id, amount, szDialogString[250];
    if(sscanf(params, "ui", id, amount)) return SCM(playerid, -1, "Syntax: /free [playerid] [price]");
    //if(price>4500)return SCM(playerid,-1,"Error: Price cant be above 4500");
    //if(GetPlayerMoney(id)<price)return SCM(playerid,-1,"Error: player doesnt have enough cash");
    if(IsPlayerInRangeOfPlayer(playerid, id, 10.0))
    {
        if(playerVariables[playerid][pGroup] == 1 || playerVariables[playerid][pGroup] == 2 || playerVariables[playerid][pGroup] == 3 ||  playerVariables[playerid][pGroup] == 5)
        {
            if(playerVariables[playerid][pRobPoints] >= 3)
            {
                GetPlayerName(id, szPlayerName, MAX_PLAYER_NAME);
                format(szMessage, sizeof(szMessage), "You offered %s a free, with a price of: %d$", szPlayerName, amount);
                SCM(playerid, COLOR_LIGHTGREEN, szMessage);

                GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

                SetPVarInt(id, "fID", playerid);
                SetPVarInt(id, "fPrice", amount);

                format(szDialogString, 250, "%s is offering you a free at a price of $%d. Do you wish to accept?", szPlayerName, amount);
                ShowPlayerDialog(id, DIALOG_FREE, DIALOG_STYLE_MSGBOX, "Server: Free", szDialogString, "Accept", "Decline");
            }
            else return SCM(playerid, -1,"Nu ai destule lawer points");
        }
        else
        {
            SCM(playerid, -1, "You are not a cop!");
        }
    }
    else
    {
        SCM(playerid, -1, "You need to be near the player you wish to free!");
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Quickie
Посмотреть сообщение
Hope this would do. just uncomment line 5 and 6
Код:
CMD:free(playerid, params[])
{
    new id, amount, szDialogString[250];
    if(sscanf(params, "ui", id, amount)) return SCM(playerid, -1, "Syntax: /free [playerid] [price]");
    //if(price>4500)return SCM(playerid,-1,"Error: Price cant be above 4500");
    //if(GetPlayerMoney(id)<price)return SCM(playerid,-1,"Error: player doesnt have enough cash");
    if(IsPlayerInRangeOfPlayer(playerid, id, 10.0))
    {
        if(playerVariables[playerid][pGroup] == 1 || playerVariables[playerid][pGroup] == 2 || playerVariables[playerid][pGroup] == 3 ||  playerVariables[playerid][pGroup] == 5)
        {
            if(playerVariables[playerid][pRobPoints] >= 3)
            {
                GetPlayerName(id, szPlayerName, MAX_PLAYER_NAME);
                format(szMessage, sizeof(szMessage), "You offered %s a free, with a price of: %d$", szPlayerName, amount);
                SCM(playerid, COLOR_LIGHTGREEN, szMessage);

                GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

                SetPVarInt(id, "fID", playerid);
                SetPVarInt(id, "fPrice", amount);

                format(szDialogString, 250, "%s is offering you a free at a price of $%d. Do you wish to accept?", szPlayerName, amount);
                ShowPlayerDialog(id, DIALOG_FREE, DIALOG_STYLE_MSGBOX, "Server: Free", szDialogString, "Accept", "Decline");
            }
            else return SCM(playerid, -1,"Nu ai destule lawer points");
        }
        else
        {
            SCM(playerid, -1, "You are not a cop!");
        }
    }
    else
    {
        SCM(playerid, -1, "You need to be near the player you wish to free!");
    }
    return 1;
}
thanks bro , for answer , and again this problem , is work when player have like : -$$ , and when player have like 2$ or anything , and cop is free him , for 7000$ , is can accept and get out (
Reply
#6

pawn Код:
CMD:free(playerid, params[])
{
    new id, amount, szDialogString[250];
    if(sscanf(params, "ui", id, amount)) return SCM(playerid, -1, "Syntax: /free [playerid] [price]");
add this after ^^^^ or just uncomment it

pawn Код:
if(price>4500)return SCM(playerid,-1,"Error: Price cant be above 4500");
if(GetPlayerMoney(id)<price)return SCM(playerid,-1,"Error: player doesnt have enough cash");
it checks if the target player doesnt have enough and if so give an error message in this case if player have less than the amount requested by the cop
ang the request amount of the cop limited to 4500..
Reply
#7

Quote:
Originally Posted by Quickie
Посмотреть сообщение
pawn Код:
CMD:free(playerid, params[])
{
    new id, amount, szDialogString[250];
    if(sscanf(params, "ui", id, amount)) return SCM(playerid, -1, "Syntax: /free [playerid] [price]");
add this after ^^^^ or just uncomment it

pawn Код:
if(price>4500)return SCM(playerid,-1,"Error: Price cant be above 4500");
if(GetPlayerMoney(id)<price)return SCM(playerid,-1,"Error: player doesnt have enough cash");
it checks if the target player doesnt have enough and if so give an error message in this case if player have less than the amount requested by the cop
ang the request amount of the cop limited to 4500..
no understand , u mean ?
me i did it :
pawn Код:
CMD:free(playerid, params[])
{
    new id, amount, price, szDialogString[250];
    if(sscanf(params, "ui", id, amount)) return SCM(playerid, -1, "Syntax: /free [playerid] [price]");
        if(price>4500)return SCM(playerid,-1,"Error: Price cant be above 4500");
        if(GetPlayerMoney(id)<price)return SCM(playerid,-1,"Error: player doesnt have enough cash");
    if(IsPlayerInRangeOfPlayer(playerid, id, 10.0))
    {
        if(playerVariables[playerid][pGroup] == 1 || playerVariables[playerid][pGroup] == 2 || playerVariables[playerid][pGroup] == 3 ||  playerVariables[playerid][pGroup] == 5)
        {
            if(playerVariables[playerid][pRobPoints] >= 3)
            {
                GetPlayerName(id, szPlayerName, MAX_PLAYER_NAME);
                format(szMessage, sizeof(szMessage), "You offered %s a free, with a price of: %d$", szPlayerName, amount);
                SCM(playerid, COLOR_LIGHTGREEN, szMessage);

                GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

                SetPVarInt(id, "fID", playerid);
                SetPVarInt(id, "fPrice", amount);

                format(szDialogString, 250, "%s is offering you a free at a price of $%d. Do you wish to accept?", szPlayerName, amount);
                ShowPlayerDialog(id, DIALOG_FREE, DIALOG_STYLE_MSGBOX, "Server: Free", szDialogString, "Accept", "Decline");
            }
            else return SCM(playerid, -1,"Nu ai destule lawer points");
        }
        else
        {
            SCM(playerid, -1, "You are not a cop!");
        }
    }
    else
    {
        SCM(playerid, -1, "You need to be near the player you wish to free!");
    }
    return 1;
}
wrong?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)