/buybait bugged
#1

Excuse me, if i buy bait very much. for exam /buybait 99999999 i will get 9999999 money. i dont know why. i hope anyone can help me.

This is the code's
Код:
CMD:buybait(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 3.0,359.3279,-2031.8842,7.8359))
    {
		SendClientMessageEx(playerid, COLOR_GREY, " Kamu tidak di toko umpan.");
		return 1;
	}
	new bait, string[128];
	if(sscanf(params, "d", bait)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /buybait [jumlah]");
	if (GetPlayerCash(playerid) >= bait*50)//ada chance dapet bukan ikan, ada chance dapet ikan yg gabisa dijual
	{
		PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
		PlayerInfo[playerid][pBait] += bait;
		GivePlayerCash(playerid, -(bait*50));
		SaveAccountsUpdate();
		format(string, sizeof(string), "Kamu telah membeli %d umpan seharga $%d", bait, bait*50);
		SendClientMessageEx(playerid, COLOR_GREEN, string);
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
    }
	return 1;
}
I'm sorry because that's using Indonesian Language
Reply
#2

pawn Код:
CMD:buybait(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 3.0,359.3279,-2031.8842,7.8359))
        return SendClientMessageEx(playerid, COLOR_GREY, " Kamu tidak di toko umpan.");
    new bait;
    if(sscanf(params, "d", bait))
        return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /buybait [jumlah]");
    if(GetPlayerCash(playerid) < bait*50)
        return SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
    else
    {
        PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
        PlayerInfo[playerid][pBait] += bait;
        GivePlayerCash(playerid, 0-(bait*50));
        new string[64];
        format(string, sizeof(string), "Kamu telah membeli %d umpan seharga $%d", bait, bait*50);
        SendClientMessageEx(playerid, COLOR_GREEN, string);
        SaveAccountsUpdate();
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by erminpr0
Посмотреть сообщение
pawn Код:
CMD:buybait(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 3.0,359.3279,-2031.8842,7.8359))
        return SendClientMessageEx(playerid, COLOR_GREY, " Kamu tidak di toko umpan.");
    new bait;
    if(sscanf(params, "d", bait))
        return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /buybait [jumlah]");
    if(GetPlayerCash(playerid) < bait*50)
        return SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
    else
    {
        PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
        PlayerInfo[playerid][pBait] += bait;
        GivePlayerCash(playerid, 0-(bait*50));
        new string[64];
        format(string, sizeof(string), "Kamu telah membeli %d umpan seharga $%d", bait, bait*50);
        SendClientMessageEx(playerid, COLOR_GREEN, string);
        SaveAccountsUpdate();
    }
    return 1;
}
I'll try that. but, i still have a bug. if i /buybait -999 so my money will increase 45k.
Reply
#4

add something like:
pawn Код:
// after sscanf is called:
if(bait < 1) return SendClientMessageEx(playerid, COLOR_WHITE, "Error: Invalid amount of bait!");
Reply
#5

Quote:
Originally Posted by Dubya
Посмотреть сообщение
add something like:
pawn Код:
// after sscanf is called:
if(bait < 1) return SendClientMessageEx(playerid, COLOR_WHITE, "Error: Invalid amount of bait!");
Thank You very much. my buybait bug has ben fixed. REP+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)