SA-MP Forums Archive
Random Weapons after Spawn - 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: Random Weapons after Spawn (/showthread.php?tid=360441)



Random Weapons after Spawn - kbalor - 17.07.2012

Anyone know how to give random weapons after they Spawn or choose skin??

Slot 1 for melee weapons
Slot 2 for handguns
Slot 3 shotguns
Slot 4 mahineguns,
Slot 5 next to machineguns ak47/m4

This are the forbidden weapon id's, 39,40,38,35,36,4


Re: Random Weapons after Spawn - leonardo1434 - 17.07.2012

pawn Код:
new wepsid[5][2] =
{
   {1,100}, // first is the id of the weapon, second is the amount of ammo.
   {2,200}, // first is the id of the weapon, second is the amount of ammo.
   {3,300}, // first is the id of the weapon, second is the amount of ammo.
   {4,400}, // first is the id of the weapon, second is the amount of ammo.
   {5,500} // first is the id of the weapon, second is the amount of ammo.
};

// usage:
new rando = random(sizeof(wepsid)); // making a random function.
GivePlayerWeapon(playerid,wepsid[rando][0],wepsid[rando][1]);  // giving random weapons, and random ammo which has been placed at array 2D.



Re: Random Weapons after Spawn - kbalor - 17.07.2012

Quote:
Originally Posted by leonardo1434
Посмотреть сообщение
pawn Код:
new wepsid[5][2] =
{
   {1,100}, // first is the id of the weapon, second is the amount of ammo.
   {2,200}, // first is the id of the weapon, second is the amount of ammo.
   {3,300}, // first is the id of the weapon, second is the amount of ammo.
   {4,400}, // first is the id of the weapon, second is the amount of ammo.
   {5,500} // first is the id of the weapon, second is the amount of ammo.
};

// usage:
new rando = random(sizeof(wepsid)); // making a random function.
GivePlayerWeapon(playerid,wepsid[rando][0],wepsid[rando][1]);  // giving random weapons, and random ammo which has been placed at array 2D.
Thanks +rep, but its better if i used Stock?


Re: Random Weapons after Spawn - leonardo1434 - 17.07.2012

i see no point to use a stock, anyways, its up to you.