View Single Post
Misterrr
New Member
Join Date: Jan 2017
Old 07-03-2017 , 23:50   Re: Problem with hooked fuction
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
You should be using MRES_IGNORED in both cases.

See https://forums.alliedmods.net/showthread.php?t=297857.
I did as you advised, but the server still crashes, the hook works, but the original function with the new parameter is not called. what should I do? I just need to replace the file name with another file name and call the open function so that it continues working

PHP Code:
FileHandle_t SamplePlugin::Hook_Open(const char *pFileName, const char *pOptions, const char *pathID) {
   if(
strncmp(pFileName"materials/headshot1.vtf"strlen("materials/headshot1.vtf")) == 0) {
         
META_LOG(g_PLAPI"yeaaa opening headshot file \"%s\",pOptions \"%s\",pathID \"%s\"."pFileNamepOptionspathID);
          
RETURN_META_VALUE_NEWPARAMS(MRES_IGNOREDNULL, &IBaseFileSystem::Open, ("materials/headshot2.vtf"pOptionspathID));
   }
RETURN_META_VALUE(MRES_IGNOREDfalse);

Misterrr is offline