27.05.2011, 20:32
Create a global array variable like:
After that you have to add the TextDrawCreate into OnPlayerConnect:
Now we will try to make the command:
And ofc lets don't forget to destroy the textdraw if the player disconnects:
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.
pawn Код:
new Text:Stats[MAX_PLAYERS];
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;
}
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;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
TextDrawDestroy(Stats[playerid]);
return 1;
}
Hope this little tutorial helped you abit.