Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// es unda chavardes satamasho modshi!
- forward OnPlayerFinishDownloading(playerid, datamb);
- public OnPlayerFinishDownloading(playerid, datamb)
- {
- /*SendClientMessage(playerid, 1, "{00FF33}You have completely downloaded all files.");
- new String[256];
- format(String, 256, "{FFFFFF}Downloaded: {00FF33}%0.2f {FFFFFF}MBs of Data.", datamb);
- SendClientMessage(playerid, 1, String);*/
- // Put whatever you want
- return 1;
- }
- //////////////////////////////////////////////////////////////////////////////////
- #include <a_samp>
- new Downloaded[MAX_PLAYERS];
- new PlayerTick[MAX_PLAYERS];
- stock GetTickDiff(newtick, oldtick)
- {
- if (oldtick < 0 && newtick >= 0) {
- return newtick - oldtick;
- } else if (oldtick >= 0 && newtick < 0 || oldtick > newtick) {
- return (cellmax - oldtick + 1) - (cellmin - newtick);
- }
- return newtick - oldtick;
- }
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Download Meter SA-MP 0.3.DL");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- Downloaded[playerid] = 0;
- PlayerTick[playerid] = GetTickCount();
- return 1;
- }
- public OnPlayerFinishedDownloading(playerid, virtualworld)
- {
- if(Downloaded[playerid] == 1) return 1;
- if(GetTickDiff(GetTickCount(), PlayerTick[playerid]) > 1000)
- {
- Downloaded[playerid] = 1;
- new Float: bytesOfPlayer = NetStats_BytesSent(playerid);
- new Float: Megabytes = bytesOfPlayer / 1024 / 1024;
- CallRemoteFunction("OnPlayerFinishDownloading", "df", playerid, Megabytes);
- }
- else
- {
- Downloaded[playerid] = 1;
- // Player changed virtual worlds
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement