Skip to content

Commit ce62f9a

Browse files
authored
Update README.md
1 parent 5b15a08 commit ce62f9a

File tree

1 file changed

+54
-2
lines changed

1 file changed

+54
-2
lines changed

README.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,54 @@
1-
# textdraw-simple-click
2-
This include shortens and simplifies the creation of actions for textdraws. It also reduces response time.
1+
# 🫧 Textdraw Simple Click
2+
This include will streamline your modding and creation of textdraw clicks, eliminating the need for hooks or ALS. With this small change, the clicks will be 200% faster and more efficient, thereby reducing CPU usage and improving your server's responsiveness.
3+
4+
# 📃 Usage example
5+
## Registering the clicks, see example below
6+
```pawn
7+
stock CreateTextdraw(playerid) {
8+
9+
// A simple example of textdraw creation, just to illustrate SetClick.
10+
new PlayerText:id = CreatePlayerTextDraw(playerid, 0.0, 0.0, "LD_SPAC:white") // or box, whatever
11+
PlayerTextDrawSetSelectable(playerid, id, true);
12+
13+
PlayerTextDrawSetClick(playerid, "ClickLogin", id);
14+
SelectTextDraw(playerid, -1);
15+
}
16+
17+
PlayerTextDrawClick:ClickLogin(playerid, params) {
18+
19+
// your code
20+
return true;
21+
}
22+
```
23+
24+
## Now a click registration with parameters (can be used with loops, for example, inventory slots, etc.)
25+
```pawn
26+
stock CreateTextdraw(playerid) {
27+
28+
// A simple example of textdraw creation, just to illustrate SetClick.
29+
new PlayerText:inventario_slot[3];
30+
31+
inventario_slot[0] = CreatePlayerTextDraw(playerid, 0.0, 0.0, "LD_SPAC:white")
32+
PlayerTextDrawSetSelectable(playerid, inventario_slot[0], true);
33+
34+
inventario_slot[1] = CreatePlayerTextDraw(playerid, 0.0, 0.0, "LD_SPAC:white")
35+
PlayerTextDrawSetSelectable(playerid, inventario_slot[1], true);
36+
37+
inventario_slot[2] = CreatePlayerTextDraw(playerid, 0.0, 0.0, "LD_SPAC:white")
38+
PlayerTextDrawSetSelectable(playerid, inventario_slot[2], true);
39+
40+
for(new i = 0; i < sizeof inventario_slot; i++)
41+
PlayerTextDrawSetClick(playerid, "InventorySlot", inventario_slot[i], i);
42+
43+
SelectTextDraw(playerid, -1);
44+
}
45+
46+
PlayerTextDrawClick:InventorySlot(playerid, slot_inventory) {
47+
48+
// your code
49+
return true;
50+
}
51+
```
52+
53+
# 🔨 Results
54+
In tests I conducted, the clicks became extremely more responsive and faster because the code doesn't need to search for the correct PlayerText to run the code. If you encounter any problems, please open an issue so I can assist you. 😊

0 commit comments

Comments
 (0)