function GetVehicleCount( player )
{
QuerySQL( db, "SELECT Vehicles FROM CountVehicle WHERE Name='" + player.Name + "'")
}
this is function and error is on line 43 of functions and QuerySQL( db, "SELECT Vehicles FROM CountVehicle WHERE Name='" + player.Name + "'")
is line 43 error is wrong number of parameters
plz help
You are trying to return the vehicles in your table countvehicles?
If yes try using this one:
function GetVehicleCount( player )
{
local q = QuerySQL( db, "SELECT Vehicles FROM CountVehicle WHERE Name='" + player.Name + "'" )
return GetSQLColumnData( q, 0 );
}
Always free your result:
function GetVehicleCount( player )
{
local q = QuerySQL( db, "SELECT Vehicles FROM CountVehicle WHERE Name='" + player.Name + "'" )
local count = GetSQLColumnData( q, 0 );
FreeSQLQuery( q );
return count;
}
Quote from: Thijn on Aug 03, 2015, 10:07 AMAlways free your result:
function GetVehicleCount( player )
{
local q = QuerySQL( db, "SELECT Vehicles FROM CountVehicle WHERE Name='" + player.Name + "'" )
local count = GetSQLColumnData( q, 0 );
FreeSQLQuery( q );
return count;
}
Quote from: Mashreq on Aug 03, 2015, 09:45 AMYou are trying to return the vehicles in your table countvehicles?
If yes try using this one:
function GetVehicleCount( player )
{
local q = QuerySQL( db, "SELECT Vehicles FROM CountVehicle WHERE Name='" + player.Name + "'" )
return GetSQLColumnData( q, 0 );
}
Quote from: Mashreq on Aug 03, 2015, 09:45 AMYou are trying to return the vehicles in your table countvehicles?
If yes try using this one:
function GetVehicleCount( player )
{
local q = QuerySQL( db, "SELECT Vehicles FROM CountVehicle WHERE Name='" + player.Name + "'" )
return GetSQLColumnData( q, 0 );
}
@Mashreq@Thijnthe code is not working still error is wrong number of parameters
Why using SQLite query when you can count vehice by GetVehicleCount()
Example
onScriptLoad
{
print("Counted Vehicles: "+GetVehicleCount());
}
I noticed that you using GetVehicleCount to get something from db since its an squirrel function, to avoid that error
Change your GetVehicleCount to just VehicleCount
Do
function VehicleCount( player )
{
local q = QuerySQL( db, "SELECT Vehicles FROM CountVehicle WHERE Name='" + player.Name + "'" )
local count = GetSQLColumnData( q, 0 );
FreeSQLQuery( q );
return count;
}