Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Simple PingBar by xVectoliife
- #include <a_samp>
- #define FILTERSCRIPT
- new Text:Ping[MAX_PLAYERS];
- new Text:Ping2[MAX_PLAYERS];
- new Text:Ping3[MAX_PLAYERS];
- new Text:Ping4[MAX_PLAYERS];
- new Text:ScrittaPing[MAX_PLAYERS];
- forward PingUpdate(playerid);
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" PingBar by xVectoliife ");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #endif
- public OnPlayerConnect(playerid)
- {
- Ping[playerid] = TextDrawCreate(536.000000, 112.000000, "~g~l");
- TextDrawBackgroundColor(Ping[playerid], 255);
- TextDrawFont(Ping[playerid], 1);
- TextDrawLetterSize(Ping[playerid], 0.500000, 1.000000);
- TextDrawColor(Ping[playerid], -1);
- TextDrawSetOutline(Ping[playerid], 1);
- TextDrawSetProportional(Ping[playerid], 1);
- Ping2[playerid] = TextDrawCreate(542.000000, 109.000000, "~g~l");
- TextDrawBackgroundColor(Ping2[playerid], 255);
- TextDrawFont(Ping2[playerid], 1);
- TextDrawLetterSize(Ping2[playerid], 0.500000, 1.399999);
- TextDrawColor(Ping2[playerid], -1);
- TextDrawSetOutline(Ping2[playerid], 1);
- TextDrawSetProportional(Ping2[playerid], 1);
- Ping3[playerid] = TextDrawCreate(548.000000, 105.000000, "~g~l");
- TextDrawBackgroundColor(Ping3[playerid], 255);
- TextDrawFont(Ping3[playerid], 1);
- TextDrawLetterSize(Ping3[playerid], 0.500000, 1.899999);
- TextDrawColor(Ping3[playerid], -1);
- TextDrawSetOutline(Ping3[playerid], 1);
- TextDrawSetProportional(Ping3[playerid], 1);
- Ping4[playerid] = TextDrawCreate(554.000000, 101.000000, "~g~l");
- TextDrawBackgroundColor(Ping4[playerid], 255);
- TextDrawFont(Ping4[playerid], 1);
- TextDrawLetterSize(Ping4[playerid], 0.500000, 2.399998);
- TextDrawColor(Ping4[playerid], -1);
- TextDrawSetOutline(Ping4[playerid], 1);
- TextDrawSetProportional(Ping4[playerid], 1);
- ScrittaPing[playerid] = TextDrawCreate(530.000000, 121.000000, "Ping");
- TextDrawBackgroundColor(ScrittaPing[playerid], 255);
- TextDrawFont(ScrittaPing[playerid], 1);
- TextDrawLetterSize(ScrittaPing[playerid], 0.500000, 1.000000);
- TextDrawColor(ScrittaPing[playerid], -1);
- TextDrawSetOutline(ScrittaPing[playerid], 1);
- TextDrawSetProportional(ScrittaPing[playerid], 1);
- TextDrawShowForPlayer(playerid, ScrittaPing[playerid]);
- TextDrawShowForPlayer(playerid, Ping[playerid]);
- TextDrawShowForPlayer(playerid, Ping2[playerid]);
- TextDrawShowForPlayer(playerid, Ping3[playerid]);
- TextDrawShowForPlayer(playerid, Ping4[playerid]);
- SetTimerEx("PingUpdate", 150, false, "i", playerid); //Preferisco usare un timer che l'OnPlayerUpdate.
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public PingUpdate(playerid)
- {
- new string[48];
- if(GetPlayerPing(playerid) > 50 && GetPlayerPing(playerid) < 100) //3 tacche
- {
- TextDrawHideForPlayer(playerid, Ping4[playerid]);
- }
- else if(GetPlayerPing(playerid) > 100 && GetPlayerPing(playerid) < 200) //2 tacche
- {
- TextDrawHideForPlayer(playerid, Ping4[playerid]);
- TextDrawHideForPlayer(playerid, Ping3[playerid]);
- //Questo codice qui sotto serve per rendere le tacche gialle.
- format(string, sizeof(string), "~y~l");
- TextDrawSetString(Ping2[playerid],string);
- format(string, sizeof(string), "~y~l");
- TextDrawSetString(Ping[playerid],string);
- }
- else if(GetPlayerPing(playerid) > 200) //1 tacca
- {
- TextDrawHideForPlayer(playerid, Ping4[playerid]);
- TextDrawHideForPlayer(playerid, Ping3[playerid]);
- TextDrawHideForPlayer(playerid, Ping2[playerid]);
- format(string, sizeof(string), "~r~l");
- TextDrawSetString(Ping[playerid],string);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment