TextDraw not Showing
#1

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
new PlayerText:MessagesTD;
#if defined FILTERSCRIPT
new RandMsg[][] =
{
	" Welcome to Social Gaming Roleplay! If you are new type /help and /tlaws before you start.",
	" New here? Go to the DMV at city hall and get your drivers license!",
	" VIP is only given out if you buy it off the marketplace: www.samp-sgrp.enjin.com",
	" Found a bug? Submit a bug report @ www.samp-sgrp.com",
	" Want an exotic car? A custom house? Check out the marketplace: www.samp-sgrp.enjin.com",
	" Our website www.samp-sgrp.enjin.com has forums and info on our server!",
	" Note: This is not a DM server. You must roleplay your actions!",
	" The Pizza Delivery & Trucking Jobs are hiring workers, earn quick cash.",
	" Commercial Trucking is Blueberry is now available, earn up to 55k for a single truck load.",
	" If you are new and need help type /requesthelp and an moderator will contact you!",
	" Join us on Teamspeak 3 - server: Comming Soon.",
	" Obey all traffic laws! Check /tlaws if you are not sure.",
	" Obey all speed laws! Check /speedlaws if you are not sure.",
	" Government jobs (Fire) are only posted at www.samp-sgrp.enjin.com.",
	" We are recruiting RR towing, TPS, News Staff, and LAFD - apply @ www.samp-sgrp.enjin.com.",
	" Hacks are NOT tolerated! If you see someone hacking, Use /report to tell an admin.",
	" TPS is hiring staff, check the post @ www.samp-sgrp.enjin.com to apply.",
	" CCFD & LAFD are hiring paramedics, check the post @ www.samp-sgrp.enjin.com to apply.",
	" RR Towing needs mechanics & drivers, check the post @ www.samp-sgrp.enjin.com to apply.",
	" Want to get VIP? Visit the marketplace @ www.samp-sgrp.enjin.com , for details!",
	" This is a Medium-RP server. Use /requesthelp for more info.",
	" New here? Don't know how to roleplay? Find out by using the /rpguide command!",
	" To work for LVMPD/PD/SD, you have to get hired with LAFD or DOC & get selected for the position!",
	" Get Custom Houses, Cars, VIP and more at the PLA Marketplace @ www.samp-sgrp.enjin.com.",
	" Need your car parked? Need any help type? /requesthelp and an moderator will be assist you!",
	" We need additional staff! Check the job postings board @ www.samp-sgrp.enjin.com for details",
	" Report any and all server advertisers to an admin via /am , a reward will be given!",
	" Fox 11 is hiring staff, check the post @ www.samp-sgrp.enjin.com to apply today!",
	" Tired of seeing these textdraw's? Wanna hide them? Simply type /togtds to turn them on and off!",
	" LA:G Marketplace and VIP items are NOT to be sold to other players for in game cash!"
};
stock PlayerText:CreateCurrentPageTextDraw(playerid, Float:Xpos, Float:Ypos)
{
	new PlayerText:txtInit;
   	txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, "0/0");
   	PlayerTextDrawUseBox(playerid, txtInit, 0);
	PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1);
	PlayerTextDrawFont(playerid, txtInit, 1);
	PlayerTextDrawSetShadow(playerid, txtInit, 0);
    PlayerTextDrawSetOutline(playerid, txtInit, 1);
    PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF);
    PlayerTextDrawShow(playerid, txtInit);
    return txtInit;
}

stock PlayerText:CreatePlayerDialogButton(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height, button_text[])
{
 	new PlayerText:txtInit;
   	txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, button_text);
   	PlayerTextDrawUseBox(playerid, txtInit, 1);
   	PlayerTextDrawBoxColor(playerid, txtInit, 0x000000FF);
   	PlayerTextDrawBackgroundColor(playerid, txtInit, 0x000000FF);
	PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1);
	PlayerTextDrawFont(playerid, txtInit, 1);
	PlayerTextDrawSetShadow(playerid, txtInit, 0); // no shadow
    PlayerTextDrawSetOutline(playerid, txtInit, 0);
    PlayerTextDrawColor(playerid, txtInit, 0x4A5A6BFF);
    PlayerTextDrawSetSelectable(playerid, txtInit, 1);
    PlayerTextDrawAlignment(playerid, txtInit, 2);
    PlayerTextDrawTextSize(playerid, txtInit, Height, Width); // The width and height are reversed for centering.. something the game does <g>
    PlayerTextDrawShow(playerid, txtInit);
    return txtInit;
}

stock PlayerText:CreatePlayerHeaderTextDraw(playerid, Float:Xpos, Float:Ypos, header_text[])
{
	new PlayerText:txtInit;
   	txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, header_text);
   	PlayerTextDrawUseBox(playerid, txtInit, 0);
	PlayerTextDrawLetterSize(playerid, txtInit, 1.25, 3.0);
	PlayerTextDrawFont(playerid, txtInit, 0);
	PlayerTextDrawSetShadow(playerid, txtInit, 0);
    PlayerTextDrawSetOutline(playerid, txtInit, 1);
    PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF);
    PlayerTextDrawShow(playerid, txtInit);
    return txtInit;
}

stock PlayerText:CreatePlayerBackgroundTextDraw(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height)
{
	new PlayerText:txtBackground = CreatePlayerTextDraw(playerid, Xpos, Ypos,
	"                                            ~n~"); // enough space for everyone
    PlayerTextDrawUseBox(playerid, txtBackground, 1);
    PlayerTextDrawBoxColor(playerid, txtBackground, 0x4A5A6BBB);
	PlayerTextDrawLetterSize(playerid, txtBackground, 5.0, 5.0);
	PlayerTextDrawFont(playerid, txtBackground, 0);
	PlayerTextDrawSetShadow(playerid, txtBackground, 0);
    PlayerTextDrawSetOutline(playerid, txtBackground, 0);
    PlayerTextDrawColor(playerid, txtBackground,0x000000FF);
    PlayerTextDrawTextSize(playerid, txtBackground, Width, Height);
   	PlayerTextDrawBackgroundColor(playerid, txtBackground, 0x4A5A6BBB);
    PlayerTextDrawShow(playerid, txtBackground);
    return txtBackground;
}

stock PlayerText:CreateModelPreviewTextDraw(playerid, modelindex, Float:Xpos, Float:Ypos, Float:width, Float:height)
{
    new PlayerText:txtPlayerSprite = CreatePlayerTextDraw(playerid, Xpos, Ypos, ""); // it has to be set with SetText later
    PlayerTextDrawFont(playerid, txtPlayerSprite, TEXT_DRAW_FONT_MODEL_PREVIEW);
    PlayerTextDrawColor(playerid, txtPlayerSprite, 0xFFFFFFFF);
    PlayerTextDrawBackgroundColor(playerid, txtPlayerSprite, 0x88888899);
    PlayerTextDrawTextSize(playerid, txtPlayerSprite, width, height); // Text size is the Width:Height
    PlayerTextDrawSetPreviewModel(playerid, txtPlayerSprite, modelindex);
    PlayerTextDrawSetSelectable(playerid, txtPlayerSprite, 1);
    PlayerTextDrawShow(playerid,txtPlayerSprite);
    return txtPlayerSprite;
}

forward ShowHelp();
public ShowHelp()
{
	new i = random(sizeof(RandMsg));
	foreach(Player, p)
	{
		PlayerTextDrawSetString(p, MessagesTD, RandMsg[i]);
	}
}

public OnFilterScriptInit()
{
	MessagesTD = CreatePlayerTextDraw(playerid, 70.000000, 432.000000, "");
    PlayerTextDrawBackgroundColor(playerid, MessagesTD, 255);
    PlayerTextDrawFont(playerid, MessagesTD, 1);
    PlayerTextDrawLetterSize(playerid, MessagesTD, 0.220000, 1.000000);
    PlayerTextDrawColor(playerid, MessagesTD, -1);
    PlayerTextDrawSetOutline(playerid, MessagesTD, 0);
    PlayerTextDrawSetProportional(playerid, MessagesTD, 1);
    PlayerTextDrawSetShadow(playerid, MessagesTD, 1);
    return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    PlayerTextDrawDestroy(playerid, MessagesTD);
	return 1;
}

public OnPlayerSpawn(playerid)
{
    PlayerTextDrawShow(playerid, MessagesTD);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  	{
	}
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
Reply
#2

Use TextDrawShowForPlayer(playerid, textid);
It's on WIKI click it here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)