Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Derwaish. on Jul 29, 2017, 11:56 AM

Title: Vehicles Cost Update Issue
Post by: Derwaish. on Jul 29, 2017, 11:56 AM
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
}
Title: Re: Vehicles Cost Update Issue
Post by: Decent_946 on Jul 29, 2017, 03:41 PM
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' " );
Title: Re: Vehicles Cost Update Issue
Post by: Xmair on Jul 30, 2017, 12:06 PM
In SQL, you don't use ''s for integers.
Title: Re: Vehicles Cost Update Issue
Post by: . on Jul 30, 2017, 12:42 PM
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.