Vehicles Cost Update Issue

Started by Derwaish., Jul 29, 2017, 11:56 AM

Previous topic - Next topic

Derwaish.

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
}

Decent_946

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' " );

Xmair

In SQL, you don't use ''s for integers.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

.

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.
.