- /Speedo_on is turn on speed clock - /Speedo_off is turn off speed clock
#include <a_samp>
#include <zcmd>
#define FILTERSCRIPT
#define VERSION "1.0"
#define COLOR_LIGHTBLUE 0x33CCFFAA
new Text:Time, Text:Cay, Text:Ping, Text:FPS, Text:Textdraw1, Text:Textdraw3, Text:Textdraw4, Text:Speed, Text:Textdraw2, Text: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.000000, 160.000000, "--");
TextDrawBackgroundColor(Speed, 255);
TextDrawFont(Speed, 1);
TextDrawLetterSize(Speed, 0.350000, 1.200000);
TextDrawColor(Speed, -1);
TextDrawSetOutline(Speed, 1);
TextDrawSetProportional(Speed, 1);
TextDrawSetSelectable(Speed, 0);
Textdraw1 = TextDrawCreate(544.000000, 361.000000, "~r~-");
TextDrawBackgroundColor(Textdraw1, 255);
TextDrawFont(Textdraw1, 2);
TextDrawLetterSize(Textdraw1, 0.290000, 1.200000);
TextDrawColor(Textdraw1, -1);
TextDrawSetOutline(Textdraw1, 1);
TextDrawSetProportional(Textdraw1, 1);
TextDrawSetSelectable(Textdraw1, 0);
Textdraw2 = TextDrawCreate(560.000000, 373.000000, "~r~-");
TextDrawBackgroundColor(Textdraw2, 255);
TextDrawFont(Textdraw2, 1);
TextDrawLetterSize(Textdraw2, 0.210000, 1.200000);
TextDrawColor(Textdraw2, -16776961);
TextDrawSetOutline(Textdraw2, 1);
TextDrawSetProportional(Textdraw2, 1);
TextDrawSetSelectable(Textdraw2, 0);
Textdraw3 = TextDrawCreate(527.000000, 384.000000, "-");
TextDrawBackgroundColor(Textdraw3, 255);
TextDrawFont(Textdraw3, 1);
TextDrawLetterSize(Textdraw3, 5.000000, 1.000000);
TextDrawColor(Textdraw3, -1);
TextDrawSetOutline(Textdraw3, 0);
TextDrawSetProportional(Textdraw3, 1);
TextDrawSetShadow(Textdraw3, 1);
TextDrawSetSelectable(Textdraw3, 0);
Textdraw4 = TextDrawCreate(521.000000, 392.000000, "********.com/naqui9x");
TextDrawBackgroundColor(Textdraw4, -1);
TextDrawFont(Textdraw4, 1);
TextDrawLetterSize(Textdraw4, 0.230000, 1.200000);
TextDrawColor(Textdraw4, 255);
TextDrawSetOutline(Textdraw4, 1);
TextDrawSetProportional(Textdraw4, 1);
TextDrawSetSelectable(Textdraw4, 0);
Ping = TextDrawCreate(524.000000, 374.000000, "--");
TextDrawBackgroundColor(Ping, 255);
TextDrawFont(Ping, 1);
TextDrawLetterSize(Ping, 0.200000, 1.200000);
TextDrawColor(Ping, -16776961);
TextDrawSetOutline(Ping, 1);
TextDrawSetProportional(Ping, 1);
TextDrawSetSelectable(Ping, 0);
FPS = TextDrawCreate(570.000000, 374.000000, "--");
TextDrawBackgroundColor(FPS, 255);
TextDrawFont(FPS, 1);
TextDrawLetterSize(FPS, 0.200000, 1.200000);
TextDrawColor(FPS, -16776961);
TextDrawSetOutline(FPS, 1);
TextDrawSetProportional(FPS, 1);
TextDrawSetSelectable(FPS, 0);
Date = TextDrawCreate(552.000000, 361.000000,"--");
TextDrawBackgroundColor(Date, 255);
TextDrawFont(Date, 2);
TextDrawLetterSize(Date, 0.200000, 1.200000);
TextDrawColor(Date, -1);
TextDrawSetOutline(Date, 1);
TextDrawSetProportional(Date, 1);
TextDrawSetSelectable(Date, 0);
Time = TextDrawCreate(516.000000, 361.000000,"--");
TextDrawBackgroundColor(Time, 255);
TextDrawFont(Time, 2);
TextDrawLetterSize(Time, 0.200000, 1.200000);
TextDrawColor(Time, -1);
TextDrawSetOutline(Time, 1);
TextDrawSetProportional(Time, 1);
TextDrawSetSelectable(Time, 0);
Cay = TextDrawCreate(487.000000, 344.000000, "~r~V~w~ietnam~r~R~w~oleplay");
TextDrawBackgroundColor(Cay, 255);
TextDrawFont(Cay, 1);
TextDrawLetterSize(Cay, 0.509999, 1.600000);
TextDrawColor(Cay, -1);
TextDrawSetOutline(Cay, 1);
TextDrawSetProportional(Cay, 1);
TextDrawSetSelectable(Cay, 0);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid, Date), TextDrawShowForPlayer(playerid, Cay), TextDrawShowForPlayer(playerid, Ping), TextDrawShowForPlayer(playerid, FPS), TextDrawShowForPlayer(playerid, Textdraw1), TextDrawShowForPlayer(playerid, Textdraw2), TextDrawShowForPlayer(playerid, Textdraw3), TextDrawShowForPlayer(playerid, Textdraw4);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date), TextDrawHideForPlayer(playerid, Cay), TextDrawHideForPlayer(playerid, Ping), TextDrawHideForPlayer(playerid, FPS), TextDrawHideForPlayer(playerid, Textdraw1), TextDrawHideForPlayer(playerid, Textdraw2), TextDrawHideForPlayer(playerid, Textdraw3), TextDrawHideForPlayer(playerid, Textdraw4);
return 1;
}
public settime(playerid)
{
new string[256],year,month,day,hours,minutes,seconds;
getdate(year, month, day), gettime(hours, minutes, seconds);
format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
TextDrawSetString(Date, string);
format(string, sizeof string, "%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
TextDrawSetString(Time, string);
format(string, sizeof string, "~r~Ping: ~w~%d", GetPlayerPing(playerid));
TextDrawSetString(Ping, string);
format(string, sizeof string, "~r~LAG: ~w~No", pFPS[playerid]);
TextDrawSetString(FPS, string);
format(string, sizeof string, "~w~SPEED: ~r~%d ~w~KM/h.", GetSpeed(playerid));
TextDrawSetString(Speed, string);
}
stock GetSpeed(playerid)
{
new Float: Pos[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(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) {
return SendClientMessage(playerid, COLOR_LIGHTBLUE, "** You need to be in a car.");
}
SendClientMessage(playerid, COLOR_LIGHTBLUE, "** You\'re turn on speed clock");
TextDrawShowForPlayer(playerid, Text:Speed);
return 1;
}
CMD:speedo_off(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) {
return SendClientMessage(playerid, COLOR_LIGHTBLUE, "** You need to be in a car.");
}
SendClientMessage(playerid, COLOR_LIGHTBLUE, "** You\'re turn off speed clock.");
TextDrawHideForPlayer(playerid, Text:Speed);
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
TextDrawHideForPlayer(playerid, Text:Speed);
return 1;
}
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.
|