AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] dont have a title for this. (https://forums.alliedmods.net/showthread.php?t=92363)

One 05-14-2009 10:28

[SOLVED] dont have a title for this.
 
so first, i dont have a title for this. can anyone give me a title ?

secund :

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>

#define FANGEN_FLAG ADMIN_KICK
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new player_gang
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /a""drehzahl",FANGEN_FLAG)
    
    
// Add your code here...
}
public 
test(id)
{
    
// Abfrage Spieler geschwindigkeit
    
    
new Float:speed
    speed 
get_user_maxspeed(id)
    
    
    
//new Float:gang1, gang2, gang3
    // Gang 1
    
    
if( speed >= && speed <=250)
    {
        
player_gang 1
    
}
    
// Gang 2
    
if( speed >= 250 && speed <= 400)
    {
        
player_gang 2
    
}
    
    
// Gang 3
    
if( speed >= 400 && speed <= 600)
    {
        
player_gang 3
    
}
    
}
public 
drehzahl(id)
{
    
client_print(id,print_chat"public drehzahl wurde ausgefuehrt")
    new 
Float:speed
    speed 
get_user_maxspeed(id)
    
    
    new 
Float:drehzahl
    
if( speed == )
    {
        
drehzahl 1000.00
        client_print
(id,print_chat"lol drehzahl = %d"drehzahl)
    }
    else 
    {
        
drehzahl speed 400 player_gang

        client_print
(id,print_chat"drehzahl = %d"drehzahl)
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1031\\ f0\\ fs16 \n\\ par }
*/ 

i have by print :

drehzahl = 2139095040

why its so ?

player speed is 250 * 400 / 1 = 100 000
this must be the correct value.

& how to short the 100,000 to 1000 ?

Bugsy 05-14-2009 10:37

Re: i dont have a title for this.
 
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)
    }



One 05-14-2009 13:09

Re: i dont have a title for this.
 
tytytyty.


All times are GMT -4. The time now is 01:32.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.