25.03.2011, 07:48
/Givecash -and- /color id id
command(pay, playerid, params[]) { new id, plmoney, string[128]; if(sscanf(params, "ud", id, plmoney)) { SendClientMessage(playerid, WHITE, "SYNTAX: /pay [playerid] [amount]"); } else { if(Player[playerid][Money] >= plmoney) { if(IsPlayerConnectedEx(id) || id != playerid) { if(Spectator[id][SpecSpectatingPlayer] != -1) { SendClientMessage(playerid, WHITE, "You're too far away."); } else { if(plmoney > 0) { if(GetDistanceBetweenPlayers(playerid, id) < 5) { Player[playerid][Money] -= plmoney; Player[id][Money] += plmoney; format(string, sizeof(string), "You have paid $%s to %s.", IntToFormattedStr(plmoney), GetName(id)); SendClientMessage(playerid, WHITE, string); format(string, sizeof(string), "* %s has paid %s some money ($%s).", GetName(playerid), GetName(id), IntToFormattedStr(plmoney)); NearByMessage(id, PINK, string); new tmpip1[128], tmpip2[128]; GetPlayerIp(playerid, tmpip1, sizeof(tmpip1)); GetPlayerIp(id, tmpip2, sizeof(tmpip2)); new hour, minute, second, day, year, month; gettime(hour, minute, second); getdate(year, month, day); format(string, sizeof(string), "[PAY] %s (IP: %s) has paid %s (IP: %s) $%s on %d/%d/%d (%d:%d:%d)", GetName(playerid), tmpip1, GetName(id), tmpip2, IntToFormattedStr(plmoney), day, month, year, hour, minute, second); MoneyLog(string); format(string, sizeof(string), "You have been paid $%s, by %s.", IntToFormattedStr(plmoney), GetName(playerid)); SendClientMessage(id, WHITE, string); if(Player[playerid][PlayingHours] == 0 && plmoney >= 999 && Player[playerid][AdminLevel] < 1) { format(string, sizeof(string), "WARNING: %s may possibly be money-farming, they've given $%s to %s (w/ 0 playing hours)", GetName(playerid), IntToFormattedStr(plmoney), GetName(id)); SendToAdmins(ADMINORANGE, string, 0); } } else { SendClientMessage(playerid, WHITE, "You're too far away."); } } else { SendClientMessage(playerid, WHITE, "You can't pay under $1!"); } } } else { SendClientMessage(playerid, WHITE, "Player not connected or not logged in, or is you."); } } } return 1; }
#include <zcmd>
#include <sscanf2>
COMMAND:money(playerid, params[])
{
new id;
new ammount;
if(IsPlayerConnected(id))
{
if(PlayerInfo[id][AdminLevel] >= 103)
{
if(!sscanf(params, "ui", id, ammount))
{
if(ammount <= 10000000000)
{
new string[64];
new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "%s Has Given You %d.", name, ammount);
SendClientMessage(id, 0xFF00CC, string);
format(string, sizeof(string), "You Gave %d Money To %s .", ammount, PlayerName);
SendClientMessage(playerid, 0xFF00CC, string);
GivePlayerMoney(id, ammount);
return 1;
}
else return SendClientMessage(playerid, 0xFF00CC, "You can't give so much");
}
else return SendClientMessage(playerid, 0xFF00CC, "USAGE: /money [PlayerId/PartOfName] [Ammount]");
}
else return SendClientMessage(playerid, 0xFF00CC, "You are not admin 1338");
}
else return SendClientMessage(playerid, 0xFF00CC, "Player is not connected.");
}