14.04.2014, 12:36
(
Последний раз редактировалось iFarbod; 14.04.2014 в 12:55.
Причина: Adding format
)
Hello scripters.
I mapped some text draws using Zamaroht's TD Editor.
I wanna to make a JOIN/QUIT System but not with the death messages, but with the textdraws.
i found a solution that good worked but is one thing in it i want to change it.
First, here is the code :
there is my mapped 5 text draws:
i want to messages increase from bottom.
like this :
_
_
_
_
1
then
_
_
_
1
2
then
_
_
1
2
3
then
_
1
2
3
4
then
1
2
3
4
5
then
2
3
4
5
6
...
Someone can help me?
and if it possible how to have a SendConnectMessage() function uses these textdraws.
thanks
I mapped some text draws using Zamaroht's TD Editor.
I wanna to make a JOIN/QUIT System but not with the death messages, but with the textdraws.
i found a solution that good worked but is one thing in it i want to change it.
First, here is the code :
pawn Код:
// Connect / Disconnect Textdraws © 2010, Luka P.
#include <a_samp>
#define CONNECT_MESSAGES (5)
new Text:ConnectTextdraw[CONNECT_MESSAGES];
new CurrentIndex;
public OnFilterScriptInit()
{
for(new i=0; i < CONNECT_MESSAGES; i++)
{
ConnectTextdraw[i] = TextDrawCreate(540.000000, 260.000000 + (i * -10), "_");
TextDrawAlignment(ConnectTextdraw[i], 2);
TextDrawBackgroundColor(ConnectTextdraw[i], 255);
TextDrawFont(ConnectTextdraw[i], 1);
TextDrawLetterSize(ConnectTextdraw[i], 0.200000, 1.000000);
TextDrawColor(ConnectTextdraw[i], -1);
TextDrawSetOutline(ConnectTextdraw[i], 1);
TextDrawSetProportional(ConnectTextdraw[i], 1);
}
return 1;
}
public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYER_NAME], string[64];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "~g~[Join] ~h~%s(%d)", pname, playerid);
TextDrawHideForAll(ConnectTextdraw[CurrentIndex]);
TextDrawSetString(ConnectTextdraw[CurrentIndex], string);
TextDrawShowForAll(ConnectTextdraw[CurrentIndex]);
for(new i = 0; i < CONNECT_MESSAGES; i++)
{
TextDrawShowForPlayer(playerid, ConnectTextdraw[i]);
}
return (CurrentIndex + 1 != CONNECT_MESSAGES) ? (CurrentIndex ++) : (CurrentIndex = 0);
}
public OnPlayerDisconnect(playerid, reason)
{
new pname[MAX_PLAYER_NAME], string[64];
GetPlayerName(playerid, pname, sizeof(pname));
switch(reason)
{
case 0: format(string, sizeof(string), "~p~[Timeout] ~h~%s(%d)", pname, playerid);
case 1: format(string, sizeof(string), "~y~[Quit] ~h~%s(%d)", pname, playerid);
case 2: format(string, sizeof(string), "~r~[Kick] ~h~%s(%d)", pname, playerid);
}
TextDrawHideForAll(ConnectTextdraw[CurrentIndex]);
TextDrawSetString(ConnectTextdraw[CurrentIndex], string);
TextDrawShowForAll(ConnectTextdraw[CurrentIndex]);
return (CurrentIndex + 1 != CONNECT_MESSAGES) ? (CurrentIndex ++) : (CurrentIndex = 0);
}
public OnGameModeExit()
{
for(new i = 0; i < CONNECT_MESSAGES; i++)
{
TextDrawDestroy(ConnectTextdraw[i]);
}
return 1;
}
pawn Код:
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new Text:Textdraw3;
new Text:Textdraw4;
// In OnGameModeInit prefferably, we procced to create our textdraws:
Textdraw0 = TextDrawCreate(540.000000, 220.000000, "~r~~h~[Leave] iFarbod");
TextDrawAlignment(Textdraw0, 2);
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.200000, 1.000000);
TextDrawColor(Textdraw0, -1);
TextDrawSetOutline(Textdraw0, 1);
TextDrawSetProportional(Textdraw0, 1);
Textdraw1 = TextDrawCreate(540.000000, 230.000000, "~r~~h~[Leave] iFarbod");
TextDrawAlignment(Textdraw1, 2);
TextDrawBackgroundColor(Textdraw1, 255);
TextDrawFont(Textdraw1, 1);
TextDrawLetterSize(Textdraw1, 0.200000, 1.000000);
TextDrawColor(Textdraw1, -1);
TextDrawSetOutline(Textdraw1, 1);
TextDrawSetProportional(Textdraw1, 1);
Textdraw2 = TextDrawCreate(540.000000, 240.000000, "~r~~h~[Leave] iFarbod");
TextDrawAlignment(Textdraw2, 2);
TextDrawBackgroundColor(Textdraw2, 255);
TextDrawFont(Textdraw2, 1);
TextDrawLetterSize(Textdraw2, 0.200000, 1.000000);
TextDrawColor(Textdraw2, -1);
TextDrawSetOutline(Textdraw2, 1);
TextDrawSetProportional(Textdraw2, 1);
Textdraw3 = TextDrawCreate(540.000000, 250.000000, "~r~~h~[Leave] iFarbod");
TextDrawAlignment(Textdraw3, 2);
TextDrawBackgroundColor(Textdraw3, 255);
TextDrawFont(Textdraw3, 1);
TextDrawLetterSize(Textdraw3, 0.200000, 1.000000);
TextDrawColor(Textdraw3, -1);
TextDrawSetOutline(Textdraw3, 1);
TextDrawSetProportional(Textdraw3, 1);
Textdraw4 = TextDrawCreate(540.000000, 260.000000, "~r~~h~[Leave] iFarbod");
TextDrawAlignment(Textdraw4, 2);
TextDrawBackgroundColor(Textdraw4, 255);
TextDrawFont(Textdraw4, 1);
TextDrawLetterSize(Textdraw4, 0.200000, 1.000000);
TextDrawColor(Textdraw4, -1);
TextDrawSetOutline(Textdraw4, 1);
TextDrawSetProportional(Textdraw4, 1);
like this :
_
_
_
_
1
then
_
_
_
1
2
then
_
_
1
2
3
then
_
1
2
3
4
then
1
2
3
4
5
then
2
3
4
5
6
...
Someone can help me?
and if it possible how to have a SendConnectMessage() function uses these textdraws.
thanks