Selecting textdraws with keys
#1

Hi guys.

Title explains my question. How can I select a textdraw using keys instead of mouse? Thank you.
Reply
#2

Код:
// This variable is used to store the id of the textdraw
// so that we can use it throught the script
new Text:welcomeText; 
 
public OnGameModeInit()
{
    // This line is used to create the textdraw. 
    // Note: This creates a textdraw without any formatting.
    welcomeText = TextDrawCreate(240.0,580.0,"Welcome to my SA-MP server");
    return 1;
}
 
public OnPlayerConnect(playerid)
{
    //This is used to show the player the textdraw when they connect.
    TextDrawShowForPlayer(playerid,welcomeText);
}
Reply
#3

Quote:
Originally Posted by Bomber07
Посмотреть сообщение
Код:
// This variable is used to store the id of the textdraw
// so that we can use it throught the script
new Text:welcomeText; 
 
public OnGameModeInit()
{
    // This line is used to create the textdraw. 
    // Note: This creates a textdraw without any formatting.
    welcomeText = TextDrawCreate(240.0,580.0,"Welcome to my SA-MP server");
    return 1;
}
 
public OnPlayerConnect(playerid)
{
    //This is used to show the player the textdraw when they connect.
    TextDrawShowForPlayer(playerid,welcomeText);
}
This is nothing to do with what he actually asked for...

You cannot really select a textdraw with keyboard. I assume you mean an alternative to OnPlayerClickTextDraw. How would sa-mp know what textdraw you want selected? There's no X,Y screen coordinates for keyboards like there is for mice
Reply
#4

You can use a variable and the keys to change TextDraws properties (depending on the variable's value).
Reply
#5

Quote:
Originally Posted by !damo!spiderman
Посмотреть сообщение
This is nothing to do with what he actually asked for...

You cannot really select a textdraw with keyboard. I assume you mean an alternative to OnPlayerClickTextDraw. How would sa-mp know what textdraw you want selected? There's no X,Y screen coordinates for keyboards like there is for mice
Thank you for letting me know.

There is a workaround I guess.

Quote:
Originally Posted by [DOG]irinel1996
Посмотреть сообщение
You can use a variable and the keys to change TextDraws properties (depending on the variable's value).
Variables, timer, GetPlayerKeys and textdraw settings?

I'll give it a try.

Thank you.
Reply
#6

Actually you don't need a timer, you can use OnPlayerUpdate (with GetPlayerKeys) and GetTickCount. Give a try, there's nothing better than something when you make it by yourself. If you need help, just ask here and I'll help you.

Best regards.
Reply
#7

You could show the player the textdraws, and set a variable if he's in the selection.

Then under OnPlayerKeyStateChange, you check if is the player is in the selection. If they press the arrow keys for example, you give them the illusion that they are scrolling through the selection, using different colors for the 'currently selected' and the other.

If the player presses the next keys, you make the next button the other color and set the other back. With the same method you can keep track of which button he is at, so that when he presses the confirm key, the righ function pops up.
Reply
#8

Quote:
Originally Posted by shadowdog
Посмотреть сообщение
You could show the player the textdraws, and set a variable if he's in the selection.

Then under OnPlayerKeyStateChange, you check if is the player is in the selection. If they press the arrow keys for example, you give them the illusion that they are scrolling through the selection, using different colors for the 'currently selected' and the other.

If the player presses the next keys, you make the next button the other color and set the other back. With the same method you can keep track of which button he is at, so that when he presses the confirm key, the righ function pops up.
We have a problem there, OnPlayerKeyStateChange isn't called for directional keys.

But that's the idea, yes.
Reply
#9

Quote:
Originally Posted by Bomber07
Посмотреть сообщение
Код:
// This variable is used to store the id of the textdraw
// so that we can use it throught the script
new Text:welcomeText; 
 
public OnGameModeInit()
{
    // This line is used to create the textdraw. 
    // Note: This creates a textdraw without any formatting.
    welcomeText = TextDrawCreate(240.0,580.0,"Welcome to my SA-MP server");
    return 1;
}
 
public OnPlayerConnect(playerid)
{
    //This is used to show the player the textdraw when they connect.
    TextDrawShowForPlayer(playerid,welcomeText);
}
Nice copy & paste..dumb you didnt read his question.

Edit: you should ask gammix he uses directional key to change textdraw in his gta v menu include... or if u have enough pawn knowledge check his include to understand yourself...
cheers.
Reply
#10

Quote:
Originally Posted by [ND]xXZeusXx.
Посмотреть сообщение
Originally Posted by MafiaOink View Post

i am from pakistan and i love bombing and ak47 attack
I think one should not comment without knowing the reality.As this is not a political forum so I'll limit my comment to this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)