Textdraw options
#1

Can we make a textdraw with more than 1 option, just like when some one enter a checkpoint, a textdraw box appears to him:
1- some option
2- some option
3- some option

and when he type a number, it will do something to him.

can this something happen ?
Reply
#2

Like This ?

Код:
#define CHECKP 19116
Код:
CMD:Checkpoint(playerid, params[])
{
/* exemple*/
        SetPlayerCheckpoint(playerid, 2440.01, -2118.47, 13.55, 5);
        return 1;
}
Код:
public OnPlayerEnterCheckpoint(playerid)
{
        new string[128];
        Format(string,sizeof(string),"option 1\n option 2 \n option 3");
        ShowPlayerDialog(playerid,CHECKP,DIALOG_STYLE_LIST,"Select on of the options:",string,"Select","Back");
        DisablePlayerCheckpoint(playerid);
	return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(dialogid == CHECKP)
	{ 
	    if(response)
        
		{
                        if(listitem == 0) // option 1
			{
			// add some functions //	
			}
	                 else if(listitem == 1) // option 2
			{
			// add some functions //	
			}
                         else if(listitem == 2) // option 3
		        {
			// add some functions //	
		        }
		}
            return 1;
		
	}
.
Reply
#3

no not like that at all
i mean if someone enter a checkpoint, it will appear to him a textdraws options, when he type an option number, it will make something to him.
example:
when you drive into a checkpoint, it will appear a textdraws option:
1- repair vehicle
2- refuel vehicle
3- add nitrus
when he type (1) , it will repair his vehicle.
it's like dialogboxes, but in textdraws style.
Reply
#4

i think it's something about:
pawn Код:
public OnPlayerText(playerid, text[])
maybe!
Reply
#5

https://sampforum.blast.hk/showthread.php?tid=412741

found this
Reply
#6

thanks for reply but it's not what i want, maybe i will use "OnTextDrawDialogResponse"
what i want is when u go to a checkpoint, a simple textdraw options in small box will appear to you and you have to reply using f6 by the number you want.
Reply
#7

I am not 100% sure what u mean but I think I do..
Код:
//add a 'new' at the top of your script 
new options[MAX_PLAYERS];
//on the player enter checkpoint add something like
TextDrawShowForPlayer// I don't know how to use them but display the options 

And then add options[playerid] = 1;

//under onplayertext
Add 
if(options[playerid] == 1)
{
      if(text[playerid] == "1")
      {
             //do something
      }
      Else if(text[playerid] == "2")
       
}
I would guess something like that.. I would try to explain better but I am on my phone so.. It's hard to script on a phone to say it that way..
Reply
#8

thank you, but it's sure that there is another another way to do it because what if you have more than one checkpoint and each checkpoint has its own textdraw, so how
Reply
#9

OnPlayerClickTextdraw
TextDrawSetSelectable
SelectTextDraw
CancelSelectTextDraw

PS: Found this: https://sampforum.blast.hk/showthread.php?tid=328267.
Reply
#10

thanks for information, but i don't want to use mouse, i said "Reply" = "Type a number"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)