06.07.2014, 04:16
(
Последний раз редактировалось SPA; 06.07.2014 в 09:33.
)
Hello,
I'm using Textdraw to show players stats above the health, here is the code:
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?
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; }
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; }