Jump to content
View in the app

A better way to browse. Learn more.

GTAGames.nl - De Nederlandse Grand Theft Auto Community!

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Vraag over 'FOR loops'

Posted

Hoi,

Ik loop tegen een probleem aan tijdens het scripten. Ik wil in een FOR loop een counter gebruiken als limiet, dus bijv: 'FOR x = 1 to max_cars', alleen nu blijkt die stomme scripttaal daar niet mee te kunnen werken.

Je MOET blijkbaar altijd een integer opgeven, ipv. een variabele, zo ook bij standaard functies zoals:

ALTER_WANTED_LEVEL ( player1 , 1 ) <- dit werkt

ALTER_WANTED_LEVEL ( player1 , max_level ) <- dit werkt niet, ook niet als je 'max_level = 1' declareert.

Dat is nogal dom, want zelfs de meest basic scripttalen gebruiken dit wel.

Weet iemand hier een oplossing voor?

Featured Replies

Het enige wat ik kan bedenken is dat je eerste met IF de waarde van een variabele checkt.

Dus dan zou je zoiets krijgen als

IF ( maxcars = 2 )

FOR x = 1 to 2

...

IF ( maxcars = 3 )

FOR x = 1 to 3

...

  • Author

Ja dat is de omweg die ik nu ook neem. Zit denk ik niets anders op.

M'n eerste missie lijkt zo'n beetje af, kheb hem nog niet getest, want ik heb het ff op m'n werk geschreven :D

Je moet een telefoon beantwoorden en dan krijg je de opdracht om 4 taxi's voor een bankoverval te jatten en in een garage te zetten, binnen 5 minuten.

Thuis even kijken of het ook echt wil werken.

Even voor alle zekerheid, je hoeft niet de code in de IF/FOR loops steeds te herhalen, je kunt gewoon met een GOSUB het tussenliggende stuk starten, zet je de subroutine vlak na dat hele IF/FOR codeblok. ;)

Klinkt wel leuk, zo snel taxi's jatten.

  • Author
Even voor alle zekerheid, je hoeft niet de code in de IF/FOR loops steeds te herhalen, je kunt gewoon met een GOSUB het tussenliggende stuk starten, zet je de subroutine vlak na dat hele IF/FOR codeblok. ;)

Klinkt wel leuk, zo snel taxi's jatten.

Ahja, da's wel slim ;)

Ben nu met tweede missie bezig... Je moet iemand vinden, zijn 4 bodyguards uitschakelen, dan zal hij bang worden en je volgen.

Vervolgens moet je hem in een taxi vervoeren en in het water dumpen :D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.