SA-MP Forums Archive
help me :( - 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: help me :( (/showthread.php?tid=220467)



help me :( - TheAlienForce - 03.02.2011

this dosnt give the selected number in new weaps... i mean it does
but it gives like aswell weapons that arnt listed.
pawn Код:
public GiveRandomWeapon(playerid)
{
    new weaps[][] =
    {
        5,
        6,
        23,
        24,
        29,
        31,
        33,
        42
    };
    new r,string[128],weapname[32];
    r = random(sizeof(weaps));
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        ResetPlayerWeapons(i);
        GivePlayerWeapon(i, r, 500);
    }
    GetWeaponName(r,weapname,sizeof(weapname));
    format(string, sizeof(string), "~g~%s ~w~time!",weapname);
    GameTextForAll(string, 3000, 3);
    return 1;
}



Re: help me :( - veyron - 03.02.2011

pawn Код:
public GiveRandomWeapon(playerid)
{
    new weaps[] =
    {
        5,
        6,
        23,
        24,
        29,
        31,
        33,
        42
    };
    new r,string[128],weapname[32];
    r = random(sizeof(weaps));
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        ResetPlayerWeapons(i);
        GivePlayerWeapon(i, weaps[r], 500);
    }
    GetWeaponName(weaps[r],weapname,sizeof(weapname));
    format(string, sizeof(string), "~g~%s ~w~time!",weapname);
    GameTextForAll(string, 3000, 3);
    return 1;
}
use weaps[r] , instead of just r in this case