• 28 Mars 2024, 23:44:42


Auteur Sujet: Code / scripts utiles.  (Lu 15105 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne Ssk

  • *
  • Lulu's Stunt - Le serveur stunt de Lulu !
  • Messages: 8154
    • Voir le profil
Re : Code / scripts utiles.
« Réponse #15 le: 20 Avril 2011, 02:07:20 »
Y a de l'optimisation à faire ^^



Derrière tout programme se cache un programmeur, je considère le monde comme un programme.
Mon blog

Hors ligne ~CG~FatalTerror

  • *
  • Criminel
  • Messages: 41
    • Voir le profil
Re : Code / scripts utiles.
« Réponse #16 le: 20 Avril 2011, 02:42:12 »
Désolé je peux pas faire plus précis  :lmao

Commande pour sauter(Serverside)  :rules

function push( thePlayer )

local voiture = getPedOccupiedVehicle( thePlayer )
local x, y, z = getElementVelocity ( voiture )
setElementVelocity ( voiture, x , y, z + 0.4 )
end
addCommandHandler("push", push)

A tester  :-\

Hors ligne CafeOLait

  • *
  • Nouveau
  • Messages: 16
    • Voir le profil
Re : Code / scripts utiles.
« Réponse #17 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

vincentdu90

  • Invité
Re : Code / scripts utiles.
« Réponse #18 le: 23 Mai 2012, 10:58:14 »
Ce n'est pas un script/code mais je me permets de mettre ce lien ici : http://www.luteus.biz/Download/LoriotPro_Doc/LUA/LUA_Training_FR/Introduction_Programmation.html

Un super tutoriel pour apprendre la programmation en Lua pure, pas celui relatif à Mta:Sa mais c'est à peu près la même chose.

(Je sais pas si c'est considéré comme de la Pub étant donné que ça n'a pas vraiment de rapport à Gta Sa)