Textdraws Use
#1

Hello Everyone,

In some servers i saw textdraws and players can enter number to choose there option.
I was wondering how to do it , easily.
If anyone can help then please post below.
Helper will get rep++

Thank you
Pulkit
Reply
#2

Anyone?
Reply
#3

Create textdraws, then use OnPlayerClickTextdraw (PlayerTextdraw) to detect which textdraw was clicked and you should be able to do it. Or you can use https://sampforum.blast.hk/showthread.php?tid=329097
Reply
#4

One of the SA-MP functions work by detecting when you click on a text draw. They may be using this - https://sampwiki.blast.hk/wiki/OnPlayerClickTextDraw.

Edit: Hahah. Rajat just before I did.
Reply
#5

I mean textdraw displays numbers like :-

1.Terrorist
2.Army

Then when players types 1 he gets in terrorist team and when he types 2 he gets in army team
Reply
#6

When displaying the data, each data item that is displayed basically gets its own ID for players to enter. The system you're talking about is seen on CrazyBob's CnR mode.

Honestly, the best way I could describe it to you is with this code:

pawn Код:
// create some variables ...

new
    szMainString[128],
    szString[50]
;

// start a loop that processes MAX_ITEM's times (i.e. MAX_ITEMS could be defined as 271, so it will process the loop 271 times

for(new i = 0; i < MAX_ITEMS; i++) // loop, processing ...
{
    format(szString, sizeof(szString), "%d: %s", i, szItemName); // format a string that we can show on the TD
   
    strcat(szMainString, szString); // put the formatted string above into a different variables for future purposes
    strcat(szMainString, "\n"); // add a new line between entries
}

TextDrawSetString(text_ShowItems, szMainString); // set the TD to show the string that all of the formatted strings above have been crammed into
In the code, "i" corresponds with each szItemName. While it obviously doesn't include retrieving the "number" that the player entered, it shows you the start to such a system.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)