AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   must be lvalue (non-constant) (https://forums.alliedmods.net/showthread.php?t=338628)

XSlayer 07-17-2022 22:50

must be lvalue (non-constant)
 
PHP Code:

stock Encode16Fixed_4dot12(Float:x)
{
   
*= float(<< 12);
   new 
val floatround(xfloatround_floor);
   return 
val<: (val>0xFFFF 0xFFFF val);


Code:

must be lvalue (non-constant)
does anyone known why thow me that error?,
PHP Code:

*= float(<< 12); 


Bugsy 07-17-2022 23:30

Re: must be lvalue (non-constant)
 
Compiles fine for me. Do you maybe have x defined globally, as a constant?

Simple fix:
PHP Code:

stock Encode16Fixed_4dot12(Float:fValue)
{
    
fValue *= float(<< 12);
    new 
val floatround(fValuefloatround_floor);
    return 
val<: (val>0xFFFF 0xFFFF val);



XSlayer 07-18-2022 01:13

Re: must be lvalue (non-constant)
 
Quote:

Originally Posted by Bugsy (Post 2784035)
Compiles fine for me. Do you maybe have x defined globally, as a constant?

Simple fix:
PHP Code:

stock Encode16Fixed_4dot12(Float:fValue)
{
    
fValue *= float(<< 12);
    new 
val floatround(fValuefloatround_floor);
    return 
val<: (val>0xFFFF 0xFFFF val);



oo that was, yes i had a X gloabal constant XD my bad, thanks by the way

Natsheh 07-18-2022 03:37

Re: must be lvalue (non-constant)
 
Quote:

Originally Posted by XSlayer (Post 2784040)
oo that was, yes i had a X gloabal constant XD my bad, thanks by the way

Always make the global variables names declaration very unique, and start it with the tag g_ as for global.


All times are GMT -4. The time now is 15:35.

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