01.09.2009, 13:47
Hey, I've with my Speedometer (Textdraw/Gametext "powered). When Its only 1 player on my server, it gets it's up. But when its more, it only shows up for 1, or not at all... Help please
Originally Posted by ► James_Alex
can u give us the speedo code ?
|
forward Gosterge();
new Text: GostergeYazi[MAX_PLAYERS];
new Text: ArkaBox[3];
new HGS;
// public GameModeInitExitFunc()
KillTimer(HGS);
TextDrawDestroy(Text:ArkaBox[1]);
TextDrawDestroy(Text:ArkaBox[2]);
for(new i=0; i<MAX_PLAYERS; i++)
{
TextDrawDestroy(GostergeYazi[i]);
}
//public OnGameModeInit()
HGS = SetTimer("Gosterge",500,1);
//Bottom
public Gosterge()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
new VID = GetPlayerVehicleID(i);
if(IsPlayerConnected(i) && (IsPlayerInAnyVehicle(i) && G[i] == 1) && !IsABike(VID))
{
if(ArkaPlanFull[i] == false)
{
TextDrawShowForPlayer(i, Text:ArkaBox[1]);
TextDrawShowForPlayer(i, Text:ArkaBox[2]);
ArkaPlanFull[i] = true;
}
new HGG[265]; new Float:Can;
GetVehicleHealth(GetPlayerVehicleID(i), Can);
GetPlayerPos(i,Xa,Ya,Za);
new Float:X = floatsqroot(floatpower(floatabs(floatsub(Xa,Xb)),3));
new Float:Y = floatsqroot(floatpower(floatabs(floatsub(Ya,Yb)),3));
new Float:Z = floatsqroot(floatpower(floatabs(floatsub(Za,Zb)),3));
KMH = X + Y + Z;
MPH = X + Y + Z;
KMH *= 1.5;
MPH *= 0.8;
Yukseklik = Za;
new LuxZone[MAX_ZONE_NAME];
GetPlayer2DZone(i, LuxZone, MAX_ZONE_NAME);
new Float:x,Float:y,Float:z;
new Float:distance,value;
GetPlayerPos(i, x, y, z);
distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2));
SavePlayerPos[i][LastX] = x;
SavePlayerPos[i][LastY] = y;
SavePlayerPos[i][LastZ] = z;
value = floatround(distance * 11000);
if(Yazi[i] == true)
{
TextDrawDestroy(GostergeYazi[i]);
}
new GPS = PlayerInfo[i][pGPS];
if(VehicleGas[VID] <= 10 && GPS == 1)
{
format(HGG, sizeof(HGG), "~b~~h~Vehicle: ~w~%s~n~~g~~h~~h~Fuel: ~w~~r~~h~%d%%~n~~b~~h~Speed: ~w~%d km/h~n~~r~~h~Location:~n~~p~~h~'%s'~n~~y~Height: ~w~%.1f", ArIsim[GetVehicleModel(GetPlayerVehicleID(i))-400],VehicleGas[VID], floatround(value/1400), LuxZone, Yukseklik);
}
else if(VehicleGas[VID] <= 10 && GPS == 0)
{
format(HGG, sizeof(HGG), "~b~~h~Vehicle: ~w~%s~n~~g~~h~~h~Fuel: ~w~~r~~h~%d%%~n~~b~~h~Speed: ~w~%d km/h~n~~n~~r~~h~ <No GPS>", ArIsim[GetVehicleModel(GetPlayerVehicleID(i))-400],VehicleGas[VID], floatround(value/1400));
}
else if(GPS == 0)
{
format(HGG, sizeof(HGG), "~b~~h~Vehicle: ~w~%s~n~~g~~h~~h~Fuel: ~w~%d%%~n~~b~~h~Speed: ~w~%d km/h~n~~n~~r~~h~ <No GPS>", ArIsim[GetVehicleModel(GetPlayerVehicleID(i))-400],VehicleGas[VID], floatround(value/1400));
}
else if(GPS == 1)
{
format(HGG, sizeof(HGG), "~b~~h~Vehicle: ~w~%s~n~~g~~h~~h~Fuel: ~w~%d%%~n~~b~~h~Speed: ~w~%d km/h~n~~r~~h~Location:~n~~p~~h~'%s'~n~~y~Height: ~w~%.1f", ArIsim[GetVehicleModel(GetPlayerVehicleID(i))-400],VehicleGas[VID], floatround(value/1400), LuxZone, Yukseklik);
}
GostergeYazi[i] = TextDrawCreate(515.000000,368.000000,HGG);
TextDrawAlignment(GostergeYazi[i],0);
TextDrawBackgroundColor(GostergeYazi[i],0x000000ff);
TextDrawFont(GostergeYazi[i],1);
TextDrawLetterSize(GostergeYazi[i],0.299999,1.000000);
TextDrawColor(GostergeYazi[i],0xffff00ff);
TextDrawSetProportional(GostergeYazi[i],1);
TextDrawSetShadow(GostergeYazi[i],1);
TextDrawShowForPlayer(i,Text:GostergeYazi[i]);
Yazi[i] = true;
}
else
{
if(ArkaPlanFull[i] == true)
{
TextDrawHideForPlayer(i, Text:ArkaBox[1]);
TextDrawHideForPlayer(i, Text:ArkaBox[2]);
ArkaPlanFull[i] = false;
} TextDrawHideForPlayer(i, Text:GostergeYazi[i]);
} GetPlayerPos(i,Xb,Yb,Zb);
}
}
stock GetPlayer2DZone(playerid, zone[], len)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i = 0; i != sizeof(SanAndreasZones); i++ ){
if(x >= SanAndreasZones[i][Zone_Area][0] && x <= SanAndreasZones[i][Zone_Area][3] && y >= SanAndreasZones[i][Zone_Area][1] && y <= SanAndreasZones[i][Zone_Area][4]){
return format(zone, len, SanAndreasZones[i][Zone_Name], 0);}
}
return 0;
}
Originally Posted by ► James_Alex
have u used any retuurn in loops ?
|
Originally Posted by ► James_Alex
what i mean if you have use
"for(new ...." then under it's functionq you have added a return ? |
Originally Posted by ► James_Alex
nup
|