Reply To: Multiple models under one script.

Home / Forums / Modders Corner / Mafia Editing / Mafia Mod Request / Multiple models under one script. / Reply To: Multiple models under one script.

Bank Notes: 6,910
June 3, 2012 at 12:47 pm #12530

jaca37

DelayBuffer:Insert & CommandBuffer:Insert for one commande is not necessary.

 

in FR Script for change player model this is sufficient.

game.game:ChangePlayerModel(“Name_model”)

 

But the game crashes when using injector with direct control of this type.

that’s why we use a delay.

DelayBuffer:Insert(function(l_1_0) xxxxx
end,{l_1_0},250
,1
,false)

xxxxx
= your command

250
= delay (millisecond) before activation of the command

1
= number of times to repeat the fonction

 

Test to understand the function “DelayBuffer”:

DelayBuffer:Insert(function(l_1_0)game.game:SaveGame(1) end,{l_1_0},10000
,10
,false)

a backup is performed every 10
second (10000 milli) for10
times. 

So in the end, we have.

DelayBuffer:Insert(function(l_1_0)game.game:ChangePlayerModel(“Name_model”)end,{l_1_0},250,1,false)

 

and for “x” choices.

if i==nil then i=0 end i=i+1 if i==x+1
then i=1 end

DelayBuffer:Insert(function(l_1_0)if i==1 then game.game:ChangePlayerModel(“Name_model”)end end,{l_1_0},250,1,false)

DelayBuffer:Insert(function(l_1_0)if i==2 then game.game:ChangePlayerModel(“Name_model”)end end,{l_1_0},250,1,false)

DelayBuffer:Insert(function(l_1_0)if i=smile3.gif …….

don’t write x+1
but if you have 5 model, write 6.