GTAMP.com

Grand Theft Auto Multiplayer
It is currently Wed Jun 19, 2019 6:43 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: GIVE_WEAPON after dead.
PostPosted: Sun Jul 22, 2012 8:52 am 
Offline
Ped

Joined: Thu Jul 05, 2012 7:47 pm
Posts: 4
Location: Poland
Hi all.

I have a little problem with script. It don't work correctly.
Quote:
PLAYER_PED p1 = ( 136.50, 137.50, 3.00 ) 10 180

COUNTER loop = 1

LEVELSTART

WHILE_EXEC ( loop = 1 )
IF ( CHECK_CHARACTER_HEALTH ( p1 , 0 ) )
GIVE_WEAPON ( p1 , ROCKET_LAUNCHER , 10 )
ENDIF
ENDWHILE

LEVELEND


Script description:
When the game started, player has 99 rockets (infinite). When he respawned, he has 10, 20, 30 ... 99 rockets (infinite again).

I want to player gets only 10 rockets.

I wait for help, thanks : )


Top
 Profile  
 
PostPosted: Sun Jul 22, 2012 9:14 am 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1348
Location: GTAMP.com
I'm surprised I've never played a map where everyone respawns with limited ammo. Usually it's none or infinite ammo.

This should do it:

Syntax: [ Download ] [ Hide ]
Using GTA2 Script Syntax Highlighting
PLAYER_PED p1 = ( 136.50, 137.50, 3.00 ) 10 180

COUNTER loop = 1
COUNTER p1died = 0

LEVELSTART

GIVE_WEAPON ( p1, ROCKET_LAUNCHER, 10 )

WHILE_EXEC ( loop = 1 )

IF ( CHECK_CHARACTER_HEALTH ( p1 , 0 ))

IF ( HAS_CHARACTER_DIED ( p1 ))
  SET p1died = 1
ELSE
  IF ( p1died = 1 )
    GIVE_WEAPON ( p1, ROCKET_LAUNCHER, 10 )
    SET p1died = 0
  ENDIF
ENDIF

ENDIF

ENDWHILE
LEVELEND
 
Parsed in 0.015 seconds, using GeSHi 1.0.8.10


Top
 Profile  
 
PostPosted: Sun Jul 22, 2012 9:31 am 
Offline
Ped

Joined: Thu Jul 05, 2012 7:47 pm
Posts: 4
Location: Poland
Thanks, Sektor. It's working very well!

I have a very interesting idea for my map : ).


Top
 Profile  
 
PostPosted: Sun Jul 22, 2012 5:02 pm 
Offline
User avatar

Joined: Wed Mar 17, 2010 4:07 am
Posts: 414
Location: Wales, UK
Like Sektor said, I'm surprised you don't just give 99 straight away. Inside that loop you'll get ammo so quickly you might as well make it 99 anyway! Still, Sektors' code will work for what you need for limited ammo after death.

_________________


Top
 Profile  
 
PostPosted: Mon Jul 23, 2012 8:41 am 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:00 pm
Posts: 957
Location: F21B3EED
I would make it to give 1 rocket at a time instead. It would look better since you actually see the ammo going up then.

_________________
My GTA2 related projects:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group