Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Coolkid on Apr 19, 2016, 12:35 AM

Title: fpv diable command
Post by: Coolkid on Apr 19, 2016, 12: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

[spoiler="command"]
else if ( cmd == "disablefpv" )
{
SetWeaponDataValue(26, 12, 0x200 );
SetWeaponDataValue(27, 12, 0x200 );
SetWeaponDataValue(32, 12, 0x200 );
 Message("Admin Disabled FPV!");
}
[/spoiler]
Title: Re: fpv diable command
Post by: KAKAN on Apr 19, 2016, 04:04 AM
Why not use a bindkey instead?
Title: Re: fpv diable command
Post by: [Elv]Woodland on Apr 19, 2016, 07:41 PM
no need to put 0x200 there SetWeaponDataValue(21, 12, 0); works perfect.
Title: Re: fpv diable command
Post by: Coolkid on Apr 19, 2016, 08:31 PM
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
Title: Re: fpv diable command
Post by: 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
Title: Re: fpv diable command
Post by: [Elv]Woodland on Apr 20, 2016, 06:30 AM
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
Title: Re: fpv diable command
Post by: Mötley on Apr 20, 2016, 12:14 PM
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.
Title: Re: fpv diable command
Post by: aXXo on Apr 20, 2016, 06:19 PM
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);
}
}
}
Title: Re: fpv diable command
Post by: Mötley on Apr 20, 2016, 09:14 PM
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
Title: Re: fpv diable command
Post by: [Elv]Woodland on Apr 25, 2016, 02:46 PM

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

}
Title: Re: fpv diable command
Post by: Coolkid on Apr 25, 2016, 06: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
Title: Re: fpv diable command
Post by: Mötley on Apr 25, 2016, 07: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
Title: Re: fpv diable command
Post by: [Elv]Woodland on Apr 25, 2016, 08:10 PM
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
Title: Re: fpv diable command
Post by: Mr.Dip 2020 on Jan 15, 2021, 03:13 PM
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.
Title: Re: fpv diable command
Post by: D4rkR420R on Feb 24, 2021, 10:23 PM
Try freezing/unfreezing the player or changing his skin. Afaik, altering the skin resets the pedestrian's animation.
Title: Re: fpv diable command
Post by: Mohamed Boubekri on Feb 28, 2021, 03:54 PM
Quote from: DarkRaZoR^ on Feb 24, 2021, 10:23 PMTry freezing/unfreezing the player or changing his skin. Afaik, altering the skin resets the pedestrian's animation.
Not necessary only he must stop the movement of the player
like : player.SetAnim(0,0);