Weapon
#1

Hi all, I want to know how a player change their weapon slot. Example, when a player change his Deagle to MP5, the server will detect and it will AttachObjectToPlayer. So the Deagle will be on his Mag Pouch. Plus, I want to know if someone presses G and get into a vehicle, and Press H. I want it to shoot it with Deagle, but everytime I enter the vehicle, the only weapon that is available to shoot is MP5. Please Help me.... I just want to know whats the function for that.
Reply
#2

I think you would have to run a timer and use "GetPlayerWeapon" to determine which weapon they have scrolled at the moment.

In order to make it so a player can only have an MP5 when in a vehicle, you would basically need to use OnPlayerEnterVehicle and set their weapon slot to their sub-machine gun.
Reply
#3

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
I think you would have to run a timer and use "GetPlayerWeapon" to determine which weapon they have scrolled at the moment.

In order to make it so a player can only have an MP5 when in a vehicle, you would basically need to use OnPlayerEnterVehicle and set their weapon slot to their sub-machine gun.
But how about Use Deagle while inside the vehicle
Reply
#4

If you're insisting on using the Deagle when driving, it's not possible. However if you mean passenger, you will need to use the OnPlayerEnterVehicle and check if ispassenger is set to 1, or use the OnPlayerStateChange function and detect whether the newstate is PLAYER_STATE_PASSENGER, then set their weapon accordingly if they have one.
Reply
#5

Try to enter vehicle with Deagle,then it will show that you have a dealge in a current moment,so you can press H.

Or just add GivePlayerWeapon(playerid, 24 , 9999); OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)

Like when you gonna enter any vehicle as passanger,you will get infinite deagle.
Reply
#6

Here is a simple stock to detect the weapon model
pawn Код:
stock GetWeaponModel(weaponid)
{
    switch(weaponid)
    {
        case 1:
            return 331;


        case 9:
            return 341;

        case 10..15:
            return weaponid+311;

        case 16..18:
            return weaponid+326;

        case 22..29:
            return weaponid+324;

        case 30,31:
            return weaponid+325;

        case 32:
            return 372;

        case 33..45:
            return weaponid+324;

        case 46:
            return 371;
    }
    return 0;
}
You can use the stock in OnPlayerUpdate
EDIT:If you can't switch to deagle you're server must have a anti deagle driveby.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)