SA-MP Forums Archive
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=529006)



Textdraw help - Spartaaaaa - 30.07.2014

I need like this





here is the code onplayerdeath

pawn Код:
//==============================================================================
//OnPlayerDeath
//==============================================================================
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid == playerid) return 1; // They either fell, or took self-inflicted damage somehow.
    new string[75];
    format(string, sizeof(string), "You have killed %s.", GetName(playerid));
    SendClientMessage(killerid, -1, string);
    format(string, sizeof(string), "You have been killed by %s.", GetName(killerid));
    SendClientMessage(playerid, -1, string);

    //--------------------------------------------------------------------------
    //Settings & Others
    //--------------------------------------------------------------------------
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerWantedLevel(playerid, 0);
    SendDeathMessage(killerid, playerid, reason);
    if(killerid != INVALID_PLAYER_ID)
    {
        SetPlayerScore(killerid, GetPlayerScore(killerid) +1);
    }
    GivePlayerMoney(killerid, 100);
    GivePlayerMoney(playerid, 0);
    //--------------------------------------------------------------------------
    //Textdraw's Hide/Show
    //--------------------------------------------------------------------------
    TextDrawShowForPlayer(playerid, Textdraw27);
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    //TextDrawHideForPlayer(playerid, Textdraw0);
    //TextDrawHideForPlayer(playerid, Textdraw4);
    //TextDrawHideForPlayer(playerid, Textdraw5);
    TextDrawHideForPlayer(playerid, Textdraw6);
    TextDrawHideForPlayer(playerid, Textdraw7);
    TextDrawHideForPlayer(playerid, Textdraw8);
    TextDrawHideForPlayer(playerid, Textdraw81);
    TextDrawHideForPlayer(playerid, Textdraw82);
    TextDrawHideForPlayer(playerid, Textdraw83);
    TextDrawHideForPlayer(playerid, Textdraw84);



Re: Textdraw help - Stanford - 30.07.2014

First of all use player textdraws instead of global textdraws; the reason is because some people might die the same second and the textdraw would be set for them switch and killer names will be messed up or substituted.

Now your code should be like this:
pawn Код:
format(string, sizeof(string), "You were killed by %s", GetName(killerid));
TextDrawSetString(the TD, string);
// then show it
I hope I helped any feedback would be appreciated. Rep
Hint: I am on phone so excuse me if there is something wrong..


Re: Textdraw help - Spartaaaaa - 31.07.2014

i want this textdraw in middle bump


Re: Textdraw help - TazmaNiax - 31.07.2014

you can show this without textdraw

if you want GameTextForPlayer i can make it for you..
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
     format(string, sizeof(string), "~g~You got killed By~n~~w~ %s");
     GameTextForPlayer(playerid, string, GetName(killerid) ,3000, 3);
     format(string, sizeof(string), "~g~You killed~n~~w~ %s");
     GameTextForPlayer(killerid, string, GetName(playerid) ,3000, 3);
}
sory if i loose something and my bad english xD
i'm just want to help you


Re: Textdraw help - Spartaaaaa - 31.07.2014

It's in the middle?


Re: Textdraw help - fonia5 - 31.07.2014

I did him a textdraw on the middle but i can't really remember how it would work etc, if anybody here can give me a hint or work it like that be good.

Код:

new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;

public OnFilterScriptInit()
{
	// Create the textdraws:
	Textdraw0 = TextDrawCreate(220.000000, 188.000000, "Box");
	TextDrawBackgroundColor(Textdraw0, 16711935);
	TextDrawFont(Textdraw0, 1);
	TextDrawLetterSize(Textdraw0, 0.000000, 4.000000);
	TextDrawColor(Textdraw0, -1);
	TextDrawSetOutline(Textdraw0, 1);
	TextDrawSetProportional(Textdraw0, 1);
	TextDrawUseBox(Textdraw0, 1);
	TextDrawBoxColor(Textdraw0, 100);
	TextDrawTextSize(Textdraw0, 411.000000, 29.000000);

	Textdraw1 = TextDrawCreate(222.000000, 200.000000, "You got killed by");
	TextDrawBackgroundColor(Textdraw1, 255);
	TextDrawFont(Textdraw1, 3);
	TextDrawLetterSize(Textdraw1, 0.360000, 1.399999);
	TextDrawColor(Textdraw1, -1);
	TextDrawSetOutline(Textdraw1, 0);
	TextDrawSetProportional(Textdraw1, 1);
	TextDrawSetShadow(Textdraw1, 1);

	Textdraw2 = TextDrawCreate(222.000000, 200.000000, "You have killed");
	TextDrawBackgroundColor(Textdraw2, 255);
	TextDrawFont(Textdraw2, 3);
	TextDrawLetterSize(Textdraw2, 0.360000, 1.399999);
	TextDrawColor(Textdraw2, -1);
	TextDrawSetOutline(Textdraw2, 0);
	TextDrawSetProportional(Textdraw2, 1);
	TextDrawSetShadow(Textdraw2, 1);

	for(new i; i < MAX_PLAYERS; i ++)
	{
		if(IsPlayerConnected(i))
		{
			TextDrawShowForPlayer(i, Textdraw0);
			TextDrawShowForPlayer(i, Textdraw1);
			TextDrawShowForPlayer(i, Textdraw2);
		}
	}
	return 1;
}

public OnFilterScriptExit()
{
	TextDrawHideForAll(Textdraw0);
	TextDrawDestroy(Textdraw0);
	TextDrawHideForAll(Textdraw1);
	TextDrawDestroy(Textdraw1);
	TextDrawHideForAll(Textdraw2);
	TextDrawDestroy(Textdraw2);
	return 1;
}

public OnPlayerConnect(playerid)
{
	TextDrawShowForPlayer(playerid, Textdraw0);
	TextDrawShowForPlayer(playerid, Textdraw1);
	TextDrawShowForPlayer(playerid, Textdraw2);
	return 1;
}



Re: Textdraw help - Sharpadox - 31.07.2014

Quote:
Originally Posted by Spartaaaaa
Посмотреть сообщение
It's in the middle?
Yes, it is: https://sampwiki.blast.hk/wiki/GameTextStyle


Re: Textdraw help - Stanford - 31.07.2014

I already cleared my point above, if you are going to use textdraws ( which doesn't even worth it at this case ) use PlayerTextdraws and not global textdraws, I explained that earlier..

Game text is better I believe.
Any feedback would be appreciated..


Re: Textdraw help - TazmaNiax - 31.07.2014

Quote:
Originally Posted by TazmaNiax
Посмотреть сообщение
you can show this without textdraw

if you want GameTextForPlayer i can make it for you..
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
     format(string, sizeof(string), "~g~You got killed By~n~~w~ %s");
     GameTextForPlayer(playerid, string, GetName(killerid) ,3000, 3);
     format(string, sizeof(string), "~g~You killed~n~~w~ %s");
     GameTextForPlayer(killerid, string, GetName(playerid) ,3000, 3);
}
sory if i loose something and my bad english xD
i'm just want to help you
You can use this, this GameText is in Middle


Re: Textdraw help - Spartaaaaa - 31.07.2014

Код:
C:\Users\Khan_vb\Desktop\Server.UFS\UFS\gamemodes\XSE.pwn(1350) : error 035: argument type mismatch (argument 3)
C:\Users\Khan_vb\Desktop\Server.UFS\UFS\gamemodes\XSE.pwn(1352) : error 035: argument type mismatch (argument 3)
C:\Users\Khan_vb\Desktop\Server.UFS\UFS\gamemodes\XSE.pwn(13540) : warning 203: symbol is never used: "anims"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.