28.01.2017, 09:08
Where should i put this code ?
Код:
else if(!strcmp(params, "dicebet", true)) { new offeredby = PlayerInfo[playerid][pDiceOffer], amount = PlayerInfo[playerid][pDiceBet]; if(offeredby == INVALID_PLAYER_ID) { return SendClientMessage(playerid, COLOR_GREY, "You haven't received any offers for dice betting."); } if(!IsPlayerInRangeOfPlayer(playerid, offeredby, 5.0)) { return SendClientMessage(playerid, COLOR_GREY, "The player who initiated the offer is out of range."); } if(PlayerInfo[playerid][pCash] < amount) { return SendClientMessage(playerid, COLOR_GREY, "You can't afford to accept this bet."); } if(PlayerInfo[offeredby][pCash] < amount) { return SendClientMessage(playerid, COLOR_GREY, "That player can't afford to accept this bet."); } new rand[2]; rand[0] = random(6) + 1; rand[1] = random(6) + 1; SendProximityMessage(offeredby, 20.0, COLOR_WHITE, "** %s rolls a dice which lands on the number %i.", GetPlayerRPName(offeredby), rand[0]); SendProximityMessage(playerid, 20.0, COLOR_WHITE, "** %s rolls a dice which lands on the number %i.", GetPlayerRPName(playerid), rand[1]); if(rand[0] > rand[1]) { GivePlayerCash(offeredby, amount); GivePlayerCash(playerid, -amount); SendClientMessageEx(offeredby, COLOR_AQUA, "** You have won $%i from your dice bet with %s.", amount, GetPlayerRPName(playerid)); SendClientMessageEx(playerid, COLOR_RED, "** You have lost $%i from your dice bet with %s.", amount, GetPlayerRPName(offeredby)); if(amount > 10000 && !strcmp(GetPlayerIP(offeredby), GetPlayerIP(playerid))) { SendAdminMessage(COLOR_YELLOW, "AdmWarning: %s (IP: %s) won a $%i dice bet against %s (IP: %s).", GetPlayerRPName(offeredby), GetPlayerIP(offeredby), amount, GetPlayerRPName(playerid), GetPlayerIP(playerid)); } } else if(rand[0] == rand[1]) { SendClientMessageEx(offeredby, COLOR_AQUA, "** The bet of $%i was a tie. You kept your money as a result!", amount); SendClientMessageEx(playerid, COLOR_AQUA, "** The bet of $%i was a tie. You kept your money as a result!", amount); } else { GivePlayerCash(offeredby, -amount); GivePlayerCash(playerid, amount); SendClientMessageEx(playerid, COLOR_AQUA, "** You have won $%i from your dice bet with %s.", amount, GetPlayerRPName(offeredby)); SendClientMessageEx(offeredby, COLOR_RED, "** You have lost $%i from your dice bet with %s.", amount, GetPlayerRPName(playerid)); if(amount > 10000 && !strcmp(GetPlayerIP(offeredby), GetPlayerIP(playerid))) { SendAdminMessage(COLOR_YELLOW, "AdmWarning: %s (IP: %s) won a $%i dice bet against %s (IP: %s).", GetPlayerRPName(playerid), GetPlayerIP(playerid), amount, GetPlayerRPName(offeredby), GetPlayerIP(offeredby)); } } PlayerInfo[playerid][pDiceOffer] = INVALID_PLAYER_ID; }