SA-MP Forums Archive
Disabling the MP5 jump on bicycles. - 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: Disabling the MP5 jump on bicycles. (/showthread.php?tid=104312)



Disabling the MP5 jump on bicycles. - CaHbKo - 23.10.2009

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.


Re: Disabling the MP5 jump on bicycles. - Malice - 23.10.2009

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.


Re: Disabling the MP5 jump on bicycles. - dice7 - 23.10.2009

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


Re: Disabling the MP5 jump on bicycles. - CaHbKo - 23.10.2009

Okay, i will try that. Thanks for answers!