helló lassan össze sikerült hoznom a magasság mérõt csak az a baj hogy nem méri :(
#include <a_samp>
#define SLOTS 200
enum SavePlayerPosEnum {
Float:LastX,
Float:LastY,
Float:LastZ
}
new SavePlayerPos[sLOTS][savePlayerPosEnum];
new Text:Speedo[sLOTS];
new UpdateSeconds;
forward UpdateSpeed();
public OnFilterScriptInit()
{
SetTimer(\"UpdateSpeed\",1000, 1);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
main()
{
}
public UpdateSpeed()
{
new Float:x,Float:y,Float:z;
new Float:distance,value,string[256];
for(new i=0; i<SLOTS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, x, y, z);
distance = floatsqroot(floatpower(x,SavePlayerPos[LastX]))+(floatpower(y,SavePlayerPos[LastY]))+(floatpower(z,SavePlayerPos[LastZ]));
value = floatround(distance * 5000);
if(UpdateSeconds > 1)
{
value = floatround(value / UpdateSeconds);
}
format(string,sizeof(string),\"~w~Altitude: %.1f\",z);
Speedo = TextDrawCreate(320.00, 380.00, string);
TextDrawSetOutline(Speedo, 1);
TextDrawFont(Speedo, 2);
TextDrawSetProportional(Speedo, 1);
TextDrawAlignment(Speedo, 1);
}
SavePlayerPos[LastX] = x;
SavePlayerPos[LastY] = y;
SavePlayerPos[LastZ] = z;
}
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Speedo[playerid]);
return 1;
}
ha valaki tudja írja meg kösz elõre is!
#include <a_samp>
new Text:Speedo[MAX_PLAYERS];
public OnPlayerConnect ( playerid )
{
Speedo[playerid] = TextDrawCreate(320.00, 380.00, \"Magasság: \");
TextDrawSetOutline(Speedo[playerid], 1);
TextDrawFont(Speedo[playerid], 2);
TextDrawSetProportional(Speedo[playerid], 1);
TextDrawAlignment(Speedo[playerid], 1);
return 1;
}
public OnPlayerUpdate( playerid )
{
new Float:Pos[3], string[32];
if ( IsPlayerInAnyVehicle ( playerid ) ) GetVehiclePos ( GetPlayerVehicleID ( playerid ), Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
else GetPlayerPos ( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
format ( string, 32, \"Magasság: %f\", Pos[ 2 ] );
TextDrawSetString ( Speedo[ playerid ], string );
TextDrawShowForPlayer ( playerid, Speedo[ playerid ] );
return 1;
}