AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Tag mismatch (https://forums.alliedmods.net/showthread.php?t=147522)

Jelle 01-10-2011 10:53

Tag mismatch
 
PHP Code:

new Float:gGravity[SH_MAXSLOTS+1]

public 
get_gravity(id)
{
    
gGravity[id] = get_user_gravity(id)


This is what I have to get the gravity of a user. When I do this:

PHP Code:

set_user_gravity(idgGravity

I get tag mismatch on the second param. I really don't get why.

Anyone knows this?

xPaw 01-10-2011 11:02

Re: Tag mismatch
 
gGravity[id]

Jelle 01-10-2011 11:05

Re: Tag mismatch
 
ahh stupid me :D

Thanks.

Jelle 01-10-2011 12:28

Re: Tag mismatch
 
ok, new question. I get tag mismatch in the line with the check in this code:

PHP Code:

    new Float:delay get_pcvar_num(pcvarTeleDelay)
    if ( 
delay 0.0 )
    {
        
delay 0.0
    



xPaw 01-10-2011 12:36

Re: Tag mismatch
 
get_pcvar_float

abdul-rehman 01-10-2011 12:36

Re: Tag mismatch
 
Code:
    new Float:delay = float(get_pcvar_num(pcvarTeleDelay))     if ( delay < 0.0 )     {         delay = 0.0     }
Or if you r sure that the cvar is a Float then you can do this
Code:
    new Float:delay = get_pcvar_float(pcvarTeleDelay)     if ( delay < 0.0 )     {         delay = 0.0     }

Jelle 01-10-2011 12:38

Re: Tag mismatch
 
Doh. Dunno what I was thinking. Thanks!

Flipper_SPb 01-11-2011 07:58

Re: Tag mismatch
 
Quote:

Originally Posted by abdul-rehman (Post 1390633)
Or if you r sure that the cvar is a Float then you can do this

You don't need to be sure. get_pcvar_float allways return float. Even if CVAR value is "3", "3.01", "ddddd"

Jelle 01-11-2011 09:25

Re: Tag mismatch
 
Quote:

Originally Posted by Flipper_SPb (Post 1391220)
You don't need to be sure. get_pcvar_float allways return float. Even if CVAR value is "3", "3.01", "ddddd"

What is the float term of "ddddd"?

Elusive138 01-11-2011 09:55

Re: Tag mismatch
 
Quote:

Originally Posted by Jelle (Post 1391277)
What is the float term of "ddddd"?

That should return 0.0

str_to_num("ddddd") would return 0 and str_to_num("15ddddd") would return 15. I've never tested with anything else, but they should be the same? You could always go test it yourself :)


All times are GMT -4. The time now is 02:05.

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