28.06.2015, 14:58
Hi guys. 
Title explains my question. How can I select a textdraw using keys instead of mouse? Thank you.

Title explains my question. How can I select a textdraw using keys instead of mouse? Thank you.
// 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 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 |
You can use a variable and the keys to change TextDraws properties (depending on the variable's value).
|
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. |
Код:
// 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); } |