only MP5 drive by
#1

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;
}
Reply
#2

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).
Reply
#3

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;
}
Reply
#4

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
Reply
#5

Oh wait, did you mean MP5 only or SMG only?
Reply
#6

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
Reply
#7

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)