13.01.2013, 07:27
I tried the TextDrawSetPreviewModel thingy, but it doesn't work. On typing /acmds, which is the cue for showing the textdraw models, it doesn't load at all, just enables the cursor and no visible textdraw's on the screen. Why does this happen? I tried using an array for the PlayerText, so read this before suggesting!
This is the code, pretty small, as I am just testing it.
The Textdraw0 is supposed to be a huge box with Textdraw1 and Textdraw2 little boxes in it, as options.
This is the code, pretty small, as I am just testing it.
The Textdraw0 is supposed to be a huge box with Textdraw1 and Textdraw2 little boxes in it, as options.
pawn Код:
//=============================DEFINES AND INCLUDES================================
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define DIALOG_CAGE 1
//=================================NEW VARIABLES=========================================
new PlayerText:Textdraw0[MAX_PLAYERS];
new PlayerText:Textdraw1;
new PlayerText:Textdraw2;
//===================================FUNCTIONS==========================================
public OnFilterScriptInit()
{
return 1;
}
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
if(playertextid==Textdraw1 ||playertextid==Textdraw2)
print("Clicked.");
ShowPlayerDialog(playerid,DIALOG_CAGE,DIALOG_STYLE_MSGBOX,"Cage a player.","Enter the name or ID of the player you want to cage.","Cage","Exit");
return 1;
}
public OnPlayerText(playerid, text[])
{
Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 562.819946, 121.666664, "usebox");
PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.000000, 27.294448);
PlayerTextDrawTextSize(playerid, Textdraw0[playerid], 97.326492, 0.000000);
PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw0[playerid], 0);
PlayerTextDrawUseBox(playerid, Textdraw0[playerid], true);
PlayerTextDrawBoxColor(playerid, Textdraw0[playerid], 102);
PlayerTextDrawSetShadow(playerid, Textdraw0[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 0);
PlayerTextDrawFont(playerid, Textdraw0[playerid], 0); // MAIN BOX.
Textdraw1 = CreatePlayerTextDraw(playerid, 250.784774, 154.333343, "_");
PlayerTextDrawFont(playerid, Textdraw1, TEXT_DRAW_FONT_MODEL_PREVIEW);
PlayerTextDrawUseBox(playerid, Textdraw1, 1);
PlayerTextDrawBoxColor(playerid, Textdraw1, 0x000000FF);
PlayerTextDrawTextSize(playerid, Textdraw1, 40.0, 40.0);
PlayerTextDrawSetPreviewModel(playerid, Textdraw1, 411);
PlayerTextDrawSetPreviewRot(playerid, Textdraw1, -10.0, 0.0, -20.0, 1.0); //Used infernus to test first.
Textdraw2 = CreatePlayerTextDraw(playerid, 250.784774, 154.333343, "_");
PlayerTextDrawFont(playerid, Textdraw2, TEXT_DRAW_FONT_MODEL_PREVIEW);
PlayerTextDrawUseBox(playerid, Textdraw2, 1);
PlayerTextDrawBoxColor(playerid, Textdraw2, 0x000000FF);
PlayerTextDrawTextSize(playerid, Textdraw2, 40.0, 40.0);
PlayerTextDrawSetPreviewModel(playerid, Textdraw2, 411);
PlayerTextDrawSetPreviewRot(playerid, Textdraw2, -10.0, 0.0, -20.0, 1.0);
return 1;
}
//==============================FUNCTIONS=================================
new cage[MAX_PLAYERS], cage2[MAX_PLAYERS], cage3[MAX_PLAYERS], cage4[MAX_PLAYERS], caged[MAX_PLAYERS];
stock CagePlayer(playerid)
{
if(IsPlayerConnected(playerid))
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
cage[playerid] = CreateObject(985, X, Y+4, Z, 0.0, 0.0, 0.0);
cage2[playerid] = CreateObject(985, X+4, Y, Z, 0.0, 0.0, 90.0);
cage3[playerid] = CreateObject(985, X-4, Y, Z, 0.0, 0.0, 270.0);
cage4[playerid] = CreateObject(985, X, Y-4, Z, 0.0, 0.0, 180.0);
caged[playerid] = 1; // Use this in a /cage command to prevent being caged twice and causing the cage to be unremovable.
PlayerPlaySound(playerid, 1137, X, Y, Z);
}
}
//==============================================================================
//=====================COMMANDS=============================================
CMD:acmds(playerid,params[])
{
PlayerTextDrawShow(playerid,Textdraw0[playerid]);
PlayerTextDrawShow(playerid,Textdraw1);
PlayerTextDrawShow(playerid,Textdraw2);
SelectTextDraw(playerid,5);
SendClientMessage(playerid,-1,"Done.");
return 1;
}