PDA

View Full Version : AcceptEntityInput with an argument?


Dr. McKay
02-03-2012, 17:11
I know that you can use AcceptEntityInput(entity, "Disable") to disable an entity. Is there any way to use AcceptEntityInput or similar in a way that you can use an argument? For instance, to call the SetLocked input on a team_control_point and set it to 1?

Tylerst
02-03-2012, 17:19
Use SetVariantX(X being Int Sttring Float, etc) before using accept entity input.

Check the API Here (http://docs.sourcemod.net/api/index.php?fastload=file&id=43) for the SetVariant things.

Example: Using the team_round_timer to add 2 minutes:


new entity = FindEntityByClassname(-1, "team_round_timer");
SetVariantInt(120);
AcceptEntityInput(entity, "AddTime");


Sometimes you may also need to set a keyvalue, which is done with DispatchKeyValue (http://docs.sourcemod.net/api/index.php?fastload=show&id=47)(or DispatchKeyValueFloat (http://docs.sourcemod.net/api/index.php?fastload=show&id=48), DispatchKeyValueVector (http://docs.sourcemod.net/api/index.php?fastload=show&id=49))

Example: Forcing a team(in this case red) to win the game


new entity = FindEntityByClassname(-1, "game_round_win");
DispatchKeyValue(entity, "TeamNum", TFTeam_Red);
AcceptEntityInput(entity, "RoundWin");

Dr. McKay
02-03-2012, 17:29
Use SetVariantX(X being Int Sttring Float, etc) before using accept entity input.

Check the API Here (http://docs.sourcemod.net/api/index.php?fastload=file&id=43) for the SetVariant things.

Example: Using the team_round_timer to add 2 minutes:


new entity = FindEntityByClassname(-1, "team_round_timer");
SetVariantInt(120);
AcceptEntityInput(entity, "AddTime");


Sometimes you may also need to set a keyvalue, which is done with DispatchKeyValue (http://docs.sourcemod.net/api/index.php?fastload=show&id=47)(or DispatchKeyValueFloat (http://docs.sourcemod.net/api/index.php?fastload=show&id=48), DispatchKeyValueVector (http://docs.sourcemod.net/api/index.php?fastload=show&id=49))

Example: Forcing a team(in this case red) to win the game


new entity = FindEntityByClassname(-1, "game_round_win");
DispatchKeyValue(entity, "TeamNum", TFTeam_Red);
AcceptEntityInput(entity, "RoundWin");


Nice, thanks!