AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Symbol already defined? (https://forums.alliedmods.net/showthread.php?t=19277)

SentryIII 10-13-2005 01:42

Symbol already defined?
 
Hi, this doesnt make sense to me. Its telling me 'format' is already defined? Little help here please...

Code:
new reports_filename[128],requests_filename[128],logspath[64],basepath = get_basedir() format(logspath, 63, "%s/logs/", basepath) format(reports_filename, 127, "%s/reports.log", logspath) format(requests_filename, 127, "%s/requests.log", logspath)

Code:

Welcome to the AMX Mod X 1.60-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team

Error: Symbol already defined: "format" on line 11
Warning: Symbol is never used: "basepath" on line 99
Warning: Symbol is never used: "logspath" on line 99

1 Error.
Could not locate output file C:\Program Files\AMXX Studio\plugins\rnr.amx (compile failed).

Line 11 is:
Code:
format(logspath, 63, "%s/logs/", basepath)

Zenith77 10-13-2005 01:45

Re: Symbol already defined?
 
Quote:

Originally Posted by SentryIII
Hi, this doesnt make sense to me. Its telling me 'format' is already defined? Little help here please...

Code:
new reports_filename[128],requests_filename[128],logspath[64],basepath = get_basedir() format(logspath, 63, "%s/logs/", basepath) format(reports_filename, 127, "%s/reports.log", logspath) format(requests_filename, 127, "%s/requests.log", logspath)

Code:

Welcome to the AMX Mod X 1.60-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team

Error: Symbol already defined: "format" on line 11
Warning: Symbol is never used: "basepath" on line 99
Warning: Symbol is never used: "logspath" on line 99

1 Error.
Could not locate output file C:\Program Files\AMXX Studio\plugins\rnr.amx (compile failed).



Line 11 is:
Code:
format(logspath, 63, "%s/logs/", basepath)


Take out one of these

Code:
format(reports_filename, 127, "%s/reports.log", logspath) format(requests_filename, 127, "%s/requests.log", logspath)


I have no clue why you did it twice...

SentryIII 10-13-2005 01:47

Because there are two different log files using the same path...

Zenith77 10-13-2005 01:50

you formated the same variable twice in a row.

You cant assign the same variable two different paths ( unless you make it a two demension array ), so just use two variables, problem solved.

XxAvalanchexX 10-13-2005 01:54

Post the code preceding it, it usually happens when you do something horribly wrong on a public function definition.

SentryIII 10-13-2005 02:02

Quote:

Originally Posted by Zenith77
you formated the same variable twice in a row.
You cant assign the same variable two different paths ( unless you make it a two demension array ), so just use two variables, problem solved.

I think you are a bit confused, maby this will help.
Code:
format ( output[], len, const format[], ... )
Example:
Code:
new dest[21] format(dest, 20, "Hello %s. You are %d years old", "Tom", 17)
Here you see 'dest' is the variable you assign. Now look at my usage:
Code:
format(reports_filename, 127, "%s/reports.log", logspath) format(requests_filename, 127, "%s/requests.log", logspath)
Look closely, but you will see that I am assigning two different variables, reports_filename and requests_filename.

This isnt even the problem, my question is still how is 'format' already defined. Im not even using it as a variable...

Zenith77 10-13-2005 02:05

O crap, i really need to get to bed lol, for some reason i assumed they were the same thing, sry man,


( ZOMG ITS 1:05 am !?!?!?! )


p.s. I know what format does, i am not a noob.

Freecode 10-13-2005 02:16

make sure you dont have like
new format somewhere in the function or as a global

XxAvalanchexX 10-13-2005 15:07

Just post the entire function up to that point.


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

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