AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   error 001: expected token: "(", but found "{" (https://forums.alliedmods.net/showthread.php?t=324797)

SpirT 05-27-2020 14:22

error 001: expected token: "(", but found "{"
 
Hey

I have got the error on this:
PHP Code:

view_as<float>{0.0,0.0,0.0}; 

Tried this but plugin does not work:
PHP Code:

view_as<float>( { 0.00.00.0 } ); 

Any fix?

Kellan123 05-27-2020 14:37

Re: error 001: expected token: "(", but found "{"
 
What about this works fine with latest compile.

New Snytax:
PHP Code:

#include < sourcemod >

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart( )
{
    
float fTest];
    
fTest view_as<float>( { 0.00.00.0 } );
    
    
PrintToServer"%.1f, %.1f, %.1f"fTest], fTest], fTest] );


// Edit: this one works too

Old:
PHP Code:

float fTest] = { 0.00.00.0 }; 


Fyren 05-27-2020 23:46

Re: error 001: expected token: "(", but found "{"
 
On 1.11, you don't need to use view_as in cases like this to avoid a tag mismatch warning.

SpirT 05-28-2020 05:00

Re: error 001: expected token: "(", but found "{"
 
Quote:

Originally Posted by Fyren (Post 2702704)
On 1.11, you don't need to use view_as in cases like this to avoid a tag mismatch warning.

Btw, I am trying to compile DR API AFK Manager v. 1.0.1 because I want to change that chat TAG. When I compile if I use both ways, one gives error, other not, and the ones that compile does not do anything.

Is there any way to make it work?

Fyren 05-28-2020 15:54

Re: error 001: expected token: "(", but found "{"
 
Which version of the compiler are you using? Can you give us an actual example of what you're doing?

Tilex 05-29-2020 20:17

Re: error 001: expected token: "(", but found "{"
 
why not simply
PHP Code:

float fTest] = { 0.00.00.0 }; 

or
PHP Code:

float fTest[3];
fTest[0] = 0.0;
fTest[1] = 0.0;
fTest[2] = 0.0


SpirT 06-06-2020 10:49

Re: error 001: expected token: "(", but found "{"
 
Quote:

Originally Posted by Fyren (Post 2702847)
Which version of the compiler are you using? Can you give us an actual example of what you're doing?

Hey! As I said before I am trying to change the chat tag of the DR API AFK MANAGER (v. 1.0.1). I am using SPEdit with the includes of the sourcemod version 1.10.0.6482.


All times are GMT -4. The time now is 00:40.

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