how to make random weapons in dm
#1

Does anyone no how to make so when u enter a dm u spawn with randoms weapons (3 or 4weapons)
Reply
#2

pawn Код:
new wep = random(40);
        GivePlayerWeapon(playerid, wep, 200);
Reply
#3

Add this in your teleport/death match command and fill in what weapons to give the player.

pawn Код:
switch( random( 4 ) ) // random 0 - 3
{
    case 0: //random was 0.. give them a set of weapons
    {
        GivePlayerWeapon(...);
        GivePlayerWeapon(...);
        GivePlayerWeapon(...);
    }
    case 1: //random was 1 so give them a different set of weapons
    {
        GivePlayerWeapon(...);
        GivePlayerWeapon(...);
        GivePlayerWeapon(...);
    }  
    case 2: //random was 2 so give them a different set of weapons
    {
        GivePlayerWeapon(...);
        GivePlayerWeapon(...);
        GivePlayerWeapon(...);
    }  
    case 3: //random was 3 so give them a different set of weapons (You get the idea)
    {
        GivePlayerWeapon(...);
        GivePlayerWeapon(...);
        GivePlayerWeapon(...);
    }  
}
Reply
#4

Quote:
Originally Posted by fangoth1
Посмотреть сообщение
pawn Код:
new wep = random(40);
        GivePlayerWeapon(playerid, wep, 200);
I don't think that will work...

Use On_Top_Non_Stop's code.
Reply
#5

Mean please post the pwn code, so i will help you out on this case

Good luck
Reply
#6

Quote:
Originally Posted by Davz*|*Criss
Посмотреть сообщение
Mean please post the pwn code, so i will help you out on this case

Good luck
Ermmm... WHAT ? I didn't ask for any help lal.
Reply
#7

here you go...

pawn Код:
//define the random weapons you want to give here...

new const PossibleRandomWeapons[4][2] =
{
    {24, 100}, //DEagle
    {25, 150}, //Shotgun
    {18, 4}, //Molotov
    {16, 4} //Grenade
};

//give the random weapons with this code...

new r = random(sizeof(PossibleRandomWeapons));
GivePlayerWeapon(playerid, PossibleRandomWeapons[r][0], PossibleRandomWeapons[r][1]);
Reply
#8

Well, I'd rather go with switch statements. I dno if they are faster, but they are easier to use!
Reply
#9

switch statements are only faster if there are a lot of possibilities to "switch".
I think it just cant be easier than my code ive posted
Reply
#10

Quote:
Originally Posted by BlackWolf120
Посмотреть сообщение
switch statements are only faster if there are a lot of possibilities to "switch".
I think it just cant be easier than my code ive posted
Idk, I am used to use "switch", so it's easier to me, .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)