警告
此回调是在SA-MP 0.3e中添加的,在早期版本中不起作用!
描述
当玩家单击文本绘制或使用 Escape 键取消选择模式时,会调用此回调。
| 姓名 |
描述 |
| playerid |
单击文本绘制的玩家的 ID。 |
| clickedid |
单击的textdraw的ID。如果取消选择,则为 INVALID_TEXT_DRAW。 |
退货
它总是在过滤器脚本中首先被调用,因此返回 1 也会阻止其他脚本看到它。
例子
new Text:gTextDraw;public OnGameModeInit(){ gTextDraw = TextDrawCreate(10.000000, 141.000000, "MyTextDraw"); TextDrawTextSize(gTextDraw,60.000000, 20.000000); TextDrawAlignment(gTextDraw,0); TextDrawBackgroundColor(gTextDraw,0x000000ff); TextDrawFont(gTextDraw,1); TextDrawLetterSize(gTextDraw,0.250000, 1.000000); TextDrawColor(gTextDraw,0xffffffff); TextDrawSetProportional(gTextDraw,1); TextDrawSetShadow(gTextDraw,1); TextDrawSetSelectable(gTextDraw, 1); return 1;}public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){ if (newkeys == KEY_SUBMISSION) { TextDrawShowForPlayer(playerid, gTextDraw); SelectTextDraw(playerid, 0xFF4040AA); } return 1;}public OnPlayerClickTextDraw(playerid, Text:clickedid){ if (clickedid == gTextDraw) { SendClientMessage(playerid, 0xFFFFFFAA, "You clicked on a textdraw."); CancelSelectTextDraw(playerid); return 1; } return 0;}
笔记
警告
可点击区域由TextDrawTextSize定义。传递给该函数的 x 和 y 参数不得为零或负数。不要在此回调中无条件使用CancelSelectTextDraw。这会导致无限循环。