Textdraw help.
#8

Create a global array variable like:
pawn Код:
new Text:Stats[MAX_PLAYERS];
After that you have to add the TextDrawCreate into OnPlayerConnect:
pawn Код:
public OnPlayerConnect(playerid)
{
    Stats[playerid] = TextDrawCreate(232.0, 245.0, " ");
    TextDrawFont(Stats[playerid], 2);
    TextDrawLetterSize(Stats[playerid], 0.5, 3.5);
    TextDrawColor(Stats[playerid], 0xFF0000FF);
    TextDrawSetOutline(Stats[playerid], 1);
    TextDrawSetProportional(Stats[playerid], 1);
    TextDrawSetShadow(Stats[playerid], 1);
    TextDrawUseBox(Stats[playerid], 0);
    return 1;
}
Now we will try to make the command:
pawn Код:
dcmd_statson(playerid, params[])
{
    new string[512], Float:health, Float:armour;
    GetPlayerHealth(playerid, health);
    GetPlayerArmour(playerid, armour);
    format(string, sizeof(string),"------STATS------~n~Adminlevel: %d~n~Money: %d~n~Ping: %d~n~Health: %d%% || Armour: %d%%", PlayerInfo[playerid][level], GetPlayerMoney(playerid), GetPlayerPing(playerid), floatround(health), floatround(armour));
    TextDrawSetString(Stats[playerid], string);
    TextDrawShowForPlayer(playerid, Stats[playerid]);
    return 1;
}
pawn Код:
dcmd_statsoff(playerid, params[])
{
    TextDrawHideForPlayer(playerid, Stats[playerid]);
    return 1;
}
And ofc lets don't forget to destroy the textdraw if the player disconnects:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    TextDrawDestroy(Stats[playerid]);
    return 1;
}
If you think the text might to look bad on your screen so you can change the values.
Hope this little tutorial helped you abit.
Reply


Messages In This Thread
Textdraw help. - by iGetty - 27.05.2011, 18:44
Re: Textdraw help. - by park4bmx - 27.05.2011, 19:37
Re: Textdraw help. - by iGetty - 27.05.2011, 19:54
Re: Textdraw help. - by park4bmx - 27.05.2011, 20:07
Re: Textdraw help. - by iGetty - 27.05.2011, 20:10
Re: Textdraw help. - by park4bmx - 27.05.2011, 20:15
Re: Textdraw help. - by iGetty - 27.05.2011, 20:16
Re: Textdraw help. - by BigETI - 27.05.2011, 20:32

Forum Jump:


Users browsing this thread: 1 Guest(s)