24.07.2016, 16:37
Good evening!
Can't remember, is it from the time when server changed to 0.3.7 version or earlier , but main problem is that speedo textdraw doesn't show up like it should be: "KM/H: 50" (speed "50" is for example). Now, when I type command "/speedo" it shows me black line, almost at the top, screen below:
So, here's the lines:
At the top:
Under "OnGameModeInit":
Under commands:
Under "OnPlayerStateChange"
And under "OnPlayerUpdate":
Can't remember, is it from the time when server changed to 0.3.7 version or earlier , but main problem is that speedo textdraw doesn't show up like it should be: "KM/H: 50" (speed "50" is for example). Now, when I type command "/speedo" it shows me black line, almost at the top, screen below:
So, here's the lines:
At the top:
pawn Код:
new showspeedo[MAX_PLAYERS], Text:Speedometer[MAX_PLAYERS];
pawn Код:
foreach(new i : Player)
{
if(IsPlayerConnected(i))
{
Speedometer[i] = TextDrawCreate(300.0, 437.0, "KM/H: 0");
TextDrawFont(Speedometer[i], 1);
TextDrawSetOutline(Speedometer[i], 1);
TextDrawSetShadow(Speedometer[i], 0);
}
}
pawn Код:
CMD:speedo(playerid, params[])
{
#pragma unused params
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must be in vehicle to use this command!");
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_RED, "Only driver can use this command!");
if(showspeedo[playerid] == 0)
{
TextDrawShowForPlayer(playerid, Speedometer[playerid]);
showspeedo[playerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, "^ Speedometer ON!");
}
else if(showspeedo[playerid] == 1)
{
TextDrawHideForPlayer(playerid, Speedometer[playerid]);
showspeedo[playerid] = 0;
SendClientMessage(playerid, COLOR_RED, "^ Speedometer OFF!");
}
return 1;
}
pawn Код:
if(showspeedo[playerid] == 1)
{
if(oldstate == PLAYER_STATE_DRIVER)
{
if(newstate == PLAYER_STATE_ONFOOT)
{
TextDrawHideForPlayer(playerid, Speedometer[playerid]);
showspeedo[playerid] = 0;
}
}
}
pawn Код:
if(showspeedo[playerid] == 1 && IsPlayerInAnyVehicle(playerid))
{
new SpeedString[24];
format(SpeedString, sizeof(SpeedString), "~g~KM/H: ~r~%d", GetVehicleSpeed(GetPlayerVehicleID(playerid)));
TextDrawShowForPlayer(playerid, Speedometer[playerid]);
TextDrawSetString(Speedometer[playerid], SpeedString);
}