Retreiving 'CBasePlayer.m_iFOV' ?
Retreiving 'CBasePlayer.m_iFOV' ?
Could some one show me an example of how to retrieve a players 'CBasePlayer.m_iFOV', 'CBasePlayer.localdata.m_Local.m_bDucked' and CBasePlayer.m_fFlags
Thanks, in advance
Thanks, in advance
-Tuck
Tuck wrote:Basicly what i want to retrieve about a player is, is he zoomed in on sniper, is he crouching or is he in the air
on css i used these to retrieve it :/
I guess your-name-here or some other C++ writer teamed up with him will be creating a playerlib-like library when all the other, more neccessary things are done. So, be patient =)
- ashbash1987
- Developer
- Posts: 20
- Joined: Tue Jul 10, 2012 12:01 pm
- Location: Sheffield, UK
- Contact:
Getting entity props is now in the latest code commit for SP. I don't know when the next full build will be available (or you could build it yourself if you are able to do so), but when it is available you'll be able to do something like this:
The example above will set all player's health values to 1 at the start of a round.
The methods that are available on the edict instance are are follows:
Get methods
Set Methods
Syntax: Select all
from Source import Entity
from Source import Player
from events.decorator import Event
@Event
def round_start(GameEvent):
for player in Player.Players():
entity = Player.EdictOfPlayer(player)
entity.SetPropInt("CBasePlayer.m_iHealth", 1)
The example above will set all player's health values to 1 at the start of a round.
The methods that are available on the edict instance are are follows:
Get methods
- GetPropInt(propName)
- GetPropFloat(propName)
- GetPropVector(propName)
- GetPropVectorXY(propName)
- GetPropString(propName)
- GetPropLong(propName)
Set Methods
- SetPropInt(propName, propValue)
- SetPropFloat(propName, propValue)
- SetPropVector(propName, propValue)
- SetPropVectorXY(propName, propValue)
- SetPropString(propName, propValue)
- SetPropLong(propName, propValue)
-
- Developer
- Posts: 168
- Joined: Sat Jul 07, 2012 1:58 am
-
- Developer
- Posts: 168
- Joined: Sat Jul 07, 2012 1:58 am
Mahi wrote:Looks great, but just one question. Why don't you merge all (or most, atleast int, float and long) into one method, instead of multiple same methods with just different type? Since C++ does support function overloading, and Python doesn't even have to know anything about it.
I flip the question onto you, why should we merge it all into one method? Having split methods makes it crystal clear what you're doing. Remember, this isn't Eventscripts. The goal of Source-Python is to provide one-to-one translation of C++ to Python. When you're this close to the engine, you're going to have to deal with type. Also, wrapping overloaded functions in boost (as far as I know) requires a fair amount of extra work.
Mahi wrote:Looks great, but just one question. Why don't you merge all (or most, atleast int, float and long) into one method, instead of multiple same methods with just different type? Since C++ does support function overloading, and Python doesn't even have to know anything about it.
That is because of how we expose the engine with boost python. Its really not that big of a deal is it?
ES:
What would be the equilivent ?
SP??:
Syntax: Select all
(es.getplayerprop(a['id'], 'CBasePlayer.m_fFlags') & 1) == 0
What would be the equilivent ?
SP??:
Syntax: Select all
entity = Player.EdictOfPlayer(<PLAYER>)
onground = ((entity.GetPropLong('CBasePlayer.m_fFlags') & 1) == 0)
-Tuck
using EasyPlayer it would be:
Syntax: Select all
SomeGuy = EasyPlayer(userid=a['id'])
SomeGuy.GetPropInt('CBasePlayer.m_fFlags')
Tuck wrote:I'm not really that much into the player flags why i was asking, I haven't messed around with python's & but the code example i wrote should work ?
I am not going to test your code for you. Please test your own code before posting here. Forum Rules
If your code has a problem, then come back... But please stop asking if your code will work or not.
Monday wrote:I am not going to test your code for you. Please test your own code before posting here. Forum Rules
If your code has a problem, then come back... But please stop asking if your code will work or not.
was simply asking if es returned string, long or int but fine if u dont know it i'll have to install es and check... (sorry to bother you..)
-Tuck
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 64 guests