Textdraw issue
#1

hi guys i got this textdraw witch is very simple to use etc. anyways its only using when i get inside a car


Showing the Server Tips etc.




not showing it.
Reply
#2

Where is the 'Server Tips' textdraw being put in the script?
Reply
#3

Код:
//========================================================
//+              Server Messages (Tips, motd)            +
//+                 Author: roar (farelien)              +
//========================================================
//Other Credits: - Zamaroht (Textdraw Editor)
//				 - DracoBlue (DCMD)

//========================================================
// ==> INCLUDES
//========================================================
#include <a_samp>

//========================================================
// ==> NEWs
//========================================================
new Text:ServerTips;
new Text:MessagesTD;

//========================================================
// ==> Defines
//========================================================
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

#define COL_WHITE          "{FFFFFF}"
#define COL_CYAN           "{00FFEE}"
#define COL_LGREEN         "{C9FFAB}"

//========================================================
// ==> CONFIGURATION
// ==> DialogID, Server Name, Server Message of the Day
//========================================================
#define MOTD_DIALOG        1000 	  // Change if you already have this dialog ID in your script
#define Server_Name        My Server // Change to your server's name
#define Server_Motd        Welcome to the server! Ask admin when you need help! //Change your server MOTD.

//========================================================
// ==> FORWARDs
//========================================================
forward Messages();

//========================================================
// ==> The message (tips) you want. You can edit based on
// ==> your needs.
//========================================================
new MessagesText[][] =
{
    "Welcome to our server! Please be nice and respect our staff!",
    "If you need some help, you can contact our online staff!",
    "Go to our website and register for the latest updates!"
};

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Server messages (tips and motd) has been successfully loaded!");
	print(" Author: roar (farelien)");
	print("--------------------------------------\n");
	
	//========================================================
	// ==> The Textdraws settings
	//========================================================
	ServerTips = TextDrawCreate(18.000000, 430.000000, "Server Tips:");
	TextDrawBackgroundColor(ServerTips, 255);
	TextDrawFont(ServerTips, 2);
	TextDrawLetterSize(ServerTips, 0.170000, 1.300000);
	TextDrawColor(ServerTips, 65535);
	TextDrawSetOutline(ServerTips, 1);
	TextDrawSetProportional(ServerTips, 1);
	
	MessagesTD = TextDrawCreate(70.000000, 431.000000, "");
	TextDrawBackgroundColor(MessagesTD, 255);
	TextDrawFont(MessagesTD, 1);
	TextDrawLetterSize(MessagesTD, 0.240000, 1.100000);
	TextDrawColor(MessagesTD, -1);
	TextDrawSetOutline(MessagesTD, 0);
	TextDrawSetProportional(MessagesTD, 1);
	TextDrawSetShadow(MessagesTD, 1);
	
	//========================================================
	// ==> Timers of the message (how much time the diff.
	// ==> between each messages (miliseconds - ms)
	//========================================================
	SetTimer("Messages", 30000, true); //For this, 30000ms = 1/2 minute.
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public Messages()
{
    TextDrawSetString(MessagesTD, MessagesText[random(sizeof(MessagesText))]);
}

public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid, ServerTips);
    TextDrawShowForPlayer(playerid, MessagesTD);
    
	ShowPlayerDialog(playerid, MOTD_DIALOG, DIALOG_STYLE_MSGBOX, ""COL_CYAN"Welcome to "COL_LGREEN""#Server_Name"!", ""COL_CYAN"Our message of the day: "COL_LGREEN""#Server_Motd"", "Continue", "Exit");
	return 1;
}

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

public OnPlayerDisconnect(playerid)
{
    TextDrawDestroy(Text:ServerTips);
    TextDrawDestroy(Text:MessagesTD);
    return 1;
}

i added it onplayerconnect and onplayerspawn to show it but still wont work.
Reply
#4

pawn Код:
//========================================================
//+              Server Messages (Tips, motd)            +
//+                 Author: roar (farelien)              +
//========================================================
//Other Credits: - Zamaroht (Textdraw Editor)
//               - DracoBlue (DCMD)

//========================================================
// ==> INCLUDES
//========================================================
#include <a_samp>

//========================================================
// ==> NEWs
//========================================================
new Text:ServerTips;
new Text:MessagesTD;

//========================================================
// ==> Defines
//========================================================
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

#define COL_WHITE          "{FFFFFF}"
#define COL_CYAN           "{00FFEE}"
#define COL_LGREEN         "{C9FFAB}"

//========================================================
// ==> CONFIGURATION
// ==> DialogID, Server Name, Server Message of the Day
//========================================================
#define MOTD_DIALOG        1000       // Change if you already have this dialog ID in your script
#define Server_Name        My Server // Change to your server's name
#define Server_Motd        Welcome to the server! Ask admin when you need help! //Change your server MOTD.

//========================================================
// ==> FORWARDs
//========================================================
forward Messages();

//========================================================
// ==> The message (tips) you want. You can edit based on
// ==> your needs.
//========================================================
new MessagesText[][] =
{
    "Welcome to our server! Please be nice and respect our staff!",
    "If you need some help, you can contact our online staff!",
    "Go to our website and register for the latest updates!"
};

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Server messages (tips and motd) has been successfully loaded!");
    print(" Author: roar (farelien)");
    print("--------------------------------------\n");

    //========================================================
    // ==> The Textdraws settings
    //========================================================
    ServerTips = TextDrawCreate(18.000000, 430.000000, "Server Tips:");
    TextDrawBackgroundColor(ServerTips, 255);
    TextDrawFont(ServerTips, 2);
    TextDrawLetterSize(ServerTips, 0.170000, 1.300000);
    TextDrawColor(ServerTips, 65535);
    TextDrawSetOutline(ServerTips, 1);
    TextDrawSetProportional(ServerTips, 1);

    MessagesTD = TextDrawCreate(70.000000, 431.000000, "");
    TextDrawBackgroundColor(MessagesTD, 255);
    TextDrawFont(MessagesTD, 1);
    TextDrawLetterSize(MessagesTD, 0.240000, 1.100000);
    TextDrawColor(MessagesTD, -1);
    TextDrawSetOutline(MessagesTD, 0);
    TextDrawSetProportional(MessagesTD, 1);
    TextDrawSetShadow(MessagesTD, 1);

    //========================================================
    // ==> Timers of the message (how much time the diff.
    // ==> between each messages (miliseconds - ms)
    //========================================================
    SetTimer("Messages", 30000, true); //For this, 30000ms = 1/2 minute.
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public Messages()
{
    TextDrawSetString(MessagesTD, MessagesText[random(sizeof(MessagesText))]);
}

public OnPlayerSpawn(playerid)
{
    ShowPlayerDialog(playerid, MOTD_DIALOG, DIALOG_STYLE_MSGBOX, ""COL_CYAN"Welcome to "COL_LGREEN""#Server_Name"!", ""COL_CYAN"Our message of the day: "COL_LGREEN""#Server_Motd"", "Continue", "Exit");
    return 1;
}

public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid, ServerTips);
    TextDrawShowForPlayer(playerid, MessagesTD);
    return 1;
}

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

public OnPlayerDisconnect(playerid)
{
    TextDrawDestroy(ServerTips);
    TextDrawDestroy(MessagesTD);
    return 1;
}
Try now
Reply
#5

Nope still doing it very very werid
Reply
#6

pawn Код:
new Text:ServerTips = Text:INVALID_TEXT_DRAW;
new Text:MessagesTD = Text:INVALID_TEXT_DRAW;
They need to be properly initialized otherwise trouble can arise. Also you don't need to destroy them when a player disconnects!
Reply
#7

Quote:
Originally Posted by Vince
Посмотреть сообщение
pawn Код:
new Text:ServerTips = Text:INVALID_TEXT_DRAW;
new Text:MessagesTD = Text:INVALID_TEXT_DRAW;
They need to be properly initialized otherwise trouble can arise. Also you don't need to destroy them when a player disconnects!
ino i dont need it thanks guys for replying i will try it now vince.


EDIT: still doing same.



Also i didnt see am getting a warning how do i fix this. as i never had a warning like this below.

Код:
C:\Users\Brandon\Desktop\IGRP\gamemodes\IGRP.pwn(165) : warning 201: redefinition of constant/macro (symbol "Server_Name")
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)