30.07.2012, 18:23
What I am asking for if anyone could make a /acceptmoney command for me that will work with the /GiveMoney command below.
I have no idea how to do this myself so I beg for help.
I am having a problem with moneyhackers that are sending millions of money to my players.
I have no idea how to do this myself so I beg for help.
I am having a problem with moneyhackers that are sending millions of money to my players.
pawn Код:
CMD:givemoney(playerid,params[]) {
if(PlayerInfo[playerid][LoggedIn] == 1) {
} else return SendClientMessage(playerid,red,"ERROR: You can't use this command!");
new moneys,giveplayerid,giveplayer[MAX_PLAYER_NAME],sendername[MAX_PLAYER_NAME],playermoney[MAX_PLAYERS],string[128];
if (sscanf(params, "ud",giveplayerid, moneys)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /givemoney [Playerid] [Amount]");
// if (!IsNumeric(giveplayerid)) giveplayerid = ReturnPlayerID(giveplayerid);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney[playerid] = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney[playerid] >= moneys) {
GivePlayerMoney(playerid, (-moneys));
GivePlayerMoney(giveplayerid, moneys);
format(string, sizeof(string), "You have sent %s (id: %d), $%d.", giveplayer,giveplayerid, moneys);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "You have recieved $%d from %s (id: %d).", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_GREEN, string);
printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
format(string, sizeof(string),"%s (%d) has transfered [$%d] to %s (%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
SaveToFile("GiveMoney",string);
MessageToAdmins(green,string);
}
else {
SendClientMessage(playerid, COLOR_BRIGHTRED, "Invalid transaction amount.");
}
}
else {
format(string, sizeof(string), "ID:%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_BRIGHTRED, string);
}
return 1;
}