Use foreach to respawn vehicles?
#1

So I know how to make the command, I'm just wondering if foreach can be used to loop through all vehicles, instead of just players. Is it possible?

pawn Код:
foreach (Vehicle, i)
?
Reply
#2

You'll have to define a new foreach-array. Read the foreach topic.
Reply
#3

I've read it.

But I don't quite understand how to define a new array for it. Would you happen to know?
Reply
#4

pawn Код:
new Iterator:vehicles<MAX_VEHICLES>;
You can use y_hooks to hook Create/DestroyVehicle to Iter_Add() or Iter_Remove()
Reply
#5

Appreciated. And another quick question (To avoid multiple posts.) to anyone who can help.

How can I use y_hooks to include another mode to my main game mode? I did it before, with something like this.
pawn Код:
#include <gamemode.pwn>
But obviously I have the wrong code here.
Reply
#6

y_hooks has nothing to do with including files.

but I imagine it would be something like

Код:
#include "..\gamemodes\mode.pwn"
I don't remember whether it's forward or back slashes, you might even need to change the file extension to .inc, I'm not too sure.
Reply
#7

.pwn works.
Reply
#8

I see. Thank you.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)