Hey,
Is it possible to give someone the nightvision screen ( the green overlay one ) with just a command?
So lets say the player has no nightvision goggles & if you would type !nvgs can you give him that nightvision view?
Sorry, im on my phone
Give nightvision
has_nightvision and nightvision_on are already added as attributes for player entities for CS:S but not CS:GO. I am not sure if it even works for CS:GO, but if it does, we can add it.
Actually, had a bit of time to test CS:GO. It seems that the functionality still exists for this, but the item isn't included in the buy menu. If I use the following script:
then, I can use the following in my client console to activate the nightvision overlay:
That is, of course, after adding the properties to our data. You can also just set the nightvision_on attribute if you don't really want to worry about ownership of them:
Both has_nightvision and nightvision_on are not 1/0 values the first time you retrieve them, which is why I used %2 and not just simply set to True/False on the toggle. The only exception to that is CS:GO's has_nightvision. I think we should probably fix that internally to pass back either 1/0 or True/False in these situations. Setting to 1/0 or True/False works just fine, though.
I will go ahead and add those to CS:GO's data and we will make the other adjustments when we get the chance.
Syntax: Select all
from commands.say import SayCommand
from players.entity import Player
@SayCommand('nvg')
def give_nvg(command, index, team_only):
Player(index).has_nightvision = True
then, I can use the following in my client console to activate the nightvision overlay:
Code: Select all
nightvision
That is, of course, after adding the properties to our data. You can also just set the nightvision_on attribute if you don't really want to worry about ownership of them:
Syntax: Select all
from commands.say import SayCommand
from players.entity import Player
@SayCommand('nvg')
def nvg_toggle(command, index, team_only):
player = Player(index)
player.nightvision_on = 1 - (player.nightvision_on % 2)
Both has_nightvision and nightvision_on are not 1/0 values the first time you retrieve them, which is why I used %2 and not just simply set to True/False on the toggle. The only exception to that is CS:GO's has_nightvision. I think we should probably fix that internally to pass back either 1/0 or True/False in these situations. Setting to 1/0 or True/False works just fine, though.
I will go ahead and add those to CS:GO's data and we will make the other adjustments when we get the chance.
satoon101 wrote:Actually, had a bit of time to test CS:GO. It seems that the functionality still exists for this, but the item isn't included in the buy menu. If I use the following script:Syntax: Select all
from commands.say import SayCommand
from players.entity import Player
@SayCommand('nvg')
def give_nvg(command, index, team_only):
Player(index).has_nightvision = True
then, I can use the following in my client console to activate the nightvision overlay:Code: Select all
nightvision
That is, of course, after adding the properties to our data. You can also just set the nightvision_on attribute if you don't really want to worry about ownership of them:Syntax: Select all
from commands.say import SayCommand
from players.entity import Player
@SayCommand('nvg')
def nvg_toggle(command, index, team_only):
player = Player(index)
player.nightvision_on = 1 - (player.nightvision_on % 2)
Both has_nightvision and nightvision_on are not 1/0 values the first time you retrieve them, which is why I used %2 and not just simply set to True/False on the toggle. The only exception to that is CS:GO's has_nightvision. I think we should probably fix that internally to pass back either 1/0 or True/False in these situations. Setting to 1/0 or True/False works just fine, though.
I will go ahead and add those to CS:GO's data and we will make the other adjustments when we get the chance.
Perfect! Exactly what I wanted. Thank you
Re:
satoon101 wrote:Both has_nightvision and nightvision_on are not 1/0 values the first time you retrieve them, which is why I used %2 and not just simply set to True/False on the toggle. The only exception to that is CS:GO's has_nightvision. I think we should probably fix that internally to pass back either 1/0 or True/False in these situations. Setting to 1/0 or True/False works just fine, though.
Just wanted to note that we just fixed the above issue with SendProps!! We now use the <SendProp>.bits to determine the size of SendPropType.INT properties.
A big thank you to your-name-here for pointing us in this direction!
For the above example, it would now simply look like:
Syntax: Select all
from commands.say import SayCommand
from players.entity import Player
@SayCommand('nvg')
def nvg_toggle(command, index, team_only):
player = Player(index)
player.nightvision_on = not player.nightvision_on
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 71 guests