mismatch error - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: mismatch error (
/showthread.php?tid=570757)
mismatch error -
Hybris - 12.04.2015
Hello I get this error on these lines im not really sure whats wrong with it though
Код:
error 035: argument type mismatch (argument 1)
Код:
format(szQuery, sizeof(szQuery), "DELETE FROM bans WHERE name = '%s'", DB_Escape(params));
db_free_result(db_query(szQuery, pBanned));
I tried putting szQuery instead of pBanned and vice versa but it still didnt work.
Re: mismatch error -
MEW273 - 13.04.2015
Hi Hybris,
I used the wiki to get this result (links
https://sampwiki.blast.hk/wiki/Db_query https://sampwiki.blast.hk/wiki/Db_free_result).
Try using this code. You may need to replace db_handle with your database handle which should have been defined when you used db_open.
Код:
format(szQuery, sizeof(szQuery), "DELETE FROM bans WHERE name = '%s'", DB_Escape(params));
db_result = db_query(db_handle, szQuery);
db_free_result(db_result);
I would also suggest you read over the wiki for db_query. Please see following extract from the wiki.
db_query(DB:db, query[]);
DB:db The database handle to query.
query[] The query to execute.
I don't think your DB:db (database to handle query) is correct and should not be szQuery. The correct DB:db to use would be where you used:
db_handle = db_open("example.db")
So your db_query should look like this:
db_query(db_handle, szQuery);
Re: mismatch error -
Hybris - 13.04.2015
The only problem is im using BUDs and I do not have db_open I have BUD::Setting(opt.Database, "Users.db");
The script uses BUDs to start the database
Re: mismatch error -
MEW273 - 13.04.2015
Quote:
Originally Posted by Hybris
The only problem is im using BUDs and I do not have db_open I have BUD::Setting(opt.Database, "Users.db");
The script uses BUDs to start the database
|
If you are using BUD (which I will assume is this include:
https://sampforum.blast.hk/showthread.php?tid=187720 ) then I don't believe you should be using db_free_result at all.
Can you show me the entire function where you are using those two lines of code. I suggest if you haven't already that you check out this tutorial for using BUD:
https://sampforum.blast.hk/showthread.php?pid=2116226#pid2116226