WARNING this already been done by voided, I am responsible since he post me an example when I asked for help and I did not check the whole source and just discover that I actually redo everything he did but less featured. I will leave VoiDeD the choice of posting the link to it by himself. Sorry once again.
original post
Spoiler
Hi alliedmodders community,
I create a ENTITY, PLAYER, CSPLAYER wrap with the new methodmap that the new pawn offer us and decided to share it.
WARNING: sdktools and cstrike must be include before the methodmap files if you want to use their functions.
GET = can only GET the value
SET = can GET and SET the value.
All properties start with a lower cap char and all methods start with a upper cap char.
Player derive from Entity and CSPlayer from player so Player have access to all Entity functions and properties and Player to all Player and Entity.
entity properties
Spoiler
PHP Code:
GET int index GET int valid GET int edict GET int networkable GET Address address SET int health SET int edictFlags SET float gravity SET int flags SET MoveType moveType SET RenderMode renderMode SET RenderFx renderFX
entity methods
Spoiler
PHP Code:
void SetColor(int red = 255, int green = 255, int blue = 255, int alpha = 255) bool GetClassname(char[] classname, int length) bool GetEdictClassname(char[] classname, int length) bool GetNetClassname(char[] classname, int length) void ChangeState(int offset = 0) void SetProperty(PropType type, const char[] prop, int value, int size = 4, int element = 0) int GetProperty(PropType type, const char[] prop, int size = 4, int element = 0) void SetPropertyFloat(PropType type, const char[] prop, float value, int element = 0) float GetPropertyFloat(PropType type, const char[] prop, int element = 0) void SetPropertyVector(PropType type, const char[] prop, float[3] vector, int element = 0) void GetPropertyVector(PropType type, const char[] prop, float[3] vector, int element = 0) void SetPropertyString(PropType type, const char[] prop, const char[] value) void GetPropertyString(PropType type, const char[] prop, char[] value, int length, int element = 0) int GetPropertyArraySize(PropType type, const char[] prop)
/* sdktools entinput included */ bool AcceptInput(const char[] input, int activator = -1, int caller = -1, int outputid = 0) bool SetVariant()
GET int userID GET int serialID GET bool timingOut GET float time GET int dataRate GET bool connected GET bool inGame GET bool alive GET bool inKickQueue GET bool authorized GET bool bot GET bool tv GET bool replayBot GET bool observer GET int button
SET int kill SET int death SET int team
/* sdktools voice included */ SET int listeningFlags SET int isMuted <- look the code to understand it
/* thx @ratty for his comment: will clear the buffer automatically if the result is false */ bool GetDecalFile(char[] hex, int length, bool ignore_check = false) bool GetJingleFile(char[] hex, int length, bool ignore_check = false) void SetInfo(const char[] key, const char[] value) int GiveAmmo(int amount, int type, bool sound = true)
public OnPluginStart() { CSPlayer player; for (int i = 1; i < MaxClients; i++) { if ((player = CSPlayer(i)) != INVALID_CSPLAYER) { static char buffer[32];
public OnPluginStart() { Player player; for (int i = 1; i < MaxClients; i++) { if ((player = Player(i)) != INVALID_PLAYER) { static char buffer[32];
player.health = 5; player.GetSteamID(buffer, 32);
player.MsgHint("Welcome to my example %N (%s)", player.index, buffer); } } }
I would like to participate and help alliedmodders for the transition and nothing better than a good player object to work with. Feel free to suggest features and/or report bugs.