Removing baseball bat
#1

Hi!
At a spawn players get baseball bats, but I made a command that should remove the baseball bat, but it doesn't.
Se here is what I tried:
SetPlayerAmmo(playerid, 1, 0);
GivePlayerWeapon(playerid, 5, -1);

But the bat is still here :/
How can I remove it?
Next thing that I can think of is saving all weapons and ResetPlayerWeapons(playerid); but I don't want to do it, really.
Reply
#2

Change the AddPlayerClass(...);, so it doesn't give the weapon.
Reply
#3

No good, there are other weapons like theese and those shouldn't be removed from spawn.
Reply
#4

Quote:
Originally Posted by potato
No good, there are other weapons like theese and those shouldn't be removed from spawn.
Only remove the baseball bat then-_-
Reply
#5

Ok, will try to explain more, if you don't get this.
I said I can't simply remove the bat because there are other weapons like that, that means there are weapons which aren't given to the spawn.
For some reasons theese 2 functions with that amount of ammo doesn't work, so maybe there is a trick that could remove them?
Not sure, but could be a weapon that goes in the WeaponSlot 1 which has bullets, that way I could set it's ammo to 0 zero and the weapon will disappear, but that doesn't happen to weapons that doesn't have bullets.
Reply
#6

This might work

pawn Код:
new weapons[12][2];
    for (new i = 0; i < 13; i++)
    {
         GetPlayerWeaponData(playerid, i, weapons[i][0]/*weapon id*/, weapons[i][1]/*ammo*/);
    }

    ResetPlayerWeapons(playerid);

    for (i = 0; i < 13; i++)
    {
         if(weapons[i][0]!= /*bat weapon id*/)
         {
              GivePlayerWeapon(playerid, weapons[i][0], weapons[i][1]);
         }
         else
         {
              return 0;
         }
    }
Reply
#7

Thanks, but bit too late.
I got p*ssed off because of the baseball bat thing not working that I made a weapon saving system and then gave the weapons back after ResetPlayerWeapons(playerid);
I found out that Baseball bats has 65535 bullets.
So now there is no baseball bat :P
But thanks for the reply, others might need such a weapon saving script, could save weapons in a file or mysql (like I do).
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)