>>>> Urgent help [Textdrawpros] <<<<
#1

Hello,
I'm using Textdraw to show players stats above the health, here is the code:
Код:
new Text:LoggedInAs[MAX_PLAYERS];

//Call functions
public OnPlayerDeath(playerid,killerid,reason)
{
	pInfo[playerid][Deaths]++;
	CheckLoggedInAs(playerid);
	if(killerid != INVALID_PLAYER_ID)
	{
	    CheckLoggedInAs(killerid);
	    pInfo[killerid][Kills]++;
	}
	return 1;
}

//Onplayerconnect
public OnPlayerConnect(playerid)
{
    LoggedInAs[playerid] = TextDrawCreate(300.5,6, " ");
    TextDrawBackgroundColor(LoggedInAs[playerid], 255);
    TextDrawFont(LoggedInAs[playerid], 3);
    TextDrawLetterSize(LoggedInAs[playerid], 0.350000, 1.000000);
    TextDrawColor(LoggedInAs[playerid], -5046017);
    TextDrawSetOutline(LoggedInAs[playerid], 0);
    TextDrawSetProportional(LoggedInAs[playerid], 1);
    TextDrawSetShadow(LoggedInAs[playerid], 1);
    TextDrawSetSelectable(LoggedInAs[playerid], 0);

    
    //+ some other crap for the textdraw. (Proportional etc.)
    CheckLoggedInAs(playerid);
   return 1;
}
//OnPlayerDisconnect
public OnPlayerDisconnect(playerid, reason)
{
    TextDrawDestroy(LoggedInAs[playerid]);
    return 1;
}
//OnPlayerSpawn
public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid,LoggedInAs[playerid]);
    CheckLoggedInAs(playerid);
    return 1;
}

//Call function
stock CheckLoggedInAs(playerid)
{
	new string[450];
	format(string, sizeof(string), "~g~Kills: %d ~W~- ~r~Deaths: %d ~W~- ~y~DM Score: %d ~P~Rank: %d",pInfo[playerid][Kills],pInfo[playerid][Deaths],GetPlayerScore(playerid),Rank[playerid]);
 	TextDrawSetString(Text:LoggedInAs[playerid], string);
	if(pInfo[playerid][Kills] >= 1000) Rank[ playerid ] = 6;
	else if(pInfo[playerid][Kills] >= 700) Rank[ playerid ] = 5;
	else if(pInfo[playerid][Kills] >= 500) Rank[ playerid ] = 4;
	else if(pInfo[playerid][Kills] >= 200) Rank[ playerid ] = 3;
	else if(pInfo[playerid][Kills] >= 100) Rank[ playerid ] = 2;
	else if(pInfo[playerid][Kills] >= 10) Rank[ playerid ] = 1;
	else if(pInfo[playerid][Kills] >= 0) Rank[ playerid ] = 0;
	return 1;
}
So after 2 days this textdraw disappearing, so i need to restart the server , anyone know the reason? thanks !
EDIT:
I heared that i must put textdraws under onfilterscriptinit, not onplayerconnect, cuz of refresh is that right?
Код:
public OnPlayerConnect(playerid)
{
    LoggedInAs[playerid] = TextDrawCreate(300.5,6, " ");
    TextDrawBackgroundColor(LoggedInAs[playerid], 255);
    TextDrawFont(LoggedInAs[playerid], 3);
    TextDrawLetterSize(LoggedInAs[playerid], 0.350000, 1.000000);
    TextDrawColor(LoggedInAs[playerid], -5046017);
    TextDrawSetOutline(LoggedInAs[playerid], 0);
    TextDrawSetProportional(LoggedInAs[playerid], 1);
    TextDrawSetShadow(LoggedInAs[playerid], 1);
    TextDrawSetSelectable(LoggedInAs[playerid], 0);

    
    //+ some other crap for the textdraw. (Proportional etc.)
    CheckLoggedInAs(playerid);
   return 1;
}
Reply


Messages In This Thread
>>>> Urgent help [Textdrawpros] <<<< - by SPA - 06.07.2014, 04:16
Re: >>>> Urgent help [Textdrawpros] <<<< - by BroZeus - 06.07.2014, 04:55
Re: >>>> Urgent help [Textdrawpros] <<<< - by SPA - 06.07.2014, 08:47
Re: >>>> Urgent help [Textdrawpros] <<<< - by SPA - 06.07.2014, 09:33
Re: >>>> Urgent help [Textdrawpros] <<<< - by LivingLikeYouDo - 06.07.2014, 09:36
Re: >>>> Urgent help [Textdrawpros] <<<< - by SPA - 06.07.2014, 10:19
Re: >>>> Urgent help [Textdrawpros] <<<< - by SPA - 06.07.2014, 10:49
Re: >>>> Urgent help [Textdrawpros] <<<< - by ikkentim - 06.07.2014, 10:54
Re: >>>> Urgent help [Textdrawpros] <<<< - by SPA - 06.07.2014, 11:52
Re: >>>> Urgent help [Textdrawpros] <<<< - by SPA - 06.07.2014, 14:52

Forum Jump:


Users browsing this thread: 2 Guest(s)