new mode = random(1); lets pawno crash + mode = random number FOR all public's
#1

hi i want to do when the mode starts mode = (random number from 0 to 1 )

only when i do on top of script new mode = random(1); ( i have that if mode == 1 on game mode init, onplayerexitvehicle etc )

But when i do it on top of my script , my whole pawno program just crashes

new mode = random(1);



what do i do wrong?
ty!
Reply
#2

you can't use functions outside a function/public

try this:
pawn Код:
new mode;

public OnGameModeInit()
{
  mode = random(1);
  // Other stuff here
}
Reply
#3

well if mode == 1 is on more places then on game mode init
so i did on top what you said, well it doesnt give errors but i restarted my mode 5times and it was everytime number 1 , never number 0 , how is that posible? this is for a map system and i dont want the same map twice be played.
PS: I want mode for all things the same, But if i do new mode (1) in on game mode init the other 1 returns that mode is not defined. And i need if mode = 1 , it needs to be in EVERY part 1 not like in part of spawn 1 and on game mode init where objects are created 0
Reply
#4

i don't get you.

At the top of your gamemode:
pawn Код:
new mode;
At OnGameModeInit or main
pawn Код:
mode = random(1);
And now the variable is set and you can use it in all the callbacks and functions.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)