pawn Код:
CMD:givemoney(playerid, params[])
{
new playerb, amount, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "ui", playerb, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givemoney [playerid] [amount]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
PlayerInfo[playerb][pMoney] = PlayerInfo[playerb][pMoney]+amount;
GiveZaiatMoney(playerb, amount);
format(string, sizeof(string), " Administrator %s has given you $%d", RPN(playerid), amount);
SendClientMessage(playerb, COLOR_WHITE, string);
format(string, sizeof(string), "AdmWarn: %s has given %s $%d.", RPN(playerid), RPN(playerb), amount);
SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/givemoney.log", string);
OnPlayerSave(playerb);
return 1;
}
CMD:setmoney(playerid, params[])
{
new playerb, amount, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "ui", playerb, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setmoney [playerid] [amount]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
PlayerInfo[playerb][pMoney] = amount;
SetZaiatMoney(playerb, amount);
format(string, sizeof(string), " Administrator %s has set your money to $%d", RPN(playerid), amount);
SendClientMessage(playerb, COLOR_WHITE, string);
format(string, sizeof(string), "AdmWarn: %s has set %s's money to $%d.", RPN(playerid), RPN(playerb), amount);
SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/setmoney.log", string);
OnPlayerSave(playerb);
return 1;
}
Can you explain what is wrong with it? Also make sure that GiveZaiatMoney adds the money to the variable, I assume it's server-side money.
pawn Код:
stock GiveZaiatMoney(playerid, amount)
{
new string[128];
if(amount < 0) format(string, sizeof(string), "~r~-$%d", amount*-1);
else if(amount > 0) format(string, sizeof(string), "~g~+$%d", amount);
GameTextForPlayer(playerid, string, 3000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
return 1;
}
pawn Код:
stock GiveZaiatMoney(playerid, amount)
{
new string[128];
if(amount < 0) format(string, sizeof(string), "~r~-$%d", amount*-1);
else if(amount > 0) format(string, sizeof(string), "~g~+$%d", amount);
GameTextForPlayer(playerid, string, 3000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
PlayerInfo[playerid][pMoney] = PlayerInfo[playerid][pMoney]+amount;
GivePlayerMoney(playerid,amount);
return 1;
}
too.