AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Code doesn't work (https://forums.alliedmods.net/showthread.php?t=220113)

UchihaSkills 07-07-2013 06:09

Code doesn't work
 
Hey why isnt this code working?

PHP Code:

public CmdShow(id)
{
    new 
Float:Bitcs;
    
pev0pev_maxspeedBitcs );
    
client_printidprint_chat"%4.1f"Bitcs );



mottzi 07-07-2013 06:22

Re: Code doesn't work
 
Why do you use 0 and not id?

ConnorMcLeod 07-07-2013 06:24

Re: Code doesn't work
 
0 is world, pev->maxspeed is not used for it

UchihaSkills 07-07-2013 06:25

Re: Code doesn't work
 
so i have to use
PHP Code:

public CmdShow(id)
{
    new 
Float:Bitcs;
    
pevidpev_maxspeedBitcs );
    
client_printidprint_chat"%4.1f"Bitcs );



ConnorMcLeod 07-07-2013 06:31

Re: Code doesn't work
 
Yes

Or :

PHP Code:

public CmdShow(id)
{
    
client_printidprint_chat"%4.1f"get_user_maxspeedid ) );


or

PHP Code:

public CmdShow(id)
{
    
client_printidprint_chat"%4.1f"entity_get_floatidEV_FL_maxspeed ) );



UchihaSkills 07-07-2013 06:40

Re: Code doesn't work
 
Why is it better to use entity_get_float ?

Arkshine 07-07-2013 09:39

Re: Code doesn't work
 
Use first. entity_get_float() has to handle more code, and even though it doesn't make really a difference, better to use native which does directly the job, so get_user_maxspeed().

UchihaSkills 07-07-2013 09:44

Re: Code doesn't work
 
Thanks arkshine and connor, i think i got it now

dFF 07-07-2013 14:21

Re: Code doesn't work
 
Sorry for offtopic.

Quote:

Originally Posted by Arkshine (Post 1985393)
Use first. entity_get_float() has to handle more code

What it's the "more code" ?
For example: it these case it's not better to use entity_get_float() instead of pev() ?
Fakemeta have all pev_ values in pev() function and Engine have function in grouped in entity_get_int; entity_get_vector; entity_get_edict; etc. so it's not a little better engine because have all those functions grouped ?

ConnorMcLeod 07-07-2013 14:29

Re: Code doesn't work
 
He was talking about get_user_maxspeed against entity_get_float.

get_user_maxspeed is better than entity_get_float, and entity_get_float is better than pev, but again, this is trivial, the 3 ways are ok, well coded code with pev is better than feet (french expression) coded code with get_user_maxspeed.


All times are GMT -4. The time now is 06:30.

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