SA-MP Forums Archive
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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random weapons (/showthread.php?tid=190090)



Random weapons - Kitten - 14.11.2010

Solved


Re: Random weapons - [L3th4l] - 14.11.2010

pawn Код:
new i = random(5);
GivePlayerWeapon(playerid, i, 999999); something like that?

-----------
or

switch(random(5))
{
    case 0: giveweapon(playerid, 1, 99999);
    case 1:....
    ......
    ......
    ......
}



Re: Random weapons - iggy1 - 14.11.2010

You will want more checks but basically this is it.
pawn Код:
if(checkpointid == RandomWeaponCP)
{
    new randwep = random(41);
    ResetPlayerWeapon(playerid);

    switch(randwep)
    {
        case 0:
        {
        }
    }
}
EDIT: Too slow.


Re: Random weapons - Kitten - 14.11.2010

Solved


Re: Random weapons - iggy1 - 14.11.2010

ResetPlayerWeapons it should be, and you need opening and closing braces for cases. Also dont forget case 0. It should be case 0 to 6 with your code.
pawn Код:
case 1: {GivePlayerWeapon(playerid,AK,500); GameTextForPlayer(playerid,"~r~ YOU GOT A RANDOM WEAPON OF ~n~~w~AK47 ASSUALT RIFLE",6000,4);}
EDIT: don't use "random(40)" with your code use "random(7)". I thought you wanted a complete random weapon (all weapons included) using the result of random for the id of the weapon.


Re: Random weapons - Kitten - 14.11.2010

Solved