SA-MP Forums Archive
Anti DB as Passanger - 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: Anti DB as Passanger (/showthread.php?tid=215655)



Anti DB as Passanger - SanAndreasVille - 23.01.2011

Hello i want a simple Script for anti Drive by as Passenger

The Passenger can use only a mp5

Deagle , MP5, M4, Shotgun musst block or switch can every one help me ?


Re: Anti DB as Passanger - Marricio - 23.01.2011

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
https://sampwiki.blast.hk/wiki/IsPlayerInVehicle
https://sampwiki.blast.hk/wiki/GetPlayerWeapon

This is used to stop animations (in this case, drive-by)
ApplyAnimation(playerid, "CARRY", "crry_prtial", 2.0, 0, 0, 0, 0, 0);


Re: Anti DB as Passanger - SanAndreasVille - 23.01.2011

I have this found it dont work why ?

Код:
public OnPlayerUpdate(playerid)
{
    if( IsPlayerInAnyVehicle(playerid) && GetPlayerWeapon(playerid) > 0 && !IsNormalWeapon(GetPlayerWeapon(playerid)) ) SetPlayerArmedWeapon(playerid, 0);
		return 1;
}
Код:
stock IsNormalWeapon(weaponid)
{
if(weaponid == 29) return 1;
return 0;
}



Re: Anti DB as Passanger - Jefff - 23.01.2011

http://forum.sa-mp.com/showthread.ph...yerarmedweapon


Re: Anti DB as Passanger - Marricio - 23.01.2011

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SPRINT)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(GetPlayerWeapon(playerid) != 29)
            {
                ApplyAnimation(playerid, "CARRY", "crry_prtial", 2.0, 0, 0, 0, 0, 0);
            }
            else if(GetPlayerWeapon(playerid) == 29)
            {
                return 1;
            }
        }
    }
    return 0;
}
Not tested In Game. No errors in my PC.


Re: Anti DB as Passanger - ricardo178 - 23.01.2011

Quote:
Originally Posted by Marricio
Посмотреть сообщение
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SPRINT)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(GetPlayerWeapon(playerid) != 29)
            {
                ApplyAnimation(playerid, "CARRY", "crry_prtial", 2.0, 0, 0, 0, 0, 0);
            }
            else if(GetPlayerWeapon(playerid) == 29)
            {
                return 1;
            }
        }
    }
    return 0;
}
Not tested In Game. No errors in my PC.
I am not sure if this code only allow you to use this weapon or took your weapon, on this case id 29(mp5)
And btw why you don't like that can shoot with all weapons? at irl you can too!