Перейти к содержимому
View in the app

A better way to browse. Learn more.

Zloplay 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.

[Coding] Giving Random Weapon to Spawned Player

Featured Replies

Опубликовано:

as Requested by Camelot115 I've Made this Tutorial...

 

1)start PlayerConnected

2)Start Spawned Player

3)now use this

void GiveRandomWeapon(case Case);
{

Switch (Case)
{
case 1:
Player.GiveWeapon("SomeWeapon");
break;

case 2:
player.GiveWeapon("name");
break;

case 3:
Player.GiveWeapon("name");

Case 4:
Player.GiveWeapon("name"); 
break;
}
//like that do all 10
}

 

4)Generate a Random Weapon/Number

 

int weaponz //random Integer
Random rand = new Random(10); //Generate random no. between 1-10
weaponz = rand; //Define Integer's value

5)on Spawned Player

entity.takeallweapons();
GiveRandomWeapon(weaponz);

 

Correct me If I'm Wrong Somewhere (I just Guessed. not tested yet....)

 

Credits : meh

Опубликовано:

void GiveRandomWeapon(case Case);

case as a type? No, you probably mean int

 

case 1:
Player.GiveWeapon("SomeWeapon");
break;

Ok so Player is a global variable?

 

case 3:
Player.GiveWeapon("name");

No 'break;' needed here?

 

int weaponz //random Integer

Missing ';'...

 

Random rand = new Random(10); //Generate random no. between 1-10

The number passed here is actually the seed which will result in generating the same values all the time. You should not pass any parameter here.

 

weaponz = rand; //Define Integer's value

Converting the 'Random' type now to int lol?

Correct way:

weaponz = rand.Next(0,10); //The numbers will be 0-9

 

Please verify your code if you are not sure about it. Thanks for trying to help anyway.

Join the conversation

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

Гость
Ответить в тему...

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу

Важная информация

Используя этот сайт, вы соглашаетесь Условия использования.

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.