AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [CS] Which team won? (get at end of round) *SOVED* (https://forums.alliedmods.net/showthread.php?t=98673)

MrOpposite 07-27-2009 18:13

[CS] Which team won? (get at end of round) *SOVED*
 
This is my second question, now I created a bet-script, so it works as it should when you place the bets.

But then I went into a problem. When the round ends, I'd like to know which team won, CT or T. I haven't found a function for this. This is the last thing I need to know before finishing the script :D

EDIT:
I got the round change using this:
PHP Code:

register_event("HLTV","roundchange","a"); 

If that helps...

Arkshine 07-27-2009 18:24

Re: [CS] Which team won? (get at end of round)
 
One way :

Code:
register_event( "SendAudio", "Event_TerrorstWin", "a", "2&%!MRAD_terwin" ); register_event( "SendAudio", "Event_CTWin", "a", "2&%!MRAD_ctwin"  );

or

Code:
register_event( "TextMsg", "Event_TerroristWin", "a", "2=#Terrorists_Win" ); register_event( "TextMsg", "Event_CTWin", "a", "2=#CT_Win" );

MrOpposite 07-27-2009 18:26

Re: [CS] Which team won? (get at end of round)
 
I'll use that for now, but on certain mods the audio is disabled, and the "Counter-Terrorist wins" (nor the "Terrorist wins") sound is not played. (I'd like this to be compatible with as many mods as possible :P)

hleV 07-27-2009 18:44

Re: [CS] Which team won? (get at end of round)
 
You can do that with messages (messages are called before the events) and put plugin's name above the custom plugin names in plugins.ini.
Code:
#include <amxmodx>   public plugin_init()         register_message(get_user_msgid("TextMsg"), "TextMsg");   public TextMsg() {         new Text[32];         get_msg_arg_string(2, Text, 31);           if (equal(Text, "#Terrorists_Win"))         {                 // Terrorists have won         }         else if (equal(Text, "#CTs_Win"))         {                 // CTs have won         }         else if (equal(Text, "#Round_Draw")) // Should work         {                 // Round draw         } }

MrOpposite 07-27-2009 18:47

Re: [CS] Which team won? (get at end of round)
 
Ok, thanks you two, But I ran into a problem... What about "round draw"? Whats the sound thingi for that?

TitANious 07-27-2009 18:53

Re: [CS] Which team won? (get at end of round)
 
He edited

MrOpposite 07-27-2009 18:59

Re: [CS] Which team won? (get at end of round)
 
Oh I see, Thanks all. Now I think the script is working perfectly! (Gonna test it along with a zombie-mod to see if it works)

The only thing left to do is commenting, (I haven't got the habit of doing that when scripting, I do it after :P)

TitANious 07-27-2009 19:04

Re: [CS] Which team won? (get at end of round)
 
kk, are you going to release it?

Arkshine 07-27-2009 19:07

Re: [CS] Which team won? (get at end of round)
 
Log event ( I would not use register_message )

Code:
register_logevent( "Event_CTWin"       , 6, "3=CTs_Win"       , "3=All_Hostages_Rescued" ); register_logevent( "Event_TerroristWin", 6, "3=Terrorists_Win", "3=Target_Bombed" );

MrOpposite 07-28-2009 04:37

Re: [CS] Which team won? (get at end of round)
 
Quote:

Originally Posted by TitANious (Post 883408)
kk, are you going to release it?

Yes, when I've tested it some more with my friends... When I test it myself I only get "Round Draw" and that works... But the other events are untested

Quote:

Originally Posted by Arkshine (Post 883410)
Log event ( I would not use register_message )

Code:
register_logevent( "Event_CTWin"       , 6, "3=CTs_Win"       , "3=All_Hostages_Rescued" ); register_logevent( "Event_TerroristWin", 6, "3=Terrorists_Win", "3=Target_Bombed" );

Oh, that would be awesome, is it possible to remove "3=Target_Bombed" and "3=All_Hostages_Rescued" to make it trigger for CT victory when the bomb is not blown, or all T are killed?


All times are GMT -4. The time now is 18:23.

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