SA-MP Forums Archive
[FilterScript] Speedo/Date/Time/Ping/ServerName - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Speedo/Date/Time/Ping/ServerName (/showthread.php?tid=544157)



Speedo/Date/Time/Ping/ServerName - JonyNguyen - 31.10.2014



Hello , to day i finished this script



Screenshot


Credits

JonyNguyen

iPLEOMAX (Icons and some functions from his editor: https://sampforum.blast.hk/showthread.php?tid=376758)

zcmd (Zeex: https://sampforum.blast.hk/showthread.php?tid=91354)
Code:
- /Speedo_on is turn on speed clock
- /Speedo_off is turn off speed clock


PHP Code:
#include <a_samp>
#include <zcmd>
#define FILTERSCRIPT
#define VERSION "1.0"
#define COLOR_LIGHTBLUE 0x33CCFFAA
new Text:TimeText:CayText:PingText:FPSText:Textdraw1Text:Textdraw3Text:Textdraw4Text:SpeedText:Textdraw2Text:Date;
new 
pFPS[MAX_PLAYERS];
forward settime(playerid);

public 
OnFilterScriptInit()
{
        print(
" --------------------------------------");
        print(
" Speedometer , Date , Time , Ping , FPS : JonyNguyen Version "VERSION"!!!");
        print(
"-------------------------------------- ");


        
SetTimer("settime",1000,true);

        
Speed TextDrawCreate(490.000000160.000000"--");
        
TextDrawBackgroundColor(Speed255);
        
TextDrawFont(Speed1);
        
TextDrawLetterSize(Speed0.3500001.200000);
        
TextDrawColor(Speed, -1);
        
TextDrawSetOutline(Speed1);
        
TextDrawSetProportional(Speed1);
        
TextDrawSetSelectable(Speed0);

        
Textdraw1 TextDrawCreate(544.000000361.000000"~r~-");
        
TextDrawBackgroundColor(Textdraw1255);
        
TextDrawFont(Textdraw12);
        
TextDrawLetterSize(Textdraw10.2900001.200000);
        
TextDrawColor(Textdraw1, -1);
        
TextDrawSetOutline(Textdraw11);
        
TextDrawSetProportional(Textdraw11);
        
TextDrawSetSelectable(Textdraw10);

        
Textdraw2 TextDrawCreate(560.000000373.000000"~r~-");
        
TextDrawBackgroundColor(Textdraw2255);
        
TextDrawFont(Textdraw21);
        
TextDrawLetterSize(Textdraw20.2100001.200000);
        
TextDrawColor(Textdraw2, -16776961);
        
TextDrawSetOutline(Textdraw21);
        
TextDrawSetProportional(Textdraw21);
        
TextDrawSetSelectable(Textdraw20);

        
Textdraw3 TextDrawCreate(527.000000384.000000"-");
        
TextDrawBackgroundColor(Textdraw3255);
        
TextDrawFont(Textdraw31);
        
TextDrawLetterSize(Textdraw35.0000001.000000);
        
TextDrawColor(Textdraw3, -1);
        
TextDrawSetOutline(Textdraw30);
        
TextDrawSetProportional(Textdraw31);
        
TextDrawSetShadow(Textdraw31);
        
TextDrawSetSelectable(Textdraw30);
        
        
Textdraw4 TextDrawCreate(521.000000392.000000"********.com/naqui9x");
        
TextDrawBackgroundColor(Textdraw4, -1);
        
TextDrawFont(Textdraw41);
        
TextDrawLetterSize(Textdraw40.2300001.200000);
        
TextDrawColor(Textdraw4255);
        
TextDrawSetOutline(Textdraw41);
        
TextDrawSetProportional(Textdraw41);
        
TextDrawSetSelectable(Textdraw40);


        
Ping TextDrawCreate(524.000000374.000000"--");
        
TextDrawBackgroundColor(Ping255);
        
TextDrawFont(Ping1);
        
TextDrawLetterSize(Ping0.2000001.200000);
        
TextDrawColor(Ping, -16776961);
        
TextDrawSetOutline(Ping1);
        
TextDrawSetProportional(Ping1);
        
TextDrawSetSelectable(Ping0);

        
FPS TextDrawCreate(570.000000374.000000"--");
        
TextDrawBackgroundColor(FPS255);
        
TextDrawFont(FPS1);
        
TextDrawLetterSize(FPS0.2000001.200000);
        
TextDrawColor(FPS, -16776961);
        
TextDrawSetOutline(FPS1);
        
TextDrawSetProportional(FPS1);
        
TextDrawSetSelectable(FPS0);


        
Date TextDrawCreate(552.000000361.000000,"--");
        
TextDrawBackgroundColor(Date255);
        
TextDrawFont(Date2);
        
TextDrawLetterSize(Date0.2000001.200000);
        
TextDrawColor(Date, -1);
        
TextDrawSetOutline(Date1);
        
TextDrawSetProportional(Date1);
        
TextDrawSetSelectable(Date0);

        
Time TextDrawCreate(516.000000361.000000,"--");
        
TextDrawBackgroundColor(Time255);
        
TextDrawFont(Time2);
        
TextDrawLetterSize(Time0.2000001.200000);
        
TextDrawColor(Time, -1);
        
TextDrawSetOutline(Time1);
        
TextDrawSetProportional(Time1);
        
TextDrawSetSelectable(Time0);

        
Cay TextDrawCreate(487.000000344.000000"~r~V~w~ietnam~r~R~w~oleplay");
        
TextDrawBackgroundColor(Cay255);
        
TextDrawFont(Cay1);
        
TextDrawLetterSize(Cay0.5099991.600000);
        
TextDrawColor(Cay, -1);
        
TextDrawSetOutline(Cay1);
        
TextDrawSetProportional(Cay1);
        
TextDrawSetSelectable(Cay0);
        return 
1;
}

public 
OnFilterScriptExit()
{
        return 
1;
}

public 
OnPlayerSpawn(playerid)
{
        
TextDrawShowForPlayer(playeridTime), TextDrawShowForPlayer(playeridDate), TextDrawShowForPlayer(playeridCay), TextDrawShowForPlayer(playeridPing), TextDrawShowForPlayer(playeridFPS), TextDrawShowForPlayer(playeridTextdraw1), TextDrawShowForPlayer(playeridTextdraw2), TextDrawShowForPlayer(playeridTextdraw3), TextDrawShowForPlayer(playeridTextdraw4);


        return 
1;
}

public 
OnPlayerDisconnect(playeridreason)
{
        
TextDrawHideForPlayer(playeridTime), TextDrawHideForPlayer(playeridDate), TextDrawHideForPlayer(playeridCay), TextDrawHideForPlayer(playeridPing), TextDrawHideForPlayer(playeridFPS), TextDrawHideForPlayer(playeridTextdraw1), TextDrawHideForPlayer(playeridTextdraw2), TextDrawHideForPlayer(playeridTextdraw3), TextDrawHideForPlayer(playeridTextdraw4);
        return 
1;
}

public 
settime(playerid)
{
        new 
string[256],year,month,day,hours,minutes,seconds;
        
getdate(yearmonthday), gettime(hoursminutesseconds);
        
format(stringsizeof string"%d/%s%d/%s%d"day, ((month 10) ? ("0") : ("")), month, (year 10) ? ("0") : (""), year);
        
TextDrawSetString(Datestring);
        
format(stringsizeof string"%s%d:%s%d", (hours 10) ? ("0") : (""), hours, (minutes 10) ? ("0") : (""), minutes, (seconds 10) ? ("0") : (""), seconds);
        
TextDrawSetString(Timestring);
        
format(stringsizeof string"~r~Ping: ~w~%d"GetPlayerPing(playerid));
        
TextDrawSetString(Pingstring);
        
format(stringsizeof string"~r~LAG: ~w~No"pFPS[playerid]);
        
TextDrawSetString(FPSstring);
        
format(stringsizeof string"~w~SPEED: ~r~%d ~w~KM/h."GetSpeed(playerid));
        
TextDrawSetString(Speedstring);
}

stock GetSpeed(playerid)
{
        new 
FloatPos[4];
        
GetVehicleVelocity(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
        return 
floatround(1.61 floatsqroot(floatabs(floatpower(Pos[0] + Pos[1] + Pos[2], 2))) * 100);
}


CMD:speedo_on(playeridparams[])
{
    if(!
IsPlayerInAnyVehicle(playerid)) {
    return 
SendClientMessage(playeridCOLOR_LIGHTBLUE"** You need to be in a car.");
    }
    
SendClientMessage(playeridCOLOR_LIGHTBLUE"** You\'re turn on speed clock");
    
TextDrawShowForPlayer(playeridText:Speed);
    return 
1;
}

CMD:speedo_off(playeridparams[])
{
    if(!
IsPlayerInAnyVehicle(playerid)) {
    return 
SendClientMessage(playeridCOLOR_LIGHTBLUE"** You need to be in a car.");
    }
    
SendClientMessage(playeridCOLOR_LIGHTBLUE"** You\'re turn off speed clock.");
    
TextDrawHideForPlayer(playeridText:Speed);
    return 
1;
}

public 
OnPlayerExitVehicle(playeridvehicleid)
{
    
TextDrawHideForPlayer(playeridText:Speed);
    return 
1;

Sorry for my bad english


Re: Speedo/Date/Time/Ping/ServerName - JonyNguyen - 31.10.2014

Screenshot\'s uploaded


Re: Speedo/Date/Time/Ping/ServerName - Steel_ - 31.10.2014

Where are the pictures? I can\'t see them.


Re: Speedo/Date/Time/Ping/ServerName - Flashhiee - 31.10.2014

Reupload images.


Re: Speedo/Date/Time/Ping/ServerName - Alex Magaсa - 31.10.2014

Seems good! gj.


Re: Speedo/Date/Time/Ping/ServerName - JonyNguyen - 31.10.2014

Image\'s re-upload

http://imgur.com/PiypRDL


Re: Speedo/Date/Time/Ping/ServerName - M0HAMMAD - 31.10.2014

nice job Jony
Keep going...


Re: Speedo/Date/Time/Ping/ServerName - VinPure - 01.11.2014

Good job


Re: Speedo/Date/Time/Ping/ServerName - JonyNguyen - 01.11.2014

Thanks all


Re: Speedo/Date/Time/Ping/ServerName - Pottus - 01.11.2014

Ok Jony you fucked this script up pretty bad since all players will share the same textdraws it is useless for more than one player. What you need to do is use player textdraws to fix the issue static textdraws like the VietnamRoleplay can remain unchanged.


Re: Speedo/Date/Time/Ping/ServerName - AdmBot - 01.11.2014

Good job!


Re: Speedo/Date/Time/Ping/ServerName - Zeddclarity - 01.11.2014

Great, my friend


Re: Speedo/Date/Time/Ping/ServerName - VinPure - 01.11.2014

Quote:
Originally Posted by Pottus
View Post
Ok Jony you fucked this script up pretty bad since all players will share the same textdraws it is useless for more than one player. What you need to do is use player textdraws to fix the issue static textdraws like the VietnamRoleplay can remain unchanged.
I have the same opinion with you hahah