SA-MP Forums Archive
only MP5 drive by - 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)
+--- Thread: only MP5 drive by (/showthread.php?tid=427984)



only MP5 drive by - elitesae - 04.04.2013

I need a script, disable driver drive by, Passenger can drive by but MP5 only

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER) SetPlayerArmedWeapon(playerid, 0);
    return 1;
}



Re: only MP5 drive by - MP2 - 04.04.2013

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 3) // Passenger
    {
        // Get weapon data in slot 4 (SMGs)
        new weapon, ammo;
        GetPlayerWeaponData(playerid, 4, weapon, ammo);
        SetPlayerArmedWeapon(playerid, weapon);
    }
    // other code
    return 1;
}
Not tested. Should work. The 'weapon' might be 0, which means they don't have an SMG. In which case, their armed weapon will be set to 0 (fist).


Re : only MP5 drive by - will-56 - 04.04.2013

Something like this ?

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    switch(newstate)
     {
         case PLAYER_STATE_DRIVER:
          {
               SetPlayerArmedWeapon(playerid, 0);
          }
         case PLAYER_STATE_PASSENGER:
          {
              new weapon[2];
               GetPlayerWeaponData(playerid, 4, weapon[0], weapon[1]);
              if(weapon[0] != 29)
               {
                    SetPlayerArmedWeapon(playerid, 0);
               }
          }
     }
    return 1;
}



Re: only MP5 drive by - elitesae - 05.04.2013

Quote:
Originally Posted by MP2
Посмотреть сообщение
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 3) // Passenger
    {
        // Get weapon data in slot 4 (SMGs)
        new weapon, ammo;
        GetPlayerWeaponData(playerid, 4, weapon, ammo);
        SetPlayerArmedWeapon(playerid, weapon);
    }
    // other code
    return 1;
}
Not tested. Should work. The 'weapon' might be 0, which means they don't have an SMG. In which case, their armed weapon will be set to 0 (fist).
this one works very well thanks


Re: only MP5 drive by - MP2 - 05.04.2013

Oh wait, did you mean MP5 only or SMG only?


Re: only MP5 drive by - elitesae - 05.04.2013

its cool, i added a line now it works very well!
hey MP2 do you script for money? i will pay if you make script for me


Re: only MP5 drive by - MP2 - 05.04.2013

No sorry.

Not sure what you did, but if you want ONLY MP5:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 3) // Passenger
    {
        // Get weapon data in slot 4 (SMGs)
        new weapon, ammo;
        GetPlayerWeaponData(playerid, 4, weapon, ammo);
        if(weapon == WEAPON_MP5) SetPlayerArmedWeapon(playerid, WEAPON_MP5);
        else SetPlayerArmedWeapon(playerid, 0);
    }
    // other code
    return 1;
}