SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/06/2012, 07:52 PM   #1
Danijel.
Big Clucker
 
Join Date: Apr 2012
Location: Croatia
Posts: 85
Reputation: 1
Default argument type mismatch (argument 1)

I did something wrong here:

Code:
new Query[128], i;
	new DBResult:qresult;
 	qresult = db_query(Database,"SELECT * FROM `HOUSES`");
 	format(i,sizeof(i),"%d", db_num_rows(qresult));
Danijel. is offline   Reply With Quote
Old 23/06/2012, 08:07 PM   #2
Jonny5
Gangsta
 
Join Date: Mar 2012
Location: Mi, USA
Posts: 938
Reputation: 146
Default Re: argument type mismatch (argument 1)

yes format expects a string as the first argument

pawn Code:
new Query[128];
    new DBResult:qresult;
    qresult = db_query(Database,"SELECT * FROM `HOUSES`");
    format(Query,sizeof(Query),"%d", db_num_rows(qresult));
__________________
If your topic says "REP+", I ignore it.

If you haven't tried it I suggest you do so.
Pawn PlayGround By Slice!
Jonny5 is offline   Reply With Quote
Old 23/06/2012, 08:17 PM   #3
Danijel.
Big Clucker
 
Join Date: Apr 2012
Location: Croatia
Posts: 85
Reputation: 1
Default Re: argument type mismatch (argument 1)

Not to open now topic,another problem:

Code:
stock CreateHouse(cijena, Float:X, Float:Y, Float:Z, Float:kIntX, Float:kIntY, Float:kIntZ, adresa[], intid, vrsta[])

Code:
new tipkuce[32];
	new adresakuce[32];

CreateHouse(cijenakuce, pX, pY, pZ, 2324.419921,-1145.568359,1050.710083, adresakuce, 12, tipkuce);
Errors:

Code:
C:\Users\David\Desktop\BLRP\gamemodes\BLRP.pwn(3133) : error 047: array sizes do not match, or destination array is too small
C:\Users\David\Desktop\BLRP\gamemodes\BLRP.pwn(3135) : error 047: array sizes do not match, or destination array is too small
Danijel. is offline   Reply With Quote
Old 23/06/2012, 08:21 PM   #4
DeathTone
Big Clucker
 
Join Date: Dec 2010
Posts: 165
Reputation: 28
Default Re: argument type mismatch (argument 1)

^ Thats an issue inside your stock function, could you show it?
DeathTone is offline   Reply With Quote
Old 23/06/2012, 08:21 PM   #5
Jonny5
Gangsta
 
Join Date: Mar 2012
Location: Mi, USA
Posts: 938
Reputation: 146
Default Re: argument type mismatch (argument 1)

try increaseing the size of these strings/arrays
pawn Code:
new tipkuce[32];
    new adresakuce[32];

change both of the 32 to something higher,
__________________
If your topic says "REP+", I ignore it.

If you haven't tried it I suggest you do so.
Pawn PlayGround By Slice!
Jonny5 is offline   Reply With Quote
Old 23/06/2012, 08:22 PM   #6
Danijel.
Big Clucker
 
Join Date: Apr 2012
Location: Croatia
Posts: 85
Reputation: 1
Default Re: argument type mismatch (argument 1)

No problemo.

Code:
stock CreateHouse(cijena, Float:X, Float:Y, Float:Z, Float:IntX, Float:IntY, Float:IntZ, adresa[], intid, vrsta)
{
	new Query[128], i;
	new DBResult:qresult;
 	qresult = db_query(Database,"SELECT * FROM `HOUSES`");
 	format(i,sizeof(i),"%d", db_num_rows(qresult));
 	
 	HouseInfo[i][ID] = i+1;
 	HouseInfo[i][VrstaKuce] = vrsta;
	HouseInfo[i][Cijena] = cijena;
	HouseInfo[i][Adresa] = adresa;
	HouseInfo[i][kX] = X;
	HouseInfo[i][kY] = Y;
	HouseInfo[i][kZ] = Z;
	HouseInfo[i][IntX] = IntX;
	HouseInfo[i][IntY] = IntY;
	HouseInfo[i][IntZ] = IntZ;
 	db_free_result(qresult);
	
	format(Query, sizeof(Query), "INSERT INTO `HOUSES` ( 'ID', 'VLASNIK', 'CIJENA', ADRESA', 'X', 'Y', 'Z', 'INZX', 'INTY', 'INTZ', 'MATS', 'DROGA', 'NOVAC', 'BRAVA') VALUES('%s','%s')", DB_Escape(name), DB_Escape(inputtext));
 	db_query(Database, Query);
 	
	format(Query, sizeof(Query), "UPDATE `HOUSES` SET VLASNIK = '0', CIJENA = '%d', ADRESA = '%s', X = '%f', Y = '%f', Z = '%f' WHERE `ID` = '%d' ", HouseInfo[i][Cijena], HouseInfo[i][Adresa], HouseInfo[i][kX], HouseInfo[i][kY], HouseInfo[i][kZ], HouseInfo[i][ID]);
 	db_query(Database, Query);
 	
 	format(Query, sizeof(Query), "UPDATE `HOUSES` SET INTX = '%f', INTY = '%f', INTZ = '%f', MATS = '%d', DROGA = '%d', NOVAC = '%d', BRAVA = '%d', NAPRODAJU = '1', VRSTAKUCE = '%s' WHERE `ID` = '%d' ", HouseInfo[i][IntX], HouseInfo[i][IntY], HouseInfo[i][IntZ], HouseInfo[i][kMats], HouseInfo[i][kDroga], HouseInfo[i][kNovac], HouseInfo[i][kBrava], HouseInfo[i][ID], HouseInfo[i][VrstaKuce]);
 	db_query(Database, Query);
 	
	format(KucniLabel, sizeof(KucniLabel), ""ZELENA"Kuca na PRODAJU!\nOpis:"BIJELA" %s\n"ZELENA"Adresa: "BIJELA"%s\n"ZELENA"Cijena: "BIJELA"$%i",HouseInfo[i][VrstaKuce],HouseInfo[i][Adresa],HouseInfo[i][Cijena]);
	HouseInfo[i][LabelKuce] = Create3DTextLabel(KucniLabel,-1,HouseInfo[i][kX], HouseInfo[i][kY], HouseInfo[i][kZ]+1,30.0,0,1);
	return 1;
}
Danijel. is offline   Reply With Quote
Old 23/06/2012, 08:24 PM   #7
Danijel.
Big Clucker
 
Join Date: Apr 2012
Location: Croatia
Posts: 85
Reputation: 1
Default Re: argument type mismatch (argument 1)

Tryed,even up to 1000.
Danijel. is offline   Reply With Quote
Old 23/06/2012, 08:30 PM   #8
Jonny5
Gangsta
 
Join Date: Mar 2012
Location: Mi, USA
Posts: 938
Reputation: 146
Default Re: argument type mismatch (argument 1)

hum
pawn Code:
stock CreateHouse(cijena, Float:X, Float:Y, Float:Z, Float:IntX, Float:IntY, Float:IntZ, adresa[], intid, vrsta)
i dont understand the names of these args (cijena,adresa,vrsta) but
vrsta is not marked with [] to make it a array/string
yet your calling it and passing an array/string to it
__________________
If your topic says "REP+", I ignore it.

If you haven't tried it I suggest you do so.
Pawn PlayGround By Slice!
Jonny5 is offline   Reply With Quote
Old 23/06/2012, 08:32 PM   #9
Danijel.
Big Clucker
 
Join Date: Apr 2012
Location: Croatia
Posts: 85
Reputation: 1
Default Re: argument type mismatch (argument 1)

vrsta is an array just i have 2 scripts opened, 1 old and 2 up-to-date and i copied from the wrong one
Danijel. is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How problem! (error 035: argument type mismatch (argument 2) Please help me some one! Request Scripting Help 1 09/01/2012 06:28 PM
(1500)error 035: argument type mismatch (argument 2) eеe Scripting Help 2 17/12/2011 02:26 PM
Help plox(error 035: argument type mismatch (argument 2) TheTerminator Scripting Help 2 18/11/2011 06:54 PM
[SOLVED]error 035: argument type mismatch (argument 1) KoczkaHUN Help Archive 0 28/04/2011 12:49 PM
[mySQL] error 035: argument type mismatch (argument 1) DiddyBop Help Archive 4 16/08/2010 11:45 AM


All times are GMT. The time now is 03:47 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.