Enum struct, how do we access the struct property as parameter?
How do we access the struct property as parameter (FPlayerChances:CameraShakeChance)?
PHP Code:
|
Re: Enum struct, how do we access the struct property as parameter?
Please show your enum struct
|
Re: Enum struct, how do we access the struct property as parameter?
index.CameraShakeChance or FPlayerChances[client][index].CameraShakeChance ?
I'm pretty confused about your code. I don't really get it, you pass an enum struct as a parameter called index (weird name) yet you access it with FPlayerChances[client][index] like wtf. And old syntax too :'( |
Re: Enum struct, how do we access the struct property as parameter?
Quote:
PHP Code:
|
Re: Enum struct, how do we access the struct property as parameter?
Quote:
The code in the example is not the initial code as it was work in progress of the refactoring so it may be lot of confusion. I want to access the property of the enum by flag or string using "reflection", is that possible? Otherwise, I was thinking of refactor the data structure to StringMap. |
Re: Enum struct, how do we access the struct property as parameter?
enum struct just "sugar coating" code.
If you want get items work as array, using index, one way is this. PHP Code:
Second way. You can create function, inside enum struct as well Code:
enum Anyone, please mention, if this code sample is wrong. I just throw this from my head. |
Re: Enum struct, how do we access the struct property as parameter?
why we usually use MAXPLAYERS+1 not MAXPLAYERS?
MAXPLAYERS is 65 actually, if we need to traversal an array of player from 0-64, it is ok. is it not always equal to 65 in the other source game? |
Re: Enum struct, how do we access the struct property as parameter?
PHP Code:
There can be 65 players in some games. So if you create array Code:
array[65] Usually we use client indexs as array index. You have to remember, client index start from 1 (0 is console) Now you use above array, starting index 1 to 64 (total 64 index) In code we loop using dynamic variable MaxClients, this can return result 65 In code loop, to catch finale client index 65 PHP Code:
This is reason why should add +1 while create array, because array index has offset +1 when using client indexs. Also SourceTV adds +1 extra slot in some games (ex. CS:S). Code:
Unable to load plugin "addons/metamod/bin/win64/server" |
Re: Enum struct, how do we access the struct property as parameter?
Quote:
I just wonder why the enum does not have a name? PHP Code:
PHP Code:
I wish the ChanceTotal to just be Total but I got another enum with different properties, but Total is already used it says. |
Re: Enum struct, how do we access the struct property as parameter?
ok, i haven't seen the situation that MaxClients can over the MaxPlayers, i just make plugin for L4D2 and MAXPLAYERS is big enough for this game(65 - 31).
|
All times are GMT -4. The time now is 22:46. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.