English Give a vehicle at the first connection of the player

  • Auteur de la discussion Auteur de la discussion Mathis
  • Date de début Date de début

Mathis

The-Programmer
Membre du personnel
29/12/19
503
16
48
1 100
Welcome to this tutorial that will allow you to automatically give a vehicle at the first connection of the player ;)
This tutorial is a response to a help request from Loukas13 Loukas13.

Leeeet's goo !

In your life_server/Functions/MySQL/fn_insertRequest.sqf, add this at the end of the file :
Code:
_className = "C_Van_01_transport_F";
[_uid,"civ","Car",_className,0,(round(random(1000000))),0] call DB_fnc_insertVehicle;

In your life_server/Functions/MySQL/fn_insertVehicle.sqf, replace theses lines :
Code:
params [
    "_uid",
    "_side",
    "_type",
    "_className",
    ["_color",-1,[0]],
    ["_plate",-1,[0]]
];
by theses :
Code:
params [
    "_uid",
    "_side",
    "_type",
    "_className",
    ["_color",-1,[0]],
    ["_plate",-1,[0]],
    ["_active",1,[0]]
];

And replace this line :
Code:
_query = format ["INSERT INTO vehicles (side, classname, type, pid, alive, active, inventory, color, plate, gear, damage) VALUES ('%1', '%2', '%3', '%4', '1','1','""[[],0]""', '%5', '%6','""[]""','""[]""')",_side,_className,_type,_uid,_color,_plate];
By this :
Code:
_query = format ["INSERT INTO vehicles (side, classname, type, pid, alive, active, inventory, color, plate, gear, damage) VALUES ('%1', '%2', '%3', '%4', '1','%7','""[[],0]""', '%5', '%6','""[]""','""[]""')",_side,_className,_type,_uid,_color,_plate,_active];

BE CAREFUL WITH THIS LINE IF YOU ALREADY MODIFIED IT.
(1 was replaced by %7 and ,_active was added after _plate)

And, that's it !

Sincerely,
Forum Manager Mathis
 
  • Like
Les réactions: IceEagle132
Welcome to this tutorial that will allow you to automatically give a vehicle at the first connection of the player ;)
This tutorial is a response to a help request from [USER = 771] @ Loukas13 [/ USER].

Leeeet's goo!

In your life_server / Functions / MySQL / fn_insertRequest.sqf , add this at the end of the file:
[CODED]
_className = "C_Van_01_transport_F";
[_uid, "civ", "Car", _ className, 0, (round (random (1000000))), 0] call DB_fnc_insertVehicle; [/ CODED]

In your life_server / Functions / MySQL / fn_insertVehicle.sqf , replace theses lines:
[CODED]
params [
"_uid",
"_side",
"_type",
"_className",
["_color", - 1, [0]],
["_plate", - 1, [0]]
]; [/ CODED]
by theses:
[CODED]
params [
"_uid",
"_side",
"_type",
"_className",
["_color", - 1, [0]],
["_plate", - 1, [0]],
["_active", 1, [0]]
]; [/ CODED]

And replace this line:
[CODED]
_query = format ["INSERT INTO vehicles (side, classname, type, pid, alive, active, inventory, color, plate, gear, damage) VALUES ('% 1', '% 2', '% 3', '% 4 ',' 1 ',' 1 ',' "" [[], 0] "" ','% 5 ','% 6 ',' "" [] "" ',' "" [] "" ') ", _ side, _className, _type, _uid, _color, _plate]; [/ CODED]
By this:
[CODED]
_query = format ["INSERT INTO vehicles (side, classname, type, pid, alive, active, inventory, color, plate, gear, damage) VALUES ('% 1', '% 2', '% 3', '% 4 ',' 1 ','% 7 ',' "" [[], 0] "" ','% 5 ','% 6 ',' "" [] "" ',' "" [] " "')", _ side, _className, _type, _uid, _color, _plate, _active]; [/ CODED]

BE CAREFUL WITH THIS LINE IF YOU ALREADY MODIFIED IT.
(1 was replaced by % 7 and , _active was added after _plate)

And, that's it!

Sincerely,
Forum Manager Mathis
Any chance you can make so when someone connects for the first time they get a random "Land_i_Stone_HouseSmall_V1_F" house on the map and spawn at it?
 
Hello, I have inserted it like this, the vehicle is created in the database, but it is not displayed in the garage.