23.09.2017, 11:34
PHP код:
YCMD:pay(playerid, params[], help) {
new playa, money, string[128];
if(help) {
SendClientMessage(playerid, X11_WHITE, "Gives a player money");
return 1;
}
if(!sscanf(params, "k<playerLookup>d", playa, money)) {
if(!IsPlayerConnectEx(playa)) {
SendClientMessage(playerid, X11_RED_2, "User not found!");
return 1;
}
if(playa == playerid) {
SendClientMessage(playerid, X11_WHITE, "You cannot give money to yourself");
return 1;
}
if(GetPVarInt(playerid, "ConnectTime" < 25) && money > 1000) { //changes has been made here
SendClientMessage(playerid, X11_TOMATO_2, "You must be over 25 connect time to do this!");
return 1;
}
if(money < 1 || money >= 5000000) {
SendClientMessage(playerid, X11_WHITE, "Invalid Amount");
return 1;
}
if(GetMoneyEx(playerid) < money) {
SendClientMessage(playerid, X11_RED_2, "You do not have enough money");
return 1;
}
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playa, X, Y, Z);
if(!IsPlayerInRangeOfPoint(playerid,5.0,X, Y, Z)) {
SendClientMessage(playerid, X11_TOMATO_2, "You are not near this player");
return 1;
}
format(string, sizeof(string), "* You gave $%s to %s.", getNumberString(money), GetPlayerNameEx(playa, ENameType_RPName));
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
format(string, sizeof(string), "* You have received $%s from %s.", getNumberString(money), GetPlayerNameEx(playerid, ENameType_RPName));
SendClientMessage(playa, COLOR_LIGHTGREEN, string);
format(string, sizeof(string), "* %s takes out some cash, and hands it to %s.", GetPlayerNameEx(playerid, ENameType_RPName) ,GetPlayerNameEx(playa, ENameType_RPName));
ProxMessage(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 3.0, 5000);
format(string, sizeof(string), "%s pays %s %d",GetPlayerNameEx(playerid, ENameType_CharName), GetPlayerNameEx(playerid, ENameType_CharName), money);
payLog(string);
if(money > 19999 && GetPVarInt(playerid, "ConnectTime") < 50 || money > 49999)
{
format(string, sizeof(string), "Possible Money Farming: %s has paid $%s to %s.", GetPlayerNameEx(playerid, ENameType_CharName), getNumberString(money), GetPlayerNameEx(playa, ENameType_CharName));
ABroadcast(COLOR_YELLOW,string, EAdminFlags_BasicAdmin);
}
GiveMoneyEx(playerid, -money);
GiveMoneyEx(playa, money);
} else {
SendClientMessage(playerid, X11_WHITE, "USAGE: /pay [playerid/name] [amount]");
}
return 1;
}