Giter Club home page Giter Club logo

samp-rgb-textdraw's Introduction

SAMP-RGB-Textdraw

sampctl

rgb-textdraw.inc is an include for open-mp and sa-mp.

You can add RGB to textdraw, textdraw colour will change smoothly.

Alt Text

Alt Text

How To Install

sampctl

sampctl install adib-yg/SAMP-RGB-Textdraw

Manually:

SA-MP

  1. Extract the rgb-textdraw.inc into the /pawno/include directory of your SA-MP server.
  2. Import include in your gamemode script #include <rgb-textdraw>

OPEN.MP

  1. Extract the omp-rgb-textdraw.inc into the /qawno/include directory of your OPEN.MP server.
  2. Import include in your gamemode script #include <omp-rgb-textdraw>

Note: You have to import #include <YSI_Data\y_iterate> or #include <foreach> for use this include

How To Use

// Import includes
#include <YSI_Data\y_iterate>
#include <rgb-textdraw>

// Defining textdraw variables
new Text: MyTextDraw_1;
new PlayerText: MyPlayerTextDraw_1[MAX_PLAYERS];

public OnGameModeInit() 
{
	// Create a global textdraw
	MyTextDraw_1 = TextDrawCreate(1.600000, 448.062896, "box");
	TextDrawLetterSize(MyTextDraw_1, 0.000000, 0.095000);
	TextDrawTextSize(MyTextDraw_1, 639.300170, 0.000000);
	TextDrawAlignment(MyTextDraw_1, 1);
	TextDrawColor(MyTextDraw_1, -1);
	TextDrawUseBox(MyTextDraw_1, 1);
	TextDrawBoxColor(MyTextDraw_1, 255);
	TextDrawSetShadow(MyTextDraw_1, 0);
	TextDrawBackgroundColor(MyTextDraw_1, 255);
	TextDrawFont(MyTextDraw_1, 1);
	TextDrawSetProportional(MyTextDraw_1, 1);
	
	// Add RGB to global textdraw `MyTextDraw_1`
	AddRGBToTextDraw(MyTextDraw_1, .color = false, .bgcolor = false, .boxcolor = true); // boxcolor only
}

public OnPlayerConnect(playerid) {
	// Show the global textdraw `MyTextDraw_1` for the playerid
	TextDrawShowForPlayer(playerid, MyTextDraw_1);
	
	// Create a player textdraw
	MyPlayerTextDraw_1[playerid] = CreatePlayerTextDraw(playerid, 570.396240, 132.500198, "Hello World!");
	PlayerTextDrawLetterSize(playerid, MyPlayerTextDraw_1[playerid], 0.534999, 1.634999);
	PlayerTextDrawTextSize(playerid, MyPlayerTextDraw_1[playerid], 0.000000, 133.000000);
	PlayerTextDrawAlignment(playerid, MyPlayerTextDraw_1[playerid], 2);
	PlayerTextDrawColor(playerid, MyPlayerTextDraw_1[playerid], -1);
	PlayerTextDrawSetShadow(playerid, MyPlayerTextDraw_1[playerid], 8);
	PlayerTextDrawSetOutline(playerid, MyPlayerTextDraw_1[playerid], 1);
	PlayerTextDrawBackgroundColor(playerid, MyPlayerTextDraw_1[playerid], 255);
	PlayerTextDrawFont(playerid, MyPlayerTextDraw_1[playerid], 0);
	PlayerTextDrawSetProportional(playerid, MyPlayerTextDraw_1[playerid], 1);
	
	// Add RGB to player textdraw `MyPlayerTextDraw_1`
	AddRGBToPlayerTextDraw(playerid, MyPlayerTextDraw_1[playerid], .color = true);
	
	// Show the player textdraw `MyPlayerTextDraw_1` for the playerid
	PlayerTextDrawShow(playerid, MyPlayerTextDraw_1[playerid]);
}

Note: If the textdraw string contain colors (~r~ ~y~ ...) it will have no effect, so remove them.

Functions

//Global Textdraw:
native AddRGBToTextDraw(Text:text, bool: color = true, bool: bgcolor = false, bool: boxcolor = false);
native RemoveRGBFromTextDraw(Text:text);
native SetRGBTextDrawInfo(Text:text, bool: color, bool: bgcolor, bool: boxcolor);
native RGBTextDrawShowForPlayer(playerid, Text:text);
native RGBTextDrawHideForPlayer(playerid, Text:text);

//Player Textdraw:
native AddRGBToPlayerTextDraw(playerid, PlayerText:text, bool: color = true, bool: bgcolor = false, bool: boxcolor = false);
native RemoveRGBFromPlayerTextDraw(playerid, PlayerText:text);
native SetRGBPlayerTextDrawInfo(playerid, PlayerText:text, bool: color, bool: bgcolor, bool: boxcolor);
native RGBPlayerTextDrawShow(playerid, PlayerText:text);
native RGBPlayerTextDrawHide(playerid, PlayerText:text);

Credits

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.