Hello Friends,
I am newbie in scripting.My friends helped me in adding vehicles in server using /cveh command. But they have changed the costs of vehicles.I mean , I added a PCJ with 350000 cost while my friends added the pcj's on different costs. I am trying to create a function to auto update cost of same model of vehicles using that function in " OnScriptLoad " function. Can anybody help me.
function updatec(vehicle)
{
local veh = QuerySQL( Vehicles,"SELECT FROM Sale WHERE Model='"+Vehicle.Model+"'"); ;
QuerySQL( Vehicles,"UPDATE Sale SET Cost='"+Price+"' WHERE Model='"+Vehicle.Model+"'");
if( veh.Model == 191) return "350000";
else if(veh == 232) return "450000"; //hotring
}
you can simply execute the query on function onScriptLoad()
function onScriptLoad()
{
QuerySQL( Vehicles, "UPDATE Cost SET = '350000' WHERE Model = '191' " );
}
or you can update cost of any vehilce by /exec command. ( hope you have got that command )
use, /exec QuerySQL( Vehicles, "UPDATE Cost SET = '350000' WHERE Model = '191' " );
In SQL, you don't use ''s for integers.
Quote from: Xmair on Jul 30, 2017, 12:06 PMIn SQL, you don't use ''s for integers.
As if anyone here reads the documentation or knows what they're doing. They just spit out text and expect it to work.