Thread: [Solved] Natives and Methodmaps
View Single Post
iGANGNAM
AlliedModders Donor
Join Date: Sep 2012
Location: Lithuania
Old 06-07-2018 , 07:26   Re: Natives and Methodmaps
Reply With Quote #6

I trying to make Native methodmap for client and I get these warnings:
Code:
....
include file...

methodmap ZMPlayer {
  // Constructor
  public native ZMPlayer(int client);
  // Methods
  // XP related
  property int Client {
        public native get();
  }
  property int Level {
        public native get();
  }
  property int XP {
        public native get();
        public native set(const int val);
  }
... somewhere in main code .... 
//	CreateNative("ZMPlayer.ZMPlayer", Native_ZMPlayer_Constructor);
public int Native_ZMPlayer_Constructor(Handle plugin, int numParams)
{
	int client = view_as<int>(GetNativeCell(2));
	if ( IsValidClient( client ) ) {
		return view_as< ZMPlayer >( GetClientUserId( client ) );
	}
	return view_as< ZMPlayer >(-1);
}

public int Native_ZMPlayer_ClientGet(Handle plugin, int numParams) 
{
	ZMPlayer player = GetNativeCell(1);
	return GetClientOfUserId( int(player) );
}

public int Native_ZMPlayer_LevelGet(Handle plugin, int numParams)
{
	ZMPlayer player = GetNativeCell(1);
	return getPlayerLevel(player.Client);
}

public int Native_ZMPlayer_XPGet(Handle plugin, int numParams)
{
	ZMPlayer player = GetNativeCell(1);
	return getPlayerUnlocks(player.Client);
}

public int Native_ZMPlayer_XPSet(Handle plugin, int numParams)
{
	ZMPlayer player = GetNativeCell(1);
	setPlayerUnlocks( player.Client, GetNativeCell(2));
}
And I get these 2
Code:
// C:\zombies\addons\sourcemod\scripting\zombie_mod.sp(1454) : warning 213: tag mismatch
// C:\zombies\addons\sourcemod\scripting\zombie_mod.sp(1456) : warning 213: tag mismatch
Which are returning values for constructor....
Code:
return view_as< ZMPlayer >( GetClientUserId( client ) );
and
Code:
return view_as< ZMPlayer >(-1);
Why I get this warning?
__________________
iGANGNAM is offline