Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Basic Player Stats. Shows Score and Ping in a textdraw.
- Credits - iPLEOMAX
- [HK]Ryder[AN]
- SA:MP Team
- */
- #include <a_samp>
- new updatetimer[MAX_PLAYERS];
- //Player Textdraws:
- new PlayerText:Textdraw0[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
- new PlayerText:Textdraw1[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
- forward update(playerid);
- public OnPlayerConnect(playerid)
- {
- Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 498.398, 100.799, "Score - -=-");
- PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1);
- PlayerTextDrawColor(playerid, Textdraw0[playerid], -1);
- PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 1);
- PlayerTextDrawBackgroundColor(playerid, Textdraw0[playerid], 51);
- PlayerTextDrawFont(playerid, Textdraw0[playerid], 2);
- PlayerTextDrawSetProportional(playerid, Textdraw0[playerid], 1);
- PlayerTextDrawShow(playerid, Textdraw0[playerid]);
- Textdraw1[playerid] = CreatePlayerTextDraw(playerid, 497.600, 120.212, "Ping - -=- ms");
- PlayerTextDrawAlignment(playerid, Textdraw1[playerid], 1);
- PlayerTextDrawColor(playerid, Textdraw1[playerid], -1);
- PlayerTextDrawSetOutline(playerid, Textdraw1[playerid], 1);
- PlayerTextDrawBackgroundColor(playerid, Textdraw1[playerid], 51);
- PlayerTextDrawFont(playerid, Textdraw1[playerid], 2);
- PlayerTextDrawSetProportional(playerid, Textdraw1[playerid], 1);
- PlayerTextDrawShow(playerid, Textdraw1[playerid]);
- updatetimer[playerid] = SetTimerEx("update", 1000, true, "d", playerid);
- return 1;
- }
- public update(playerid)
- {
- new score[16], ping[16];
- format(score, sizeof(score), "Score - %d", GetPlayerScore(playerid));
- format(ping, sizeof(ping), "Ping - %d ms", GetPlayerPing(playerid));
- PlayerTextDrawSetString(playerid, Textdraw0[playerid], score);
- PlayerTextDrawSetString(playerid, Textdraw1[playerid], ping);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- PlayerTextDrawDestroy(playerid, Textdraw0[playerid]);
- Textdraw0[playerid] = PlayerText:INVALID_TEXT_DRAW;
- PlayerTextDrawDestroy(playerid, Textdraw1[playerid]);
- Textdraw1[playerid] = PlayerText:INVALID_TEXT_DRAW;
- KillTimer(updatetimer[playerid]);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement