26.05.2011, 00:18
Hello, well, I have these textdraws formateed every 1000 ms, but it crashes my game when the var is set.
Everything is appreciated.
pawn Код:
public UpdateTextdraw()
{
new szString[40];
foreach(Player, i)
{
// AFK
if (GetPVarInt(i, "AFK") == 1) TextDrawShowForPlayer(i, afk);
else TextDrawHideForPlayer(i, afk);
if (IsPlayerInAnyVehicle(i))
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(i, X, Y, Z);
// FUEL
format(szString, 40, "Fuel:~w~ %d", Gas[GetPlayerVehicleID(i)]);
TextDrawSetString(TD_0[i], szString);
// DIST
new Float:Dist;
Dist = GetDistanceBetweenPoints(X, Y, Z, IslandX[i], IslandY[i], IslandZ[i]);
if (GetPVarInt(i, "Flight") > 0 || GetPVarInt(i, "Work") > 0)
{
format(szString, 40, "DIST:~w~ %d", floatround(Dist, floatround_round));
TextDrawSetString(TD_4[i], szString);
}
else
{
TextDrawSetString(TD_4[i], "DIST:~w~ None");
}
// DMG
new Float:HP;
GetVehicleHealth(GetPlayerVehicleID(i), HP);
format(szString, 40, "DMG:~w~ %d", floatround(HP, floatround_round));
TextDrawSetString(TD_3[i], szString);
// ALT
format(szString, 40, "ALT:~w~ %d", floatround(Z, floatround_ceil));
TextDrawSetString(TD_5[i], szString);
// VEHICLE
format(szString, 40, "VEH:~w~ %s", GetVehicleFriendlyName(GetPlayerVehicleID(i)));
TextDrawSetString(TD_6[i], szString);
// STATUS
if (GetPVarInt(i, "Work") > 0)
{
TextDrawSetString(TD_7[i], "Status:~w~ Work");
}
if (GetPVarInt(i, "Flight") == 1)
{
TextDrawSetString(TD_7[i], "~Status:~w~ On Route");
}
if (GetPVarInt(i, "Flight") == 0)
{
if (GetPVarInt(i, "Work") == 0)
{
if (IsAirVehicle(GetPlayerVehicleID(i)))
{
TextDrawSetString(TD_7[i], "Status:~w~ Flying");
}
else
{
TextDrawSetString(TD_7[i], "Status:~w~ None");
}
}
}
// HDG
new Float:ZAngle;
GetPlayerFacingAngle(i, ZAngle);
format(szString, 40, "HDG:~w~ %d", floatround(ZAngle, floatround_round));
TextDrawSetString(TD_8[i], szString);
// Pilots
format(szString, 40, "Pilots:~w~ %d/20", Count);
TextDrawSetString(TD_11[i], szString);
// Cash
format(szString, 40, "Cash:~w~ %d", GetPlayerMoney(i));
TextDrawSetString(TD_12[i], szString);
// Tail
format(szString, 40, "~w~%d-%s", VehicleTailNumber[GetPlayerVehicleID(i)][0], Tailnumbers[VehicleTailNumber[GetPlayerVehicleID(i)][1]]);
TextDrawSetString(TD_17[i], szString);
// Doors
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(GetPlayerVehicleID(i), engine, lights, alarm, doors, bonnet, boot, objective);
if (doors == 0) TextDrawSetString(TD_10[i], "Doors:~w~ Unlocked");
else TextDrawSetString(TD_10[i], "Doors:~w~ Locked");
// DEST
if (GetPVarInt(i, "Flight") > 0)
{
format(szString, 40, "DEST:~w~ %s", GetDestination(i));
}
else if (GetPVarInt(i, "Flight") == 0)
{
TextDrawSetString(TD_2[i], "DEST:~w~ None");
}
if (GetPVarInt(i, "Work") > 0)
{
format(szString, 40, "DEST:~w~ %s", GetDestination(i));
}
else if (GetPVarInt(i, "Work") == 0)
{
TextDrawSetString(TD_2[i], "DEST:~w~ None");
}
// GPS
format(szString, 40, "GPS:~w~ %s", GetPlayerArea(i));
TextDrawSetString(TD_9[i], szString);
// KMH
if (IsPlayerInAnyVehicle(i))
{
new Float:KMH_Sp = GetPlayerSpeed(i, true);
format(szString, 40, "KMH:~w~ %d", floatround(KMH_Sp, floatround_round));
}
else
{
format(szString, 40, "KMH:~w~ %d", 0);
}
TextDrawSetString(TD_14[i], szString);
// MPH
if (IsPlayerInAnyVehicle(i))
{
new Float:MPH_Sp = GetPlayerSpeed(i, false);
format(szString, 40, "MPH:~w~ %d", floatround(MPH_Sp, floatround_round));
}
else
{
format(szString, 40, "MPH:~w~ %d", 0);
}
TextDrawSetString(TD_13[i], szString);
// KNOTS
if (IsPlayerInAnyVehicle(i))
{
new Float:KNT_Sp = GetPlayerSpeed(i, true) * 1.5;
format(szString, 40, "KNOT:~w~ %d", floatround(KNT_Sp, floatround_round));
}
else
{
format(szString, 40, "KNOT:~w~ %d", 0);
}
TextDrawSetString(TD_15[i], szString);
}
}
return 1;
}