Raised This Month: $ Target: $400
 0% 

argument type mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xfirestorm
Member
Join Date: Mar 2012
Old 02-25-2013 , 08:18   argument type mismatch
Reply With Quote #1

Hi,

I'm having a bit of trouble with this code:
Code:
public func1() {
new var1[32];
var1 = func2();
}

public func2() {
new var2[32];
if(something) var2 = "0";
else var2 = "<here come 32 chars>";
return var2;
}
I'm getting "argument type mismatch" on var1 = func2();, I also tried replacing this line with:
strcat(var1,func2(),31);
same result.

Is this not allowed?
xfirestorm is offline
xfirestorm
Member
Join Date: Mar 2012
Old 02-25-2013 , 08:40   Re: argument type mismatch
Reply With Quote #2

How the...
Anyway, I just tried compiling that sample code and it works...
Well, here is the actual code:
Quote:
public hbID_check(data[1],taskid) {
new id = data[0];
new name[32];
get_user_name(id,name,31);
new old_hbID[32];

strcat(old_hbID,db_check_name_exists(id,name) ,31);
/* ... more code ... */
return 0;
}

public db_check_name_exists(id,name) {
new return_val[32];
new hbID[32];
return_val = "0";
new Sql:conn;
conn = dbi_connect("localhost","user","secret","dev_ db");
new rHandle;
rHandle = dbi_query(conn,"SELECT hbid FROM hbid_store WHERE player_name = '%s'",name);
if(rHandle < 0) {
return_val = "-1";
} else if (rHandle > 0) {
dbi_nextrow(rHandle);
dbi_result(rHandle,"hbid",hbID,31);

dbi_free_result(rHandle);
dbi_close(conn);

return_val = hbID;
}

dbi_close(conn);

return return_val;
}
Error is on this line: strcat(old_hbID,db_check_name_exists(id,name) ,31);

Last edited by xfirestorm; 02-25-2013 at 08:41.
xfirestorm is offline
xfirestorm
Member
Join Date: Mar 2012
Old 02-25-2013 , 08:52   Re: argument type mismatch
Reply With Quote #3

Ah...I will always use brains before asking stupid questions. I will always use brains before asking stupid questions.

I seriously doubt that someone will do such a dumb mistake as I did again, but just in case.
After changing second function declaration to:
public db_check_name_exists(id,name[])
things started to work as expected.
xfirestorm is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:43.


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