Sauvegarder l'essence du véhicule dans la DB
-
<p style="margin:0px;padding:0px;color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;text-align:center;"><span style="font-family:georgia, serif;"><span style="font-size:24px;">Sauvegarder l'essence dans la DB</span></span></p><p style="margin:0px;padding:0px;color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;text-align:center;">Ce tutoriel fonctionne pour les version 3.1.x pour la version 4.0 je ferais un tuto quand j'aurai le temps</p><p style="margin-top:0px;margin-right:0px;margin-left:0px;padding:0px;color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;"><span style="font-family:georgia, serif;">Ajouter une table sur votre base de donnée MySql</span></p><pre class="ipsCode prettyprint">ALTER TABLE
vehiclesADDfuelVARCHAR(16) NOT NULL DEFAULT '1'</pre><p><span style="color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;">Ensuite aller dans le fichier \extDB-Build\life_server\Functions\Systems\fn_cleanup.sqf</span></p><pre class="ipsCode prettyprint">_query = format["UPDATE vehicles SET active='0', fuel='%3' WHERE pid='%1' AND plate='%2'",_uid,_plate,fuel _veh];</pre><p><span style="color:rgb(40,40,40);font-family:georgia, serif;line-height:22.4px;">il faut juste aller dans la variable "_query" et ajouter </span></p><pre class="ipsCode prettyprint">fuel='%3' WHERE pid='%1' AND plate='%2'",_uid,_plate,fuel _veh</pre><p style="margin:0px;padding:0px;color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;"><span style="font-family:georgia, serif;">à coter de "active ='0" </span></p><p style="margin:0px;padding:0px;color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;"> </p><p style="margin:0px;padding:0px;color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;"><span style="font-family:georgia, serif;">Maintenant vous aller dans le fichier </span>fn_vehicleStore.sqf </p><p style="margin-top:0px;margin-right:0px;margin-left:0px;padding:0px;color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;"><span style="font-family:georgia, serif;">Puis vous aller en bas de </span>if(_impound) <span style="font-family:georgia, serif;">et la vous aurai une variable qui s'appelle _query et vous modifier cette ligne de code</span></p><pre class="ipsCode prettyprint">_query = format["UPDATE vehicles SET active='0', fuel='%3' WHERE pid='%1' AND plate='%2'",_uid,_plate, fuel _vehicle];</pre><p><span style="color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;">Maintenant vous rester dans le même fichier et en bas vers la ligne 52 pour mon cas il y'au une autre var _query vous la modifier puis vous mettez la même chose c'est à dire :</span></p><pre class="ipsCode prettyprint">_query = format["UPDATE vehicles SET active='0', fuel='%3' WHERE pid='%1' AND plate='%2'",_uid,_plate, fuel _vehicle];</pre><p style="margin:0px;padding:0px;color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;"><span style="font-family:georgia, serif;">Maintenant vous aller dans le fichier </span>fn_spawnVehicle.sqf</p><p style="margin-top:0px;margin-right:0px;margin-left:0px;padding:0px;color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;">et vous faite la même procédure vous changer la variable _query par :</p><pre class="ipsCode prettyprint">_query = format["SELECT id, side, classname, type, pid, alive, active, plate, color, fuel FROM vehicles WHERE id='%1' AND pid='%2'",_vid,_pid];</pre><p><span style="color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;">Puis juste en bas de cette var vous rajouter :</span></p><pre class="ipsCode prettyprint">_fuel = parseNumber(_queryResult select 9);</pre><p><span style="color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;">puis enfin pour terminer vous ajouter ce code en bas de "_vehicle setDir _dir;"</span></p><pre class="ipsCode prettyprint">_vehicle setFuel _fuel;</pre><p><span style="color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;">Ce qui donne :</span></p><pre class="ipsCode prettyprint">if(typeName _sp == "STRING") then {
_vehicle = createVehicle[(_vInfo select 2),[0,0,999],[],0,"NONE"];
waitUntil {!isNil "_vehicle" && {!isNull _vehicle}};
_vehicle allowDamage false;
_hs = nearestObjects[getMarkerPos _sp,["Land_Hospital_side2_F"],50] select 0;
_vehicle setPosATL (_hs modelToWorld [-0.4,-4,12.65]);
sleep 0.6;
} else {
_vehicle = createVehicle [(_vInfo select 2),_sp,[],0,"NONE"];
waitUntil {!isNil "_vehicle" && {!isNull _vehicle}};
_vehicle allowDamage false;
_vehicle setPos _sp;
_vehicle setVectorUp (surfaceNormal _sp);
_vehicle setDir _dir;
_vehicle setFuel _fuel;</pre><p><span style="color:rgb(40,40,40);font-family:helvetica, arial, sans-serif;line-height:22.4px;">J’espère pas avoir fait d'erreur et sinon pour le version 4.0 je ferais le plutôt possible </span></p><p>Et enfaîte je suis de retour sur melinyel <img alt=":D" src="emoticons/default_biggrin.png" title=":D"/></p> -
<div><blockquote class="ipsQuote" data-cite="edgekiller" data-ipsquote="" data-ipsquote-contentclass="forums_Topic" data-ipsquote-contentcommentid="17521" data-ipsquote-contentid="1807" data-ipsquote-contenttype="forums" data-ipsquote-timestamp="1446290937" data-ipsquote-userid="14" data-ipsquote-username="edgekiller"><p>Merci pour le tuto et bon retour <img alt=":)" src="emoticons/default_smile.png" title=":)"/></p></blockquote></div><p><span>Oh edgekiller tu te rappelle de moi ?</span></p>
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login