18.08.2016, 15:25
how to use it
this is cmd pay
this is cmd pay
Код:
COMMAND:pay(playerid, params[]) { if(PlayerTemp[playerid][hname]==1) { new asa = GetPlayerIDFromMaskID(iPlayer); new iPlayer, iAmount; new asa = GetPlayerIDFromMaskID(iPlayer); if( sscanf ( params, "ud", iPlayer, iAmount)) return SCP(playerid, "[PlayerID/PartOfName] [amount]"); if(!IsPlayerConnected(iPlayer)) return SendClientError(playerid, PLAYER_NOT_FOUND); if(iAmount < 1 || iAmount > HandMoney(playerid)) return SendClientError(playerid, "Invalid amount specified!"); if(PlayerInfo[playerid][pMaskID]) return SendClientError(playerid, "Invalid stranger mask"); // if(iPlayer == playerid) return SendClientError(playerid, "You cannot pay yourself!"); if(iAmount > 5000000) return SendClientError(playerid, "You can pay maximum $5,000,000 at a time!"); if(PlayerInfo[playerid][totalpayt] < 3 && iAmount > 10000 && (GetPVarInt(playerid, "PayTimer") == 0)) return SendClientError(playerid, "New players can pay $10,000 per minute!"); if(GetDistanceBetweenPlayers(playerid, iPlayer) > 6) return SendClientError(playerid, "He is too far away!"); if(GetTickCount() - PlayerTemp[playerid][cmdtick] < 3000) return SendClientWarning(playerid, "You may use this command only once in 3 seconds."); new ip1[ 24 ], ip2[ 24 ]; GetPlayerIp(playerid, ip1, sizeof(ip1));GetPlayerIp(iPlayer, ip2, sizeof(ip2)); SetPVarInt(playerid, "PayTimer", 0); SetTimerEx("PTime", 60000, false, "i", playerid); if(PlayerTemp[playerid][totallogin] == 1 && iAmount > 100000) return SendClientWarning(playerid, "You may not transfer this amount of money as a new player."); if(!strcmp(ip1,ip2,true)) { format(iStr, sizeof(iStr), "** /pay warning: %s and %s same IP (%s) - Amount: $%d", PlayerName(playerid), PlayerName(iPlayer), ip1, iAmount); SendClientMessageToAdmins(iStr,COLOR_HELPEROOC); } GivePlayerMoneyEx(playerid,-iAmount);GivePlayerMoneyEx(iPlayer, iAmount); format(iStr, sizeof(iStr), "takes out some money and hands it to %s.", MaskedName(iPlayer)); Action(playerid, iStr); format(iStr, sizeof(iStr), "[CASH]: You have given %s $%s.", MaskedName(iPlayer),AddCommasToInt(iAmount)); SendClientMessage(playerid, COLOR_YELLOW, iStr); format(iStr, sizeof(iStr), "[CASH]: You have recieved $%s from %s", AddCommasToInt(iAmount),MaskedName(playerid)); SendClientMessage(iPlayer, COLOR_YELLOW, iStr); format(iStr,sizeof(iStr),"14[MONEY] %s has paid $%s to %s.", PlayerName(playerid), AddCommasToInt(iAmount), PlayerName(iPlayer)); iEcho(iStr); AppendTo(moneylog,iStr); }