12.07.2014, 11:30
Hey, i made a /playdice command which is implemented when /accept dice is used, but After once we have done /playdice [playerid] it is continiously possible to /accept dice rather it should return Nobody invited you to play dice, here is my /accept dice code.
Help will be really appreciated.
pawn Код:
else if(!strcmp(params, "dice", true))
{
new playerb = DiceBy[playerid], gal1, gal2;
if(playerb == -1) return SendClientMessage(playerid, COLOR_GREY, "Nobody has offered you to play dice.");
new price = DiceMoney[playerb][playerid];
if(PlayerInfo[playerid][pMoney] < price) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much money on you.");
gal1 = 1+random(6);
gal2 = 1+random(6);
format(string, sizeof(string), "* God rolls a pair of dice on the floor, the first dice shows %d while the other shows %d.", gal1, gal2);
SendNearbyMessage(playerid, 4, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
if(gal1 > gal2)
{
GivePlayerMoney(playerid, -price);
GivePlayerMoney(playerb, price);
format(string, sizeof(string), "%s has paid $%d to you as he lost in the dice!", RPN(playerid), price);
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
}
else
{
GivePlayerMoney(playerb, -price);
GivePlayerMoney(playerid, price);
format(string, sizeof(string), "%s has paid $%d to you as he lost in the dice!", RPN(playerb), price);
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
}
DiceMoney[playerb][playerid] = 0;
DiceBy[playerb] = -1;
}