fpv diable command

Started by Coolkid, Apr 19, 2016, 12:35 AM

Previous topic - Next topic

Coolkid

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

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

KAKAN

Why not use a bindkey instead?
oh no

[Elv]Woodland

#2
no need to put 0x200 there SetWeaponDataValue(21, 12, 0); works perfect.

Coolkid

Quote from: KAKAN on Apr 19, 2016, 04:04 AMWhy not use a bindkey instead?
i dont wnt to use bind key i want to use it aS a command

Coolkid

Quote from: Woodland on Apr 19, 2016, 07:41 PMno need to put 0x200 there SetWeaponDataValue(21, 12, 0); works perfect.
is you command working fine

[Elv]Woodland

Quote from: Coolkid on Apr 19, 2016, 08:31 PM
Quote from: Woodland on Apr 19, 2016, 07:41 PMno need to put 0x200 there SetWeaponDataValue(21, 12, 0); works perfect.
is you command working fine


Yep

Mötley

#6
Why not just disable it in general? I have not tested but what about

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

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

A better approach would be to disarm the player when he goes into First Person View with an M4/M60/Ruger:

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

Mötley

Quote from: aXXo on Apr 20, 2016, 06:19 PMA better approach would be to disarm the player when he goes into First Person View with an M4/M60/Ruger:

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

[Elv]Woodland


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

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

Mötley

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

[Elv]Woodland

Quote from: Coolkid on Apr 25, 2016, 06:55 PMWoodland 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

Quote from: Coolkid on Apr 19, 2016, 12:35 AMwhats 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

[spoiler="command"]
else if ( cmd == "disablefpv" )
{
SetWeaponDataValue(26, 12, 0x200 );
SetWeaponDataValue(27, 12, 0x200 );
SetWeaponDataValue(32, 12, 0x200 );
 Message("Admin Disabled FPV!");
}
[/spoiler]
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.

D4rkR420R

Try freezing/unfreezing the player or changing his skin. Afaik, altering the skin resets the pedestrian's animation.