20.01.2013, 00:04
Код:
CMD:pay(playerid, params[]) { new giveplayerid, moneys, string[128]; if(sscanf(params, "ud"),giveplayerid, moneys) return SyntaxMessage(playerid, "/pay [playerid/name] [amount]"); if(moneys > 1000 && PlayerInfo[playerid][pLevel] < 3) return SendClientMessage(playerid, GREY, " You must be level 3 to pay more than $1,000 at a time."); if(moneys < 1 || moneys > 150000) return SendClientMessage(playerid, GREY, " You cannot pay under $1 or more than $150,000 at a time."); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid == playerid) return SendClientMessage(playerid, GREY, " You cannot pay money to yourself."); if(giveplayerid != INVALID_PLAYER_ID) { if(ProxDetectorS(5.0, playerid, giveplayerid)) { new playermoney = PlayerInfo[playerid][pCash]; if(moneys > 0 && playermoney >= moneys) { PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-moneys; GivePlayerMoney(playerid, (0 - moneys)); PlayerInfo[giveplayerid][pCash] = PlayerInfo[giveplayerid][pCash]+moneys; GivePlayerMoney(giveplayerid, moneys); format(string, sizeof(string), " You have sent %s(player: %d), $%d.", pName(giveplayerid), giveplayerid, moneys); SendClientMessage(playerid, GREY1, string); format(string, sizeof(string), " You have recieved $%d from %s(player: %d).", moneys, pName(playerid), playerid); SendClientMessage(giveplayerid, GREY1, string); if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger takes out some Cash, and hands it to %s.",pName(giveplayerid)); else format(string, sizeof(string), "* %s takes out some Cash, and hands it to %s.", pName(playerid),pName(giveplayerid)); ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0); new plrIP[16]; new giveplrIP[16]; GetPlayerIp(playerid, plrIP, sizeof(plrIP)); GetPlayerIp(giveplayerid, giveplrIP, sizeof(giveplrIP)); format(string, sizeof(string), "%s (IP:%s) (Key:%d) (ConTime:%d) has paid $%d to %s (IP:%s) (Key:%d)", pName(playerid),plrIP,PlayerInfo[playerid][pKey], PlayerInfo[playerid][pConnectTime],moneys,pName(giveplayerid),giveplrIP,PlayerInfo[giveplayerid][pKey]); PayLog(string); } else return SendClientMessage(playerid, GREY1, "Invalid transaction amount."); } else return SendClientMessage(playerid, GREY, " You are too far away."); } } else { SendClientMessage(playerid, WHITE, " Not an active player!"); } return 1;