TextDraw Help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: TextDraw Help (
/showthread.php?tid=625442)
TextDraw Help -
RyderX - 01.01.2017
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.cfg)
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.000000, 116.000000, "Name:");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 3);
TextDrawLetterSize(Textdraw0, 0.500000, 1.100000);
TextDrawColor(Textdraw0, -16776961);
TextDrawSetOutline(Textdraw0, 1);
TextDrawSetProportional(Textdraw0, 1);
Textdraw1 = TextDrawCreate(467.000000, 151.000000, "Score:");
TextDrawBackgroundColor(Textdraw1, 255);
TextDrawFont(Textdraw1, 3);
TextDrawLetterSize(Textdraw1, 0.500000, 1.399999);
TextDrawColor(Textdraw1, 16711935);
TextDrawSetOutline(Textdraw1, 1);
TextDrawSetProportional(Textdraw1, 1);
Textdraw2 = TextDrawCreate(500.000000, 134.000000, "ID:");
TextDrawBackgroundColor(Textdraw2, 255);
TextDrawFont(Textdraw2, 3);
TextDrawLetterSize(Textdraw2, 0.500000, 1.200000);
TextDrawColor(Textdraw2, -16711681);
TextDrawSetOutline(Textdraw2, 1);
TextDrawSetProportional(Textdraw2, 1);
Textdraw3 = TextDrawCreate(477.000000, 173.000000, "Cash:");
TextDrawBackgroundColor(Textdraw3, 255);
TextDrawFont(Textdraw3, 3);
TextDrawLetterSize(Textdraw3, 0.500000, 1.500000);
TextDrawColor(Textdraw3, 16777215);
TextDrawSetOutline(Textdraw3, 1);
TextDrawSetProportional(Textdraw3, 1);
for(new i; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
TextDrawShowForPlayer(i, Textdraw0);
TextDrawShowForPlayer(i, Textdraw1);
TextDrawShowForPlayer(i, Textdraw2);
TextDrawShowForPlayer(i, Textdraw3);
}
}
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
.
Re: TextDraw Help -
BiosMarcel - 01.01.2017
You must understand, that it doesn't work like that in this section.
Re: TextDraw Help - iLearner - 01.01.2017
With a command or all-time ?
Re: TextDraw Help -
RyderX - 01.01.2017
Quote:
Originally Posted by iLearner
With a command or all-time ?
|
all-time, btw under OnPlayerSpawn
Re: TextDraw Help -
RyderX - 01.01.2017
Help me please!
REP+ for the Helper!!
Re: TextDraw Help -
RyderX - 01.01.2017
Help me!!
Re: TextDraw Help -
lackmail - 01.01.2017
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
Re: TextDraw Help -
RyderX - 01.01.2017
okay wait until i test this.
Re: TextDraw Help -
RyderX - 01.01.2017
lackmail,
how to do it in score way?
here's code:
PHP код:
Dude,
new score[128]; new pscore[MAX_PLAYER_SCORE];
GetPlayerScore(playerid);
format(score, sizeof(score), "Score: %s", pscore);
TextDrawSetString(Textdraw23[playerid], score);
Re: TextDraw Help -
oMa37 - 02.01.2017
This explain it all:
Quote:
Originally Posted by RyderX
lackmail,
how to do it in score way?
here's code:
|