TextDraw Help
#1

Hello guys, so im planning to show player his stats using textdraw, i've made all textdraws and allthing done but just i need to connect player stats to them, like:
Name: %s....

Here's my code:
PHP код:
/*
Filterscript generated using Zamaroht's TextDraw Editor Version 1.0.
Designed for SA-MP 0.3a.
Time and Date: 2017-1-1 @ 0:28:13
Instructions:
1- Compile this file using the compiler provided with the sa-mp server package.
2- Copy the .amx file to the filterscripts directory.
3- Add the filterscripts in the server.cfg file (more info here:
https://sampwiki.blast.hk/wiki/Server.cf...3.04758526
4- Run the server!
Disclaimer:
You have full rights over this file. You can distribute it, modify it, and
change it as much as you want, without having to give any special credits.
*/
#include <a_samp>
new Text:Textdraw0;
new 
Text:Textdraw1;
new 
Text:Textdraw2;
new 
Text:Textdraw3;
public 
OnFilterScriptInit()
{
    print(
"Textdraw file generated by");
    print(
"    Zamaroht's textdraw editor was loaded.");
    
// Create the textdraws:
    
Textdraw0 TextDrawCreate(471.000000116.000000"Name:");
    
TextDrawBackgroundColor(Textdraw0255);
    
TextDrawFont(Textdraw03);
    
TextDrawLetterSize(Textdraw00.5000001.100000);
    
TextDrawColor(Textdraw0, -16776961);
    
TextDrawSetOutline(Textdraw01);
    
TextDrawSetProportional(Textdraw01);
    
Textdraw1 TextDrawCreate(467.000000151.000000"Score:");
    
TextDrawBackgroundColor(Textdraw1255);
    
TextDrawFont(Textdraw13);
    
TextDrawLetterSize(Textdraw10.5000001.399999);
    
TextDrawColor(Textdraw116711935);
    
TextDrawSetOutline(Textdraw11);
    
TextDrawSetProportional(Textdraw11);
    
Textdraw2 TextDrawCreate(500.000000134.000000"ID:");
    
TextDrawBackgroundColor(Textdraw2255);
    
TextDrawFont(Textdraw23);
    
TextDrawLetterSize(Textdraw20.5000001.200000);
    
TextDrawColor(Textdraw2, -16711681);
    
TextDrawSetOutline(Textdraw21);
    
TextDrawSetProportional(Textdraw21);
    
Textdraw3 TextDrawCreate(477.000000173.000000"Cash:");
    
TextDrawBackgroundColor(Textdraw3255);
    
TextDrawFont(Textdraw33);
    
TextDrawLetterSize(Textdraw30.5000001.500000);
    
TextDrawColor(Textdraw316777215);
    
TextDrawSetOutline(Textdraw31);
    
TextDrawSetProportional(Textdraw31);
    for(new 
iMAX_PLAYERS++)
    {
        if(
IsPlayerConnected(i))
        {
            
TextDrawShowForPlayer(iTextdraw0);
            
TextDrawShowForPlayer(iTextdraw1);
            
TextDrawShowForPlayer(iTextdraw2);
            
TextDrawShowForPlayer(iTextdraw3);
        }
    }
    return 
1;
}
public 
OnFilterScriptExit()
{
    
TextDrawHideForAll(Textdraw0);
    
TextDrawDestroy(Textdraw0);
    
TextDrawHideForAll(Textdraw1);
    
TextDrawDestroy(Textdraw1);
    
TextDrawHideForAll(Textdraw2);
    
TextDrawDestroy(Textdraw2);
    
TextDrawHideForAll(Textdraw3);
    
TextDrawDestroy(Textdraw3);
    return 
1;

Thanks in advance .
Reply
#2

You must understand, that it doesn't work like that in this section.
Reply
#3

With a command or all-time ?
Reply
#4

Quote:
Originally Posted by iLearner
Посмотреть сообщение
With a command or all-time ?
all-time, btw under OnPlayerSpawn
Reply
#5

Help me please!
REP+ for the Helper!!
Reply
#6

Help me!!
Reply
#7

ill do the name textdraw for example you complete the rest

Код:
new Text:Textdraw0[MAX_PLAYERS];

public OnFilterScriptInit()
{
    for(new i; i < MAX_PLAYERS; i ++)
    {
	    Textdraw0[i] = TextDrawCreate(471.000000, 116.000000, "Name:");
	    TextDrawBackgroundColor(Textdraw0[i], 255);
	    TextDrawFont(Textdraw0[i], 3);
	    TextDrawLetterSize(Textdraw0[i], 0.500000, 1.100000);
	    TextDrawColor(Textdraw0[i], -16776961);
	    TextDrawSetOutline(Textdraw0[i], 1);
	    TextDrawSetProportional(Textdraw0[i], 1);
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
	new nametext[MAX_PLAYER_NAME+6], pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(nametext, sizeof(nametext), "Name: %s", pname);
	TextDrawSetString(Textdraw0[playerid], nametext);
    return 1;
}

public OnPlayerSpawn(playerid)
{
	TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
    return 1;
}
check the code again i changed the line in red color
Reply
#8

okay wait until i test this.
Reply
#9

lackmail,

how to do it in score way?

here's code:

PHP код:
Dude
new 
score[128]; new pscore[MAX_PLAYER_SCORE];
    
GetPlayerScore(playerid);
    
format(scoresizeof(score), "Score: %s"pscore);
    
TextDrawSetString(Textdraw23[playerid], score); 
Reply
#10

This explain it all:


Quote:
Originally Posted by RyderX
Посмотреть сообщение
lackmail,

how to do it in score way?

here's code:

PHP код:
... 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)