25.03.2015, 00:51
Quote:
Well it would not be clickable. I want them to use the command /spin when it does that it shows the textdraw of the slots. If the number is 2 then comes up it shows cherry.
so /spin generates a random number between 1-10 if its lands on 2 its cherry. otherwise its something else and so on. They dont ever have to click the textdraw. |
pawn Код:
// At the very top
new SlotNumber[MAX_PLAYERS] = -1;
new TextDraw[MAX_PLAYERS] = -1;
new Text:Noting;
new Text:Jacks;
new Text:Cherries;
// .. And so on..
forward Spining(playerid);
public OnGameModeInit()
{
// Create the 'noting', 'jacks', 'cherries', textdraws
return 1;
}
public OnPlayerConnect(playerid)
{
SlotNumber[playerid] = -1;
TextDraw[playerid] = -1;
}
// cmd for the spin
CMD:spin(playerid, params[])
{
if(!PlayerInfo[playerid][pCoin]) return SendClientMessage(playerid, COLOR_WHITE, "** You are missing coins, you cant spin. **");
SetTimerEx("Spining", 7000, false, "i", playerid);
SendClientMessage(playerid, COLOR_WHITE, "** Slot machine spining.. **");
return 1;
}
// public which will be execuded after timer ends. (7 Seconds)
public Spining(playerid)
{
new Number = random(10);
SlotNumber[playerid] = Number;
if(SlotNumber[playerid] == 0) TextDrawShowForPlayer(playerid, Noting); TextDraw[playerid] = Noting;
if(SlotNumber[playerid] == 1) TextDrawShowForPlayer(playerid, Jacks); TextDraw[playerid] = Jacks;
if(SlotNumber[playerid] == 2) TextDrawShowForPlayer(playerid, Cherries); TextDraw[playerid] = Cherries;
// .. And so on ..
SlotNumber[playerid] = -1
TextDrawHideForPlayer(playerid, TextDraw[playerid]);
return 1;
}