AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Simple Question! (https://forums.alliedmods.net/showthread.php?t=134575)

GXLZPGX 08-06-2010 15:01

Simple Question!
 
#1: When registering Ham_Killed, I want it to display a chat message, but still show who was killed. For example:

PHP Code:

if( cs_get_user_team(iVictim) == CS_TEAM_T && cs_get_user_team(iAttacker) == CS_TEAM_CT )
{
     
client_printidprint_chat"Bool1 = true!" )
     return 
PLUGIN_HANDLED;


Since I have return PLUGIN_HANDLED, it wont display at the top right that the CT killed the T. It will only display the message.

What should I return so it will display the message, but the plugin wont execute passed that if statement.

Emp0wer 08-06-2010 15:07

Re: Simple Question!
 
return;
or
return PLUGIN_CONTINUE;

YamiKaitou 08-06-2010 15:09

Re: Simple Question!
 
In a Ham forward, don't use the PLUGIN_* return values, use the HAM_* ones. Same with Fakemeta.

wrecked_ 08-06-2010 16:43

Re: Simple Question!
 
HAM_IGNORED would be the most suitable return value in your case.

You seem to have issues with return values, so here they are:
Code:
// Hamsandwich // 0 is also interpreted as HAM_IGNORED #define HAM_IGNORED     1   /**< Calls target function, returns normal value */ #define HAM_HANDLED     2   /**< Tells the module you did something, still calls target function and returns normal value */ #define HAM_OVERRIDE    3   /**< Still calls the target function, but returns whatever is set with SetHamReturn*() */ #define HAM_SUPERCEDE   4   /**< Block the target call, and use your return value (if applicable) (Set with SetHamReturn*()) */ // Fakemeta #define FMRES_IGNORED   1   // Calls target function, returns normal value #define FMRES_HANDLED   2   // Tells metamod you did something, still calls target function and returns normal value #define FMRES_OVERRIDE  3   // Supposed to still call the target function but return your value instead                             // however this does not work properly with metamod; use supercede instead. #define FMRES_SUPERCEDE 4   // Block the target call, and use your return value (if applicable) // Engine+Others #define PLUGIN_CONTINUE     0   /* Results returned by public functions */ #define PLUGIN_HANDLED      1   /* stop other plugins */ #define PLUGIN_HANDLED_MAIN 2   /* to use in client_command(), continue all plugins but stop the command */

EDIT: Technically, returning PLUGIN_CONTINUE in your case would have the same effect as HAM_IGNORED, since 0 is also interpreted as HAM_IGNORED and PLUGIN_CONTINUE is defined as 0. You should still use these return values with their corresponding module forward.


All times are GMT -4. The time now is 00:11.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.