/givemoney value too big
#1

hi guys im trying to give money but no matter what i type 1 or 200 or 5000 it allways give 10M

i tried with Float Too And Without Float

pawn Код:
CMD:givemoney(playerid, params[])
{
    new pid, money;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You Are Not Admin But You Allowed To Use /pay");
    if(sscanf(params, "uf", pid, money)) return SendClientMessage(playerid, 0xFFFF00FF, "Usage : /{FF0000}GiveMoney {FFFF00}[ID] [Value]!");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, 0xFFFF00FF, "Player Doesn't Exist!");
    else
    {
       new pName[MAX_PLAYER_NAME], Str[128];
       GetPlayerName(playerid, pName, sizeof(pName));
       format(Str, sizeof(Str), "Admin : %s Gave You $%d Cash!", pName, money);
       SendClientMessage(pid, 0x00FF00FF, Str);
       GivePlayerMoney(pid, money);
    }
    return 1;
}
Can AnyOne Help ME!?!?!? .
Reply
#2

Код:
CMD:givemoney(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 4)
	{
		new string[128], giveplayerid, money;
		if(sscanf(params, "id", giveplayerid, money)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /givemoney [playerid] [money]");

		if(IsPlayerConnected(giveplayerid))
		{
			GivePlayerCash(giveplayerid, money);
			format(string, sizeof(string), "You have given %s $%d !",GetPlayerNameEx(giveplayerid),money);
			SendClientMessageEx(playerid, COLOR_WHITE, string);
			format(string, sizeof(string), "%s has given %s $%d (/givemoney)", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid),money);
			Log("logs/stats.log", string);
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	}
	return 1;
}
Try this!
Reply
#3

pawn Код:
CMD:givemoney(playerid, params[])
{
    new pid, Float:money;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You Are Not Admin But You Allowed To Use /pay");
    if(sscanf(params, "uf", pid, money)) return SendClientMessage(playerid, 0xFFFF00FF, "Usage : /{FF0000}GiveMoney {FFFF00}[ID] [Value]!");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, 0xFFFF00FF, "Player Doesn't Exist!");
    new pName[MAX_PLAYER_NAME], Str[128];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(Str, sizeof(Str), "Admin : %s Gave You $%f Cash!", pName, money);
    SendClientMessage(pid, 0x00FF00FF, Str);
    GivePlayerMoney(pid, money);
    return 1;
}
didn't make it Float:money
Try out now
Reply
#4

not working gives 2K always and messages have lags
Reply
#5

nope not working giving too much
Reply
#6

Edited my last post, check it out
Reply
#7

Код:
CMD:givemoney(playerid,params[])
{
     new pname[24], cash, targetid, string[128];
     if(!IsPlayerLuxAdmin(playerid)) return SendClientMessage(playerid, -1, "Error: You are not admin But you can use /pay");
     if(sscanf(params,"ui",targetid, cash)) return SendClientMessage(playerid,-1,"USAGE: /givemoney [playerid] [cash]");
     if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");

     GetPlayerName(targetid, pname, 24);
     GivePlayerMoney(targetid, cash);
     format(string, 128, "** ADMIN CASH: You have been given $%d.", cash);
     SendClientMessage(targetid,0xFF00FFFF,string);
     return 1;
}
Try this
Reply
#8

pawn Код:
CMD:givemoney(playerid, params[])
{
    new ID;
    new Value;
    if(!IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "uf", ID, Value)) return SendClientMessage(playerid, 0xFFFF00FF, "Usage : /{FF0000}GiveMoney {FFFF00}[ID] [Cash]!");
        if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFFFF00FF, "That player isn't connected or doesn't exists!");
        new name[MAX_PLAYER_NAME], Str[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(Str, sizeof(Str), "Admin : %s gave to you $%f cash!", name, money);
        SendClientMessage(ID, 0x00FF00FF, Str);
        GivePlayerMoney(ID, Value);
    }
    else
    {
        SendClientMessage(playerid, -1, "You are not authorized to use this command!");
    }
    return 1;
}
Reply
#9

Try this one,

pawn Код:
CMD:givemoney(playerid, params[])
{
    new
        pid,
        money
    ;
   
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You Are Not Admin But You Allowed To Use /pay");
    if(sscanf(params, "ui", pid, money)) return SendClientMessage(playerid, 0xFFFF00FF, "Usage : /{FF0000}GiveMoney {FFFF00}[ID] [Value]!");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, 0xFFFF00FF, "Player Doesn't Exist!");

    new pName[MAX_PLAYER_NAME], Str[128];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(Str, sizeof(Str), "Admin : %s Gave You $%i Cash!", pName, money);
    SendClientMessage(pid, 0x00FF00FF, Str);
    GivePlayerMoney(pid, money);
    return 1;
}
PS: You have created a local variable to hold the amount as an integer var and you're using it as float, that won't gonna work at all.
Reply
#10

iOxide, You're doing a wrong thing over there! "GivePlayerMoney(playerid, GetPlayerMoney(playerid)+money);"
Seriously, you double the pid's money and also add the entered value to their money value.
Try this:
pawn Код:
CMD:givemoney(playerid, params[])
{
* * new pid, money;
* * if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You Are Not Admin But You Allowed To Use /pay");
* * if(sscanf(params, "ui", pid, money)) return SendClientMessage(playerid, 0xFFFF00FF, "Usage : /{FF0000}GiveMoney {FFFF00}[ID] [Value]!");
* * if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, 0xFFFF00FF, "Player Doesn't Exist!");
* * new pName[MAX_PLAYER_NAME], Str[128];
* * GetPlayerName(playerid, pName, sizeof(pName));
* * format(Str, sizeof(Str), "Admin : %s Gave You $%i Cash!", pName, money);
* * SendClientMessage(pid, 0x00FF00FF, Str);
* * GivePlayerMoney(pid, money);
* * return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)