SA-MP Forums Archive
[Help] Command - 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] Command (/showthread.php?tid=289540)



[Help] Command - [00]Luis - 11.10.2011

What's wrong with this?

pawn Код:
new RandomWeapons[][] =
{
    {38},
    {36},
    {16},
    {39},
    {44},
    {28},
    {26},
    {24},
    {8}
};
pawn Код:
CMD:randomweapon(playerid, params[])
{
   new Weapons = random(sizeof(RandomWeapons));
   GivePlayerWeapon(playerid, RandomWeapons[Weapons], 5000);
   return 1;
}
Thanks.


Re: [Help] Command - =WoR=Varth - 12.10.2011

pawn Код:
CMD:randomweapon(playerid, params[])
{
   new Weapons = RandomSet(38,36,16,39,44,28,26,24,8);
   GivePlayerWeapon(playerid, RandomWeapons[Weapons], 5000);
   return 1;
}

stock RandomSet(...) return getarg(random(numargs()));