Hello,
At the moment I'm getting this fairly strange issue with enum scoping, I'm wondering whether anyone can point out where I'm going wrong? I'm currently playing around with methodmaps a lot, OOP is often said to be over-rated but it works really well for some things. Namely, I have an "invisibility" skill I'm developing:
PHP Code:
/*
* Base CS:GO plugin requirements.
*/
#include <sourcemod>
#include <sdktools>
#include <cstrike>
/*
* Custom methodmap includes.
*/
#include <player_methodmap>
public Action OnPlayerHurt(Event event, const char[] name, bool dontBroadcast) {
char weapon[64];
event.GetString("weapon", weapon, sizeof(weapon))
if (StrEqual(weapon, "weapon_taser")) {
Player player = Player(event.GetInt("userid"))
if (level) {
player.Invisible(true);
}
}
}
And the player methodmap file:
PHP Code:
#if defined _player_methodmap_included
#endinput
#endif
#define _player_methodmap_included
/*
* Base CS:GO plugin requirements.
*/
#include <clientprefs>
#include <sourcemod>
#include <sdktools>
#include <cstrike>
methodmap Player {
public Player(int client) {
return view_as<Player>(client);
}
public void Invisible(bool invisible) {
if (invisible) {
SetEntityRenderMode(that, RENDER_NONE);
} else {
SetEntityRenderMode(that, RENDER_NORMAL);
}
}
}
For brevity, a lot of code has been omitted. However, when compiled this code errors out with:
Code:
error 017: undefined symbol "RENDER_NONE"
error 017: undefined symbol "RENDER_NORMAL"
Other alternatives I've tried lead to differing issues. If I move "SetEntityRenderMode" to the main file, it works as expected. If I try to pass the value of "RENDER_NONE" and "RENDER_NORMAL" to the function as so:
PHP Code:
player.Invisible(true, RENDER_NONE);
...
public void Invisible(bool invisible, RenderMode render) {
Then it complains that:
Code:
error 181: function argument named 'render' differs from prototype
And also that I'm passing the wrong arguments in the main code:
Code:
warning 213: tag mismatch
warning 213: tag mismatch
Any ideas on whats going so wrong? As far as I can see I'm including the same stuff in both files.