Added user_has_weapon() native
This commit is contained in:
parent
7853e0c3e8
commit
f88bd58919
|
@ -546,6 +546,46 @@ static cell AMX_NATIVE_CALL get_user_attacker(AMX *amx, cell *params) /* 2 param
|
||||||
return (enemy ? pPlayer->index : 0);
|
return (enemy ? pPlayer->index : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL user_has_weapon(AMX *amx,cell *params)
|
||||||
|
{
|
||||||
|
int index = params[1];
|
||||||
|
if (index < 1 || index > gpGlobals->maxClients){
|
||||||
|
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
edict_t *pEntity = pPlayer->pEdict;
|
||||||
|
if (params[3] == -1)
|
||||||
|
{
|
||||||
|
if ((pEntity->v.weapons & (1<<params[2])) > 0)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((pEntity->v.weapons & (1<<params[2])) > 0)
|
||||||
|
{
|
||||||
|
if (params[3] == 0)
|
||||||
|
{
|
||||||
|
pEntity->v.weapons &= ~(1<<params[2]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (params[3] == 1)
|
||||||
|
{
|
||||||
|
pEntity->v.weapons |= (1<<params[2]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params) /* 3 param */
|
static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params) /* 3 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
|
@ -2502,6 +2542,7 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
|
||||||
{ "get_user_team", get_user_team },
|
{ "get_user_team", get_user_team },
|
||||||
{ "get_user_time", get_user_time },
|
{ "get_user_time", get_user_time },
|
||||||
{ "get_user_userid", get_user_userid },
|
{ "get_user_userid", get_user_userid },
|
||||||
|
{ "user_has_weapon", user_has_weapon },
|
||||||
{ "get_user_weapon", get_user_weapon},
|
{ "get_user_weapon", get_user_weapon},
|
||||||
{ "get_user_weapons", get_user_weapons},
|
{ "get_user_weapons", get_user_weapons},
|
||||||
{ "get_weaponname", get_weaponname},
|
{ "get_weaponname", get_weaponname},
|
||||||
|
|
|
@ -1,30 +1,28 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 7.00
|
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amxmodx_mm", "amxmodx_mm.vcproj", "{CDD792EF-ABC5-4C61-803F-616E209C03D6}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amxmodx_mm", "amxmodx_mm.vcproj", "{7A2555A6-CBA6-4BD0-96AE-72DA57B995DF}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfiguration) = preSolution
|
GlobalSection(SolutionConfiguration) = preSolution
|
||||||
ConfigName.0 = Debug
|
Debug = Debug
|
||||||
ConfigName.1 = JITDebug
|
JITDebug = JITDebug
|
||||||
ConfigName.2 = JITRelease
|
JITRelease = JITRelease
|
||||||
ConfigName.3 = MemtestDebug
|
MemtestDebug = MemtestDebug
|
||||||
ConfigName.4 = MemtestRelease
|
MemtestRelease = MemtestRelease
|
||||||
ConfigName.5 = Release
|
Release = Release
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectDependencies) = postSolution
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfiguration) = postSolution
|
GlobalSection(ProjectConfiguration) = postSolution
|
||||||
{CDD792EF-ABC5-4C61-803F-616E209C03D6}.Debug.ActiveCfg = Debug|Win32
|
{7A2555A6-CBA6-4BD0-96AE-72DA57B995DF}.Debug.ActiveCfg = Debug|Win32
|
||||||
{CDD792EF-ABC5-4C61-803F-616E209C03D6}.Debug.Build.0 = Debug|Win32
|
{7A2555A6-CBA6-4BD0-96AE-72DA57B995DF}.Debug.Build.0 = Debug|Win32
|
||||||
{CDD792EF-ABC5-4C61-803F-616E209C03D6}.JITDebug.ActiveCfg = JITDebug|Win32
|
{7A2555A6-CBA6-4BD0-96AE-72DA57B995DF}.JITDebug.ActiveCfg = JITDebug|Win32
|
||||||
{CDD792EF-ABC5-4C61-803F-616E209C03D6}.JITDebug.Build.0 = JITDebug|Win32
|
{7A2555A6-CBA6-4BD0-96AE-72DA57B995DF}.JITRelease.ActiveCfg = JITRelease|Win32
|
||||||
{CDD792EF-ABC5-4C61-803F-616E209C03D6}.JITRelease.ActiveCfg = JITRelease|Win32
|
{7A2555A6-CBA6-4BD0-96AE-72DA57B995DF}.MemtestDebug.ActiveCfg = MemtestDebug|Win32
|
||||||
{CDD792EF-ABC5-4C61-803F-616E209C03D6}.JITRelease.Build.0 = JITRelease|Win32
|
{7A2555A6-CBA6-4BD0-96AE-72DA57B995DF}.MemtestDebug.Build.0 = MemtestDebug|Win32
|
||||||
{CDD792EF-ABC5-4C61-803F-616E209C03D6}.MemtestDebug.ActiveCfg = MemtestDebug|Win32
|
{7A2555A6-CBA6-4BD0-96AE-72DA57B995DF}.MemtestRelease.ActiveCfg = MemtestRelease|Win32
|
||||||
{CDD792EF-ABC5-4C61-803F-616E209C03D6}.MemtestDebug.Build.0 = MemtestDebug|Win32
|
{7A2555A6-CBA6-4BD0-96AE-72DA57B995DF}.MemtestRelease.Build.0 = MemtestRelease|Win32
|
||||||
{CDD792EF-ABC5-4C61-803F-616E209C03D6}.MemtestRelease.ActiveCfg = MemtestRelease|Win32
|
{7A2555A6-CBA6-4BD0-96AE-72DA57B995DF}.Release.ActiveCfg = Release|Win32
|
||||||
{CDD792EF-ABC5-4C61-803F-616E209C03D6}.MemtestRelease.Build.0 = MemtestRelease|Win32
|
{7A2555A6-CBA6-4BD0-96AE-72DA57B995DF}.Release.Build.0 = Release|Win32
|
||||||
{CDD792EF-ABC5-4C61-803F-616E209C03D6}.Release.ActiveCfg = Release|Win32
|
|
||||||
{CDD792EF-ABC5-4C61-803F-616E209C03D6}.Release.Build.0 = Release|Win32
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding = "Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="7.00"
|
Version="7.10"
|
||||||
Name="amxmodx_mm"
|
Name="amxmodx_mm"
|
||||||
SccProjectName=""
|
SccProjectName=""
|
||||||
SccLocalPath="">
|
SccLocalPath="">
|
||||||
|
@ -73,8 +73,14 @@
|
||||||
Culture="1033"/>
|
Culture="1033"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"/>
|
Name="VCWebDeploymentTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
|
@ -138,8 +144,14 @@
|
||||||
Culture="1033"/>
|
Culture="1033"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"/>
|
Name="VCWebDeploymentTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="MemtestDebug|Win32"
|
Name="MemtestDebug|Win32"
|
||||||
|
@ -204,8 +216,14 @@
|
||||||
Culture="1033"/>
|
Culture="1033"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"/>
|
Name="VCWebDeploymentTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="MemtestRelease|Win32"
|
Name="MemtestRelease|Win32"
|
||||||
|
@ -269,8 +287,14 @@
|
||||||
Culture="1033"/>
|
Culture="1033"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"/>
|
Name="VCWebDeploymentTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="JITDebug|Win32"
|
Name="JITDebug|Win32"
|
||||||
|
@ -335,8 +359,14 @@
|
||||||
Culture="1033"/>
|
Culture="1033"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"/>
|
Name="VCWebDeploymentTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="JITRelease|Win32"
|
Name="JITRelease|Win32"
|
||||||
|
@ -400,14 +430,37 @@
|
||||||
Culture="1033"/>
|
Culture="1033"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"/>
|
Name="VCWebDeploymentTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
<Files>
|
<Files>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Source Files"
|
Name="Source Files"
|
||||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||||
|
<File
|
||||||
|
RelativePath="..\amx.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\amxcore.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\amxmodx.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\amxtime.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\amxxlog.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\CCmd.cpp">
|
RelativePath="..\CCmd.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
@ -444,21 +497,6 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="..\CVault.cpp">
|
RelativePath="..\CVault.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\amx.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\amxcore.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\amxmodx.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\amxtime.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\amxxlog.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\emsg.cpp">
|
RelativePath="..\emsg.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
@ -536,6 +574,12 @@
|
||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
Filter="h;hpp;hxx;hm;inl">
|
Filter="h;hpp;hxx;hm;inl">
|
||||||
|
<File
|
||||||
|
RelativePath="..\amx.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\amxmodx.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\CCmd.h">
|
RelativePath="..\CCmd.h">
|
||||||
</File>
|
</File>
|
||||||
|
@ -578,12 +622,6 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="..\CVector.h">
|
RelativePath="..\CVector.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\amx.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\amxmodx.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\fakemeta.h">
|
RelativePath="..\fakemeta.h">
|
||||||
</File>
|
</File>
|
||||||
|
|
|
@ -211,6 +211,10 @@ native get_user_index(const name[]);
|
||||||
/* Returns ip. */
|
/* Returns ip. */
|
||||||
native get_user_ip(index,ip[],len, without_port = 0);
|
native get_user_ip(index,ip[],len, without_port = 0);
|
||||||
|
|
||||||
|
/* Returns if the player has the weapon or not in their pev->weapons field.
|
||||||
|
set "setweapon" to 0 to turn the bit off, set to 1 to turn it on. */
|
||||||
|
native has_weapon(index,weapon,setweapon=-1);
|
||||||
|
|
||||||
/* Returns id of currently carried weapon. Gets also
|
/* Returns id of currently carried weapon. Gets also
|
||||||
* ammount of ammo in clip and backpack. */
|
* ammount of ammo in clip and backpack. */
|
||||||
native get_user_weapon(index,&clip,&ammo);
|
native get_user_weapon(index,&clip,&ammo);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user