Coolkid

  • Full Member
  • Posts: 171
fpv diable command
« on April 19th, 2016, 01:35 AM »Last edited on April 19th, 2016, 01:36 AM
whats am i doing wrong in this command

instead of function i thought of making command so i can disable and enable back fpv without any function

(click to show/hide)

Code: [Select]
else if ( cmd == "disablefpv" )
{
SetWeaponDataValue(26, 12, 0x200 );
SetWeaponDataValue(27, 12, 0x200 );
SetWeaponDataValue(32, 12, 0x200 );
 Message("Admin Disabled FPV!");
}

KAKAN

  • Wiki Contributor
  • Posts: 3,340
oh no

Re: fpv diable command
« Reply #2, on April 19th, 2016, 08:41 PM »Last edited on April 19th, 2016, 09:05 PM by Woodland
no need to put 0x200 there SetWeaponDataValue(21, 12, 0); works perfect.

Coolkid

  • Full Member
  • Posts: 171


Bob

  • Hero Member
  • Posts: 775
Re: fpv diable command
« Reply #6, on April 20th, 2016, 01:14 PM »Last edited on April 20th, 2016, 01:33 PM
Why not just disable it in general? I have not tested but what about

Code: [Select]
function onServerStart()
{
  SetWeaponDataValue(26, 12, 0 );
  SetWeaponDataValue(27, 12, 0 );
  SetWeaponDataValue(32, 12, 0 );
}
That should do it.
Well its how I would do it.

As I think maybe that command could be bypassed if someone quit and rejoined the server."I could be wrong in general"

Edit
I tryed many ways as well as

Code: [Select]
function onPlayerWeaponChange( player, oldwep, newwep )
{
    if ( newwep == 26 )
    {
        SetWeaponDataValue(26, 12, 0 );
    }
else if ( newwep == 27 )
    {
        SetWeaponDataValue(27, 12, 0 );
    }
else if ( newwep == 32 )
    {
        SetWeaponDataValue(32, 12, 0 );
    }
}
And It does not seem to do it at all. Even the command.

aXXo

  • Full Member
  • Posts: 170
Re: fpv diable command
« Reply #7, on April 20th, 2016, 07:19 PM »
A better approach would be to disarm the player when he goes into First Person View with an M4/M60/Ruger:

Code: [Select]
function onPlayerActionChange(player, old, new)
{
if(new==12) // 12 is the action when player enters FPV
{
switch(player.Weapon)
{
// Allowed weapons:
case WEP_ROCKETLAUNCHER:
case WEP_SNIPER:
case WEP_LASERSCOPE:
break;

// Disallowed weapons
case WEP_M4:
case WEP_RUGER:
case WEP_M60:
// Disarm the player
player.SetWeapon(0,0);
break;
default:
player.SetWeapon(0,0);
}
}
}

Bob

  • Hero Member
  • Posts: 775
Re: fpv diable command
« Reply #8, on April 20th, 2016, 10:14 PM »
Quote from aXXo on April 20th, 2016, 07:19 PM
A better approach would be to disarm the player when he goes into First Person View with an M4/M60/Ruger:

Code: [Select]
function onPlayerActionChange(player, old, new)
{
if(new==12) // 12 is the action when player enters FPV
{
switch(player.Weapon)
{
// Allowed weapons:
case WEP_ROCKETLAUNCHER:
case WEP_SNIPER:
case WEP_LASERSCOPE:
break;

// Disallowed weapons
case WEP_M4:
case WEP_RUGER:
case WEP_M60:
// Disarm the player
player.SetWeapon(0,0);
break;
default:
player.SetWeapon(0,0);
}
}
}
I like that!
But instead of setting the weapon to fist I would suggest to create a command to disabling that weapon slot from the saved data,. Rather than skiping weapons as I feel this could cause future lag on this function as If the players constantly keeps switching weapons or they can not get to all of the weapons due to this(or in general) I would guarantee that if you added print to this function when a server is online the usage of this function would be just to much on a server. causing possible future lag Explanation: a Deathmatch.
Thats just my suggestion on that code as I like it but I would not trust it on a popular server with a maximum of at least 25 players


Of course he is inactive when needing help. Meh

Re: fpv diable command
« Reply #9, on April 25th, 2016, 03:46 PM »
Code: [Select]

function onScriptLoad()
{
fpv <- false;
}

function onPlayerActionChange(player, old, new)
{
if(new==12 && fpv == false) // 12 is the action when player enters FPV
{
switch(player.Weapon)
{
// Allowed weapons:
case WEP_ROCKETLAUNCHER:
case WEP_SNIPER:
case WEP_LASERSCOPE:
break;

// Disallowed weapons
case WEP_M4:
case WEP_RUGER:
case WEP_M60:
// Disarm the player
player.SetWeapon(0,0);
break;
default:
player.SetWeapon(0,0);
}
}
}

function onPlayerCommand( player, cmd, text )
{
if ( cmd == "enablefpv" )
{
if ( fpv == true ) MessagePlayer("fpv is already enabled",player)
else {
fpv = true;
MessagePlayer("fpv has been enabled",player)
}
}

else if ( cmd == "disablefpv" )
{
if ( fpv == false ) MessagePlayer("fpv is already disabled",player)
else {
fpv = false;
MessagePlayer("fpv has been disabled",player)
}
}

}

Coolkid

  • Full Member
  • Posts: 171
Re: fpv diable command
« Reply #10, on April 25th, 2016, 07:55 PM »
Woodland I appreciated the command but it will only disarm player ammo while in fpv position but it will not get the player out of fpv the player will still be in fpv is it possible to make player come out of fpv the thing that you posted will only disarm nothing else and all functions above are same but can anyone help me to force player stand and come out of fpv position

Bob

  • Hero Member
  • Posts: 775
Re: fpv diable command
« Reply #11, on April 25th, 2016, 08:23 PM »
Maybe you could set the animation to standing ( but players might need to press the jump key to get out of it )
if anything this would prevent the animation of fpv. or you could do this and possibly do something like set the players position after the animation to a few inches up.
This will cause the animation to 99 % break as the player is taking a slight fall.
"untested theory " I might play with this a little sometime

Re: fpv diable command
« Reply #12, on April 25th, 2016, 09:10 PM »
Quote from Coolkid on April 25th, 2016, 07:55 PM
Woodland I appreciated the command but it will only disarm player ammo while in fpv position but it will not get the player out of fpv the player will still be in fpv is it possible to make player come out of fpv the thing that you posted will only disarm nothing else and all functions above are same but can anyone help me to force player stand and come out of fpv position
There isnt any flag to get player out of fpv i guess ,and its only you who use to abuse fpv xD

Mr.Dip 2020

  • Newbie
  • Posts: 6
Re: fpv diable command
« Reply #13,  »
Quote from Coolkid on April 19th, 2016, 01:35 AM
whats am i doing wrong in this command

instead of function i thought of making command so i can disable and enable back fpv without any function

(click to show/hide)

Code: [Select]
else if ( cmd == "disablefpv" )
{
SetWeaponDataValue(26, 12, 0x200 );
SetWeaponDataValue(27, 12, 0x200 );
SetWeaponDataValue(32, 12, 0x200 );
 Message("Admin Disabled FPV!");
}
i have tested this command of @Coolkid and turns out that it doesnt disable fpv but it either breaks it cuz when you shoot in fpv mode you can see the bullet is coming from somewhere else its someone else is shooting the gun but from far away also if you type this command it will disable your tpp instead cuz when you shoot assault rifles like - m60,m4,ruger it wont shoot instead it will only show the shooting animation but it wont show the bullet particle.

DarkRaZoR^

  • Full Member
  • VC:MP Battlefield Head Developer/KF Leader
  • Posts: 226
Re: fpv diable command
« Reply #14,  »
Try freezing/unfreezing the player or changing his skin. Afaik, altering the skin resets the pedestrian's animation.