Textdraw issue
#1

How do I bring up the slot machine textdraw. and use it if a certain number appears. I already have the certain number thing working so it will do that perfect but how do I make that specific texdraw appear in that case.
Reply
#2

You are using playertextdraws or global once?
I'm trying understand your problem, you want people to select numbers from the textdraw so that the slot machine will respond to the select and do something about it?
Reply
#3

Yes this is correct. If it lands on the number 2 I want it to display the cherry frmo the slot machine....
Reply
#4

First make it selectable, Then show it, then what happens when he clicks you just use the public OnPlayerClickTextDraw

Here is the wiki
https://sampwiki.blast.hk/wiki/OnPlayerClickTextDraw
https://sampwiki.blast.hk/wiki/SelectTextdraw
https://sampwiki.blast.hk/wiki/CancelSelectTextDraw

Read about it and see if it fits your needs, if you need tutorial on how doing it:
https://sampforum.blast.hk/showthread.php?tid=328267
Reply
#5

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.
Reply
#6

Quote:
Originally Posted by kevin1990
Посмотреть сообщение
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.
You have to create certain textdraws (cherry and so on) and show it when the /spin command randomally found number...

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;
}
Thats how I would have done it. This is very simple and took about 2 minutes to create. I would suggest you to adjust it and add to it as you wish.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)