Random Weapon
#1

<REMOVED>
Reply
#2

PHP Code:
GivePlayerWeapon(playeridweaponidammo);
    return 
1

Reply
#3

Not that, its asking different questions so different weapons in each questions.
Reply
#4

PHP Code:
GivePlayerWeapon(playerid38500); // Minigun
GivePlayerWeapon(playerid28500); // Uzi
GivePlayerWeapon(playerid1650); // Grenade
GivePlayerWeapon(playerid43500); // Camera 
https://sampwiki.blast.hk/wiki/Weapons


Edit : Oh, Didn't see your Post.
Reply
#5

Add this:
NOTE: The code is not complete. Try finishing it.

pawn Code:
new wea = id1,id2,id3,id4,
      rand(4);
   
switch(rand) {
    case 1: {
        GivePlayerWeapon(playerid, id1, 100);
    }
    case 2: {
        GivePlayerWeapon(playerid, id2, 100);
    }
Reply
#6

<REMOVED>
Reply
#7

No, I can't. It goes underneath:

pawn Code:
format(msg,sizeof(msg),"%s has solved a task successfully in %i seconds (Ans: %i)",name, GetTimerInSeconds(GetTickCount(),gServerData[E_START_TIME]), gServerData[E_ANSWER]);
        SendClientMessageToAll(blue,msg);
        print(msg);
Where id1,id2,etc is, you enter your desired weapon ids. You change rand to how many weapons you have listed and go from there. It will randomly select one of the weapons you've put in and give the player the weapon.
Reply
#8

pawn Code:
new WeaponID[] = {id1,id2,id3};
GivePlayerWeapon(playerid, WeaponID[random(sizeof(WeaponID))], 100);
Reply
#9

ok thx for that but how can i get that weapon name?
I mean like this " First One who solve => %i + %i - %i + %i <= will get $1000 + WEAPON NAME" ?
Reply
#10

pawn Code:
stock ReturnWeaponName(weaponid)
{
    new weapname[64];
    GetWeaponName(weaponid,weapname,sizeof(weapname));
    return weapname;
}
new WeaponID[3] = {38,39,4};

new weap = WeaponID[random(sizeof(WeaponID))];
GivePlayerWeapon(playerid, weap, 100);
"First One who solve => %i + %i - %i + %i <= will get $1000 + %s",.......,ReturnWeaponName(weap)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)