#1 14-10-2011 19:09

Manoel Victor
From: Minas Gerais
Registered: 26-04-2011
Posts: 44
Website

Wrong code! Someone help me please?

Hello!
I have a code to spawn a gang member, in case I want to spawn a police officer, but are two problems:
1 - Two policemen appear instead of appearing one.
2 - I set point for them to use a shotgun,but they use it like a pistol.
Here is my code:

// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007

{$VERSION 3.1.0027}
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP 
0000: NOP 

:NONAME_5
wait 0 
if 
0AB0:   key_pressed 122 
else_jump @NONAME_5 
jump @NONAME_31 

:NONAME_31
wait 0 
Model.Load(#LVPD1)
04C4: store_coords_to 7@ 8@ 9@ from_actor $PLAYER_ACTOR with_offset 0.0 4.0 0.0 
038B: load_requested_models 
07AF: $PLAYER_GROUP = player $PLAYER_CHAR group 
19@ = Actor.Create(Gang2, #LVPD1, 7@, 8@, 9@)
0631: put_actor 19@ in_group $PLAYER_GROUP 
Actor.Health(19@) = 500
Actor.SetImmunities(19@, 1, 1, 1, 1, 1)
07DD: set_actor 19@ temper_to 100 // see pedstats.dat 
01B2: give_actor 19@ weapon 25 ammo 9999 // Load the weapon model before using this 
081A: set_actor 19@ weapon_skill_to 10 
wait 0 
jump @NONAME_164 

:NONAME_164
wait 0 
if 
0AB0:   key_pressed 123 
else_jump @NONAME_190 
jump @NONAME_217 

:NONAME_190
wait 0 
if 
   Actor.Dead(19@)
else_jump @NONAME_164 
jump @NONAME_217 

:NONAME_217
wait 0 
Actor.DestroyInstantly(18@)
wait 0 
jump @NONAME_5

I hope to help,people!

Offline

#2 15-10-2011 09:34

Jack Daniel's
Registered: 05-07-2011
Posts: 211

Re: Wrong code! Someone help me please?

01B2: give_actor 19@ weapon 25 ammo 9999 // Load the weapon model before using this

use model.load(%shotgun model id here%) before give weapon

Last edited by Jack Daniel's (15-10-2011 09:35)

Offline

#3 15-10-2011 15:24

Manoel Victor
From: Minas Gerais
Registered: 26-04-2011
Posts: 44
Website

Re: Wrong code! Someone help me please?

But where do I get?
Once on top of the code to gun?
And I do not know the id of the model of the shotgun!
Can you help me?

Offline

#4 15-10-2011 15:31

Jack Daniel's
Registered: 05-07-2011
Posts: 211

Re: Wrong code! Someone help me please?

model id - #CHROMEGUN

Offline

#5 15-10-2011 15:38

Manoel Victor
From: Minas Gerais
Registered: 26-04-2011
Posts: 44
Website

Re: Wrong code! Someone help me please?

Can you give me the full code please? How should I get? It is because it is the first time working with this type of code.

Offline

#6 15-10-2011 17:55

Jack Daniel's
Registered: 05-07-2011
Posts: 211

Re: Wrong code! Someone help me please?

{$CLEO .cs}
wait 1000
repeat
   repeat
   wait 0
   until Player.Defined($PLAYER_CHAR)
   repeat
   wait 0
   until 0AB0: key_pressed 0x7A
    model.Load(#LVPD1)
    model.Load(#CHROMEGUN)
    038B: load_requested_models
    07AF: $PLAYER_GROUP = player $PLAYER_CHAR group
   if
    0449:   actor $PLAYER_ACTOR in_a_car
   then
    03C0: 2@ = actor $PLAYER_ACTOR car
    19@ = Actor.Create(Gang2, #LVPD1, 7@, 8@, 9@)
    0430: put_actor 19@ into_car 2@ passenger_seat 0
    0631: put_actor 19@ in_group $PLAYER_GROUP
    Actor.SetImmunities(19@, 1, 1, 1, 1, 1)
    07DD: set_actor 19@ temper_to 100
    081A: set_actor 19@ weapon_skill_to 10
    model.Load(#TEC9)
    01B2: give_actor 19@ weapon 32 ammo 9999
    0114: set_actor 19@ weapon 32 ammo_to 2000 while_in_car
    model.Destroy(#TEC9)
    gosub @Check
   else       
    04C4: store_coords_to 7@ 8@ 9@ from_actor $PLAYER_ACTOR with_offset 0.0 4.0 0.0
    19@ = Actor.Create(Gang2, #LVPD1, 7@, 8@, 9@)
    0631: put_actor 19@ in_group $PLAYER_GROUP
    Actor.Health(19@) = 500
    Actor.SetImmunities(19@, 1, 1, 1, 1, 1)
    07DD: set_actor 19@ temper_to 100
    01B2: give_actor 19@ weapon 25 ammo 9999
    081A: set_actor 19@ weapon_skill_to 10 
    gosub @Check
    model.Destroy(#LVPD1)
    model.Destroy(#CHROMEGUN)
   end
until false

:Check
:start
wait 0
if
   0AB0:   key_pressed 0x7B
then
   Actor.DestroyInstantly(19@)
   return
else
   if
    Actor.Dead(19@)
   then
    return
   else
    jump @start
   end 
end

Improved version of your script (checking if you are in car then put actor in to passenger seat and give him tec9 than he can shot)

UPD. What about about problem with using shotgun like a colt. So... I don't remeber how to solve it

Last edited by Jack Daniel's (15-10-2011 18:43)

Offline

#7 16-10-2011 00:43

Manoel Victor
From: Minas Gerais
Registered: 26-04-2011
Posts: 44
Website

Re: Wrong code! Someone help me please?

Strange, I loaded the gun model, but he's still holding and shooting like pistol.
Why is this happening?

Offline

Board footer

Powered by FluxBB