Disabling the MP5 jump on bicycles.
#1

Hi,

I've been scripting for 2 days and got this problem:

I need to disable the MP5 jump on bicycles, and i tried to do that in many ways. I tried to make a script which sets the armed weapon to 0 OnPlayerGetInVehicle, OnPlayerChangeState and many others, but the UZI stays equipped.
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
  new weap = GetPlayerWeapon(playerid);
  if (oldstate == PLAYER_STATE_ONFOOT)
  if (newstate == PLAYER_STATE_DRIVER)
  {
    if(weap == 32 || weap == 28 || weap == 29)
    {
      SendClientMessage(playerid, 0xFFFF00AA, "Driving a vehicle/bicycle, weapon switched to fists.");
      SetPlayerArmedWeapon(playerid, 0);
      return 1;
    }
    return 1;
  }
  return 1;
}
Maybe i made some mistake there? Or there are some other ways in disabling it?

Thanks.
Reply
#2

It's been a while since I've tried something like this, but if the player is in the vehicle when the state changes maybe it is too late to change the weapon. Either that, or maybe SetPlayerArmedWeapon is broken? The old way of doing this was removing the weapon upon entering and giving it back on exit.
Reply
#3

When on a bike the player will always hold the weapon in the msg slot
Reply
#4

Okay, i will try that. Thanks for answers!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)