SA-MP Forums Archive
Help with Random Weapons - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with Random Weapons (/showthread.php?tid=338213)



Help with Random Weapons - James Coral - 29.04.2012

Can enyone tell me how to give player Random Weapons if he spawns?


Re: Help with Random Weapons - iggy1 - 29.04.2012

Wrote a quick func for you not tested should work.

pawn Код:
stock GiveRandomWeapon(playerid)
{

    new rand_weapon = random( 42 );
   
    switch( rand_weapon )
    {
   
        case 0, 19, 20, 21://invalid ids, or unarmed. Add any weaponids you don't want here
        {
       
            rand_weapon = 22;//9mm change if you want
            GivePlayerWeapon( playerid, rand_weapon, 1000 );
        }
       
        default:
        {
            GivePlayerWeapon( playerid, rand_weapon, 1000 ); //or also create random ammo amt
        }
   
    }

}
EDIT: I also forgot to add satchel charges to invalid weapon case, IIRC they are not synced.


Re: Help with Random Weapons - $$inSane - 29.04.2012

thats right script