So, i found this thread:
https://forums.alliedmods.net/showth...ht=Ammo+pickup But it gives not enough information on how to do it, i tried doing what ddhoward said, but i had some problems with returning Plugin_Handled:
PHP Code:
public OnEntityCreated(entity, const String:classname[])
{
if(IsValidEntity(entity))
{
if StrContains(classname, "item_ammopack_full", false) != -1)
{
SDKHook(entity, SDKHook_StartTouch, OnStartTouch);
SDKHook(entity, SDKHook_Touch, OnTouch);
}
}
}
public OnStartTouch(entity, other)
{
if(!(1 <= other <= MaxClients))
return;
if(!IsClientInGame(other))
return;
if(!IsPlayerAlive(other))
return;
new ClientHealth = GetClientHealth(other);
new ClientMaxHealth = GetClientMaxHealth(other);
new index = GetIndexOfWeaponSlot(other, TFWeaponSlot_Melee);
if (index == 404)
if (ClientHealth < ClientMaxHealth)
return Plugin_Handled;
}
public OnTouch(entity, other)
{
if(!(1 <= other <= MaxClients))
return;
if(!IsClientInGame(other))
return;
if(!IsPlayerAlive(other))
return;
new ClientHealth = GetClientHealth(other);
new ClientMaxHealth = GetClientMaxHealth(other);
new index = GetIndexOfWeaponSlot(other, TFWeaponSlot_Melee);
if (index == 404)
if (ClientHealth < ClientMaxHealth)
return Plugin_Handled;
}
PHP Code:
/home/groups/sourcemod/upload_tmp/phpkxUUNu.sp(11) : error 001: expected token: "*then", but found ")"
/home/groups/sourcemod/upload_tmp/phpkxUUNu.sp(11) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/phpkxUUNu.sp(26) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpkxUUNu.sp(27) : warning 209: function "OnStartTouch" should return a value
/home/groups/sourcemod/upload_tmp/phpkxUUNu.sp(36) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpkxUUNu.sp(37) : warning 209: function "OnTouch" should return a value
I wanted to ask them, but the thread is dead and they're all probably dead too.