Use %f to display floats
Divide the 100,000 by 1000 to get 1000
When working with floats make sure you are consistent when comparing and assigning values. Always use a decimal when comparing a float variable with a number
if ( fValue = 1.0 ) and make sure the variable is a float on each side of a comparison\operation. Use float() to convert an integer value to a float.
if ( float( iValue ) == fValue )
PHP Code:
public test(id)
{
// Abfrage Spieler geschwindigkeit
new Float:speed
speed = get_user_maxspeed(id)
//new Float:gang1, gang2, gang3
// Gang 1
if( speed >= 0.0 && speed <=250.0)
{
player_gang = 1
}
// Gang 2
if( speed >= 250.0 && speed <= 400.0)
{
player_gang = 2
}
// Gang 3
if( speed >= 400.0 && speed <= 600.0)
{
player_gang = 3
}
}
public drehzahl(id)
{
client_print(id,print_chat, "public drehzahl wurde ausgefuehrt")
new Float:speed = get_user_maxspeed(id)
new Float:drehzahl
if( speed == 0.0 )
{
drehzahl = 1000.0
client_print(id,print_chat, "lol drehzahl = %f", drehzahl)
}
else
{
drehzahl = speed * 400.0 / float(player_gang)
client_print(id,print_chat, "drehzahl = %f", drehzahl)
}
}
__________________