AlliedModders

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

.Prometheus. 10-20-2004 11:02

Tag Mismatch Mayhem
 
Typical of me, i'm knock for my "TMM"'s.

Ok let's see about 40 tag mismatch errors in 1000 lines of code. I know it's good practice to split your plugins into multiple files, but I realy can't work like that.

What I want to know is, what realy causes this error, as I don't want to have to post my code in here as it took me a while and I don't plan for an un-compiled release.

twistedeuphoria 10-20-2004 11:07

I believe that tag mismatches happen when you give a function parameters of the wrong type.

.Prometheus. 10-20-2004 11:09

Everyone seems to confuse this...That's argument mismatch I think.

twistedeuphoria 10-20-2004 11:15

Oh, I thought arg mismatch is when you pass it the wrong number of arguments.

.Prometheus. 10-20-2004 11:19

Nope.

PM 10-20-2004 11:59

Here is what causes a tag mismatch exactly:

Code:
new Float:var1 = 5.0; new var2 = 6; var2 = var1;    // TAG MISMATCH!!!

Let's examine this code...
Line1: var1 has the Float tag. Numbers in the form of x.y have the Float tag too. So this assignment works.
Line2: var2 has no tag. Numbers in the form of x have no tag too. This assignment works too.
Line3: var2 has no tag, but var1 has Float tag. This causes a tag mismatch.

Basically, tag mismatches are errors. That is, if you assign a float to an int like this, you get a garbage result. Use the floatround() (or float() to do it the other way round) function instead of simply assigning.

.Prometheus. 10-20-2004 12:13

Well the problem is kinda focused around every time I do a mysql command.

Ok let me get an exaaaaamppppleeeee:

format(query,255,"SELECT job_name,job_pay FROM jobs WHERE jobid='%s'",job_id_res);

query_store = dbi_query(mysql,query);

dbi_nextrow(query_store)

dbi_field(query_store, 1, job_name_res, 31);

dbi_field(query_store, 2, job_pay_res, 31);

Every time I use a query_store thingy it gives me an error. and all I do is new query_store in each public thingy()


All times are GMT -4. The time now is 17:19.

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