Quote:
Originally Posted by asherkin
The correct way to implement that is with |static| anyway.
FindSendPropOffs is also more performant for this case.
const-qualifying the param also means nothing.
PHP Code:
bool:IsPlayerControllingBot(client) { static bIsAvailable = FindSendPropOffs("CBasePlayer", "m_bIsControllingBot") != -1; return bIsAvailable && GetEntProp(client, Prop_Send, "m_bIsControllingBot") == 1; }
|
I too tried using a static for it yesterday, as I like keeping scope limited, but the compiler throws up an error if you use it, stating
"error 008: must be a constant expression; assumed zero". That's why I had to force it up to a generic global.
Using
const is just good design practice. Stops people from making inadvertent mistakes.
__________________