• 03 Mai 2024, 17:23:48


Voir les contributions

Cette section vous permet de consulter les contributions (messages, sujets et fichiers joints) d'un utilisateur. Vous ne pourrez voir que les contributions des zones auxquelles vous avez accès.


Messages - CafeOLait

Pages: [1] 2
1
Merci ;-)

Je vais commencer aujourd'hui...

2
Scripting MTA [Lua Center] / [DISCUSSION](RP) Gestion de métier...
« le: 02 Février 2012, 18:04:42 »
Bonsoir à tous  ;)

J'ouvre ce sujet afin de récolter vos avis, vos idées et vos connaissance...

J'aimerais créer un système de métier. Chauffeur de bus, taxi, policier et autres...

Je préviens desuite... Mon but n'est pas d'obtenir des scripts tout faits...
C'est de récuperer des idées de fonctions pour creer mon script...

Je suis libre-ouvert à toutes vos remarques...

Bonne soirée a tous ;-)

3
Scripting MTA [Lua Center] / Re : [AIDE] startResource
« le: 02 Février 2012, 17:47:35 »
J'ai changé mon fusil d'épaule...  :snip

Mare de se bad argument alors, j'utilise le mtaserver.conf...

Merci à vous...

4
Scripting MTA [Lua Center] / Re : [AIDE] startResource
« le: 31 Janvier 2012, 22:01:09 »
Oui c'est exactement ca... sauf que, j'ai toujours mon bad argument...

 :...

POURTANT... J'ai utilisé ton script au CTRL+C / CTRL+V :D

Citer
function loadyann ()
local maVariable = getResourceFromName ( "mapyann" ) -- on récupère la ressource qui s'appelle mapyann dans maVariable
local success = startResource( maVariable ) -- on lance la ressource ET on récupère la valeur renvoyée par la fonction dans success
if ( success == true ) then
   outputChatBox ( "! Map Yann [OK] !", getRootElement(), 0, 255, 0, true )
else
   outputChatBox ( "! Map Yann  [FAIL] !", getRootElement(), 255, 0, 0, true )
end
end
setTimer( loadyann, 1500, 1)

  :wall

A devenir fou  :P

5
Scripting MTA [Lua Center] / Re : [AIDE] startResource
« le: 31 Janvier 2012, 18:05:24 »
Je crois que mes explications du départ on été très confuses  :bangin ...

Je recommence... Je crois que ce sera plus simple  :D ...

Mon but en fait, est de créer un script généralisé...

Mon script doit démarrer d'autres ressources mais en cadencé...

Par Exemple:
1) Démarre la map yann.map (50mili)
3) Démarre la map Jean-Marie.map (1sec)
2) Démarre le script barrières (2sec)
3) Démarre ...

Cela me permetterais de savoir si tout c'est bien lancé et relativement cadencé pour ne
pas surcharger le serveur au démarrage...

Mais le principal problèmes, est de démarrer la resource ET de vérifier si elle c'est bien lancée.

! Map Yann [WAIT]
! Map Yann [OK][FAIL]
! Map Jean-Marie [WAIT]
! Map Jean-Marie [OK][FAIL]
! Script Barrieres [WAIT]
! Script Barrieres [OK][FAIL]

Bien à toi.
Et désolé pour la confusion engendrée...

6
Scripting MTA [Lua Center] / Re : [AIDE] startResource
« le: 30 Janvier 2012, 13:09:18 »
Verdict...

Toujours mon bad argument @ 'StartResource'

Et Pourtant...
Citer
<meta>
<info author="CafeOLait" version="0.0.1" type="script" name="Fence Script" description="This script ad fences in the game." />
<script src="main.lua" type="server" />

<map src="yann/yann.map" />

</meta>

7
Scripting MTA [Lua Center] / Re : [AIDE] startResource
« le: 30 Janvier 2012, 12:02:03 »
Merci,
Je vais essayer un peux plus tard, ici je ne suis pas sur mon pc.

Mais chez moi bizarrement quand je met le \n seul, j ai une ligne blanche  :P

Bonne journée  ;)

8
Scripting MTA [Lua Center] / [AIDE] startResource
« le: 30 Janvier 2012, 00:29:33 »
Re-Bonsoir  :-[

Voila, je peaufine un peu mon script de barrières, mais afin d'avoir des objets,
je dois charger un fichier *.map.

J'ai -en regardant un peux le wiki- trouvé la fonction
Citer
startResource

Voici mon arborescence
(/script est la base de mon script  ::) )
(/yann est la resource à lancer)
Citer
/resource
   /a
   /b
   /script
      /yann
          /yann.map
          /meta.xml
      /meta.xml
      /main.lua
      /main.lua.old

Voici mon script pour le moment
[spoiler]
function a (a)
outputChatBox ( "\n", getRootElement(), 255, 125, 0, true )
outputChatBox ( "Lancement des Scripts", getRootElement(), 255, 125, 0, true )
end
setTimer ( a, 50, 1)

function barrieres ( script)
gatea = createObject ( 969, 1397.1, 2701.6, 9.8, 0, 0, 270 )
gateb = createObject ( 969, 1397.1, 2693.6, 9.8, 0, 0, 270 )
gatec = createObject ( 987, 2294.6, 2503.2, 2.3, 0, 0, 274 )
gated = createObject ( 987, 2319.8, 2440.5, 2.3, 0, 0, 90 )
gateea = createObject ( 987, 2245.6, 2481.5, 14, 0, 0, 270 )
gateeb = createObject ( 987, 2245.6, 2469.5, 14, 0, 0, 270 )
gateec = createObject ( 987, 2245.6, 2457.5, 14, 0, 0, 270 )
gateed = createObject ( 987, 2245.6, 2445.5, 14, 0, 0, 270 )
arene = createObject ( 17018, -1417, 363, 25, 0, 0, 270 )
airport = createObject ( 987, -1549.8, -426, 5, 0, 0, 316 )
arene2 = createObject ( 3277, -1426.8, 368.4, 26.1, 0, 0, 0 )
outputChatBox ( "! Script Barriere [WAIT] !", getRootElement(), 0, 230, 255, true )
end
setTimer ( barrieres, 500, 1)

function b (b)
if ( barrieres) then
   outputChatBox ( "! Script Barriere [OK] !", getRootElement(), 0, 255, 0, true )
else
   outputChatBox ( "! Script Barriere [FAIL] !", getRootElement(), 255, 0, 0, true )
end
end
setTimer ( b, 1000, 1)

function loadMapFile ( filename )
   startResource ( yann)
end
setTimer ( loadMapFile, 1500, 1)

function c (c)
if ( LoadMapFile) then
   outputChatBox ( "! Map Yann [OK] !", getRootElement(), 0, 255, 0, true )
else
   outputChatBox ( "! Map Yann [FAIL] !", getRootElement(), 255, 0, 0, true )
end
end

setTimer ( c, 2000, 1)

[/spoiler]

Donc mon problème est que j'obtien ce message d'erreur:
Citer
[2012-01-30 00:21:46] WARNING: script\main.lua:33: Bad argument @ 'startResource'

(J'ai mit la source du problème en rouge)

Et j'aimerais savoir, si vous ne sauriez pas me donner un petit
coup de patte...

Merci beaucoup pour votre aide...
CafeOLait

9
Merci à toi ;-)

10
Bonsoir à tous,
Voila j'aimerais obtenir quelques explications pour afficher du texte.
J'ai créé des barrières automatiques (voir le sujet dédié http://www.gtaonline.fr/forums/index.php/topic,15003.0.html) et
j'aimerais pouvoir écrire un texte style: "Depot Privé" au pied de la barrière.

J'avais deja vu un texte pareil ou il affichait la commande pour ouvrir une barrière
sur un serveur RP.

Auriez Vous une idée?

Merci à tous.
CafeOLait

11
Scripting MTA [Lua Center] / Re : Code / scripts utiles.
« le: 23 Janvier 2012, 20:31:04 »
Moi je dépose un petit script pour l'ouverture de barrières avec une commande

gatea = createObject ( 969, 1397.1, 2701.6, 9.8, 0, 0, 270 )
gateb = createObject ( 969, 1397.1, 2693.6, 9.8, 0, 0, 270 )
gatec = createObject ( 987, 2294.6, 2503.2, 2.3, 0, 0, 274 )
gated = createObject ( 987, 2319.8, 2440.5, 2.3, 0, 0, 90 )
gateea = createObject ( 987, 2245.6, 2481.5, 14, 0, 0, 270 )
gateeb = createObject ( 987, 2245.6, 2469.5, 14, 0, 0, 270 )
gateec = createObject ( 987, 2245.6, 2457.5, 14, 0, 0, 270 )
gateed = createObject ( 987, 2245.6, 2445.5, 14, 0, 0, 270 )
arene = createObject ( 17018, -1417, 363, 25, 0, 0, 270 )
airport = createObject ( 987, -1549.8, -426, 5, 0, 0, 316 )
arene2 = createObject ( 3277, -1426.8, 368.4, 26.1, 0, 0, 0 )

-- create the function the command handler calls, with the arguments: thePlayer, command, vehicleModel
function ouvrirdepot(commandName, posX, posY, posZ)
   moveObject ( gatea, 15000, 1397.1, 2689, 9.8 )
   moveObject ( gateb, 15000, 1397.1, 2689, 9.8 )
end

addCommandHandler("od", ouvrirdepot)

-- create the function the command handler calls, with the arguments: thePlayer, command, vehicleModel
function fermerdepot(commandName, posX, posY, posZ)
   moveObject ( gatea, 15000, 1397.1, 2701.6, 9.8 )
   moveObject ( gateb, 15000, 1397.1, 2693.6, 9.8 )
end

addCommandHandler("fd", fermerdepot)

function ouvrirairport(commandName, posX, posY, posZ)
   moveObject ( airport, 15000, -1557.5, -418, 5 )
end

addCommandHandler("oa", ouvrirairport)

-- create the function the command handler calls, with the arguments: thePlayer, command, vehicleModel
function fermerairport(commandName, posX, posY, posZ)
   moveObject ( airport, 15000, -1549.8, -426, 5 )
end

addCommandHandler("fa", fermerairport)

function op(commandName, posX, posY, posZ)
   moveObject ( gatec, 10000, 2294.6, 2503.2, 7 )
   moveObject ( gated, 10000, 2319.8, 2440.5, 8 )
end

addCommandHandler("op", op)

-- create the function the command handler calls, with the arguments: thePlayer, command, vehicleModel
function fp(commandName, posX, posY, posZ)
   moveObject ( gatec, 10000, 2294.6, 2503.2, 2.3 )
   moveObject ( gated, 10000, 2319.8, 2440.5, 2.3 )
end

addCommandHandler("fp", fp)

function secure(commandName, posX, posY, posZ)
   moveObject ( gateea, 10000, 2245.6, 2481.5, 9.8 )
   moveObject ( gateeb, 10000, 2245.6, 2469.5, 9.8 )
   moveObject ( gateec, 10000, 2245.6, 2457.5, 9.8 )
   moveObject ( gateed, 10000, 2245.6, 2445.5, 9.8 )
end

addCommandHandler("secure", secure)

function unsecure(commandName, posX, posY, posZ)
   moveObject ( gateea, 10000, 2245.6, 2481.5, 14 )
   moveObject ( gateeb, 10000, 2245.6, 2469.5, 14 )
   moveObject ( gateec, 10000, 2245.6, 2457.5, 14 )
   moveObject ( gateed, 10000, 2245.6, 2445.5, 14 )
end

addCommandHandler("unsecure", unsecure)

function up(commandName, posX, posY, posZ)
   moveObject ( arene, 30000, -1417, 363, 32 )
   moveObject ( arene2, 30000, -1426.8, 368.4, 36.8 )
end

addCommandHandler("up", up)

function down(commandName, posX, posY, posZ)
   moveObject ( arene, 30000, -1417, 363, 25 )
   moveObject ( arene2, 30000, -1426.8, 368.4, 26.1 )
end

addCommandHandler("down", down)


Bonne soirée

12
Oui, au début, c'est ce que je voulais faire...

mais je préfère le systeme du script. Chaque porte à sa variable et c'est plus simple pour s'y retouver...


Merci beaucoup.
 ;)

13
Scripting MTA [Lua Center] / Re : Debut LUA
« le: 20 Janvier 2012, 10:46:44 »
Bon courage ;-)

PS: J'utilise un systeme spécial pour mes objets... Ce qui fait qu'ils sont lancés au démarrage,
j'ouvre mamap.map, je copie mes objets, et je les colles dans le broph.map qui se trouve dans la play.zip et mes objets s'affiches (en l'occurence, mes 2 barrières)

EDIT1:
J'ai TROUVE  :lmao :lmao :lmao

PS: Mon père étant hospitalisé, je vous envoye le code demain...


EDIT2:
Voila mon code...

[spoiler]
gatea = createObject ( 969, 1397.1, 2701.6, 9.8, 0, 0, 270 )
gateb = createObject ( 969, 1397.1, 2693.6, 9.8, 0, 0, 270 )
gatec = createObject ( 987, 2294.6, 2503.2, 2.3, 0, 0, 274 )
gated = createObject ( 987, 2319.8, 2440.5, 2.3, 0, 0, 90 )

-- create the function the command handler calls, with the arguments: thePlayer, command, vehicleModel
function ouvrirdepot(commandName, posX, posY, posZ)
   moveObject ( gatea, 15000, 1397.1, 2689, 9.8 )
   moveObject ( gateb, 7500, 1397.1, 2689, 9.8 )
   setTimer (fermerdepot, 30000, 30 )
end

addCommandHandler("od", ouvrirdepot)

-- create the function the command handler calls, with the arguments: thePlayer, command, vehicleModel
function fermerdepot(commandName, posX, posY, posZ)
   moveObject ( gatea, 15000, 1397.1, 2701.6, 9.8 )
   moveObject ( gateb, 7500, 1397.1, 2693.6, 9.8 )
end

addCommandHandler("fd", fermerdepot)

function op(commandName, posX, posY, posZ)
   moveObject ( gatec, 10000, 2294.6, 2503.2, 7 )
   moveObject ( gated, 10000, 2319.8, 2440.5, 8 )
end

addCommandHandler("op", op)

-- create the function the command handler calls, with the arguments: thePlayer, command, vehicleModel
function fp(commandName, posX, posY, posZ)
   moveObject ( gatec, 10000, 2294.6, 2503.2, 2.3 )
   moveObject ( gated, 10000, 2319.8, 2440.5, 2.3 )
end

addCommandHandler("fp", fp)

[/spoiler]

14
Scripting MTA [Lua Center] / Re : Debut LUA
« le: 20 Janvier 2012, 10:21:43 »
Merci pour ta réponse...

Voila, j'ai essayé avec les infos que tu m'a donné...

Bonne nouvelle, il démarre...
Mais quand je tappe la commande...

Citer
/entrer01
Il me met l'erreur: WARNING: script\main.lua:3: Bad argument @ 'setElementRotation'

Voila mon nouveau script:
[spoiler]
-- create the function the command handler calls, with the arguments: thePlayer, command, vehicleModel
function entreraeroport(thePlayer, command, vehicleModel)
   setElementRotation(getElementByID("(barrierturn) (1)"),0,330,316)
end

addCommandHandler("entrer01", entreraeroport)

-- create the function the command handler calls, with the arguments: thePlayer, command, vehicleModel
function sortiraeroport(thePlayer, command, vehicleModel)
   setElementRotation(getElementByID("(barrierturn) (2)"),0,30,316)
end

addCommandHandler("sortir01", entreraeroport)
[/spoiler]

15
Bonsoir,

Avec mes copains de classe, nous avons décidé de faire un serveur MTA:SA entre nous pour pouvoir
jouer ensemble... Jusque la tout vas bien (Mais j'aurais du m'en douter)... Ils veulent pousser la réalité plus loin... La sentence tombe... Apprendre le LUA   :blink

La première idée reçue, des barrières automatiques... Je prend mon "anglais" à deux main fouille dans le wiki MTA j'ESSAIE de m'en sortir... Premier test... Il charge mon script en Gamemode  :dry

J'efface tout...

Alors, je vous demande, si vous -On ne sais jamais- pourriez me donner un coup de main...

Voila le code que j'ai essayé...
PS: Je rappelle que c'est mon premier alors n'hesitez pas...

[spoiler]
 
-- create a command handler
addCommandHandler("entrer01", entreraeroport)

-- create the function the command handler calls, with the arguments: thePlayer, command, vehicleModel
function entreraeroport(thePlayer, command, vehicleModel)
   -- create a vehicle and stuff
   setElementRotation("(barrierturn) (1)",rotX,rotY+60,rotZ)
   -- set a timer so the function is called after 1 second
    setTimer ( delayedChat, 1000, 1, "Hello, World!" )
end
 
 function delayedChat ( )
    setElementRotation("(barrierturn) (1)",rotX,rotY-60,rotZ)
   
end


-- create a command handler
addCommandHandler("sortir01", sortiraeroport)

-- create the function the command handler calls, with the arguments: thePlayer, command, vehicleModel
function sortiraeroport(thePlayer, command, vehicleModel)
   -- create a vehicle and stuff
   setElementRotation("(barrierturn) (2)",rotX,rotY-60,rotZ)
   -- set a timer so the function is called after 1 second
    setTimer ( delayedChat, 1000, 1, "Hello, World!" )
end
 
 function delayedChat ( )
    setElementRotation("(barrierturn) (2)",rotX,rotY+60,rotZ)
   
end
 
[/spoiler]

Aussi, si je suis si  :boulet que ca... dite le moi  ::)

Merci de votre aide...
CaféÔLait

Pages: [1] 2