PDA

View Full Version : Server name during clan war Dod 1.3


Relaxen
02-25-2008, 09:59 AM
Hey everybody,

Is there a plugin existing which changes the name of the server during a clan war and let appear the results/points and updates them regulary ?


Example: Server name during a clan war:

[-GAIA-] vs #Eus || 567 - 103 || a few seconds after
[-GAIA-] vs #Eus || 610 - 107 || and finally at the end
[-GAIA-] vs #Eus || Win - Loss||




And it updates every minute. So that everybody can see ho is winning at the moment.
I think I saw this plugin already a long time ago.

I hope somebody could help me :)

Ps: Sorry for my n00b english...

Wilson [29th ID]
02-25-2008, 11:25 AM
You'd have to hook the TeamScore message. I wrote a tutorial on hooking and altering network messages on these forums. Just hook them and client_print them so you see what they are. Reason I'm suggesting this is I'm not sure how the message works.

It's got two arguments,
Arg 1: Byte (usually value is 1 or 2)
Arg 2: Short (usually value is 0 but sometimes 2 or 3)

I don't know what these arguments are. One is probably the team...it seems the message is sent when the team scores and the scoreboard "adds to itself" to determine the total score.

Anyway, once you figure out how the message works you'd just change the cvar "hostname" to include the score.

Quite simple once you figure out how the msg works.

Relaxen
02-25-2008, 01:26 PM
Quite simple once you figure out how the msg works.

I don't figure out how it works :( The message you wrote is like chinese for me :D
I know nothing about coding. The only thing I can do is install plugins...and may be doing some binds.
I thought for the server name I should incert like these coded messages for score like %s or something like that...

Sorry...can you give me some other advices please it would be really nice

Wilson [29th ID]
02-25-2008, 01:36 PM
I don't figure out how it works :( The message you wrote is like chinese for me :D
I know nothing about coding. The only thing I can do is install plugins...and may be doing some binds.

Then read (http://dodplugins.net/forums/showthread.php?t=717). Follow the tutorial and play around with it. If you don't understand the results, post the results and we'll look at them. If ya want something done you gotta at least put some effort into it.

EDIT: Here, use this..


public plugin_init() {
register_message( get_user_msgid("TeamScore"), "msg_TeamScore" );
}

public msg_TeamScore() {
new arg1 = get_msg_arg_int(1);
new arg2 = get_msg_arg_int(2);
for( new i=1; i<=32; i++ )
if( is_user_connected(i) ) client_print( i, print_chat, "[TeamScore] %i - %i", arg1, arg2 );
}


That should display the arguments - you have to match them up to the events.

For instance, when allies cap a flag, it might say [TeamScore] 1 - 1...when allies cap the middle "big flag" that requires two people it might say 1 - 2...when axis cap a flag it might say 2 - 1. Who knows. Post your results and what happened each time the msg was echod and we'll take a look.

Relaxen
02-25-2008, 03:05 PM
If i understood good i have to make of your little code an Amxx plugin ?

I tried with Amxx Studio :



/* Plugin generated by AMXX-Studio */

#include <amxmodx>

public plugin_init() {
register_message( get_user_msgid("TeamScore"), "msg_TeamScore" );
}

public msg_TeamScore() {
new arg1 = get_msg_arg_int(1);
new arg2 = get_msg_arg_int(2);
for( new i=1; i<=32; i++ )
if( is_user_connected(i) ) client_print( i, print_chat, "[TeamScore] %i - %i", arg1, arg2 );
}
return PLUGIN_CONTINUE
}

I transformed it into an .sma file then I wanted to compile it here --->

http://www.amxmodx.org/webcompiler.cgi


And I got this error :
Your plugin failed to compile! Read the errors below:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/home/groups/amxmodx/tmp3/phpaj9PdN.sma(16) : error 010: invalid function or declaration

1 Error.
Could not locate output file /home/groups/amxmodx/public_html/websc3/phpaj9PdN.amx (compile failed).

345623 successful compiles to date.
197764 failed compiles to date.
Old compiler: 101980 compiles before decommission.
This tool by: David "BAILOPAN" Anderson.

Errors I think I did:
1. Maybe i have done everything wrong i did not need to make a plugin I just needed to right something little in the server console ...

or

2. Or a simple code error an little " , ( ; ] , { or %...because I don't know anything about coding.
3. Or one of the others thousands of errors I could possibly do :D

Wilson [29th ID]
02-25-2008, 08:35 PM
return PLUGIN_CONTINUE

}

???

You added that. I didn't put that at the end.

Relaxen
02-26-2008, 07:48 AM
Ok it worked :D

The results in the console:
1st TEST on AXIS map: flash

Axis has already 2 flags and allies also

Round start without taking a flag:
[TeamScore] 1 - 0
[TeamScore] 2 - 0
[TeamScore] 1 - 0
[TeamScore] 2 - 0

3rd Flag Middle

[TeamScore] 2 - 1

4th Flag

[TeamScore] 2 - 2

5th Flag

[TeamScore] 2 - 3

Full Cap

[TeamScore] 2 - 53
[TeamScore] 1 - 0
[TeamScore] 2 - 53
[TeamScore] 1 - 0
[TeamScore] 2 - 53

2nd TEST on AXIS map: Anzio

[TeamScore] 1 - 0
[TeamScore] 2 - 4
[TeamScore] 1 - 0
[TeamScore] 2 - 4

Disembark and prepare for the attack!

[TeamScore] 2 - 5

[-GAIA-]*Relaxen* captured the hill for the Axis


[TeamScore] 2 - 7

[-GAIA-]*Relaxen* captured the plaza for the Axis

[TeamScore] 2 - 9

[-GAIA-]*Relaxen* captured the bridge for the Axis
[TeamScore] 2 - 10

[-GAIA-]*Relaxen* captured the street for the Axis

[TeamScore] 2 - 11

[-GAIA-]*Relaxen* captured the laundry for the Axis

[TeamScore] 2 - 61
[TeamScore] 1 - 0
[TeamScore] 2 - 61
[TeamScore] 1 - 0
[TeamScore] 2 - 61
[TeamScore] 1 - 0
[TeamScore] 2 - 61

Disembark...

Wilson [29th ID]
02-26-2008, 07:25 PM
so obviously arg1 is the team and arg2 is the score. so you'd have to update the string each time you receive the message.

Relaxen
02-26-2008, 07:41 PM
so you'd have to update the string each time you receive the message.

What should I do now....or can't I continue with my knowhow ?

Ps: My knowhow = 0.00 :D

Wilson [29th ID]
02-27-2008, 10:41 AM
New plugin from scratch:

1. Create a global variable called scores[2]. This is a two line array - line 0 will contain allies score and line 1 will contain axis score.

2. Hook the TeamScore message like I did above.

3. In the teamscore_hook function, do a simple test and update the global variable with the new scores. For example,

if arg1 = 1 (allies), set scores[0] = arg2
else if arg1 = 2 (axis), set scores[1] = arg2

4. In the teamscore_hook function, just after you set the global variables, you will update the server name by updating the cvar "hostname"

new newname[32]
format( newname, 31, "My Server (Allies: %i - Axis: %i)", score[0], score[1] )
set_cvar_string( "hostname", newname )

done

Relaxen
02-27-2008, 01:32 PM
Ehm...

I just do replace the servername by this?

new newname[32]
format( newname, 31, "My Server (Allies: %i - Axis: %i)", score[0], score[1] )
set_cvar_string( "hostname", newname )

And how to create a global variable ?

public plugin_init() {
register_message( get_user_msgid("TeamScore"), "msg_TeamScore" );
}

public msg_TeamScore() {
new arg1 = 1 (allies), set scores[0](1);
new arg2 = 2 (axis), set scores[1](2);
for( new i=1; i<=32; i++ )
if( is_user_connected(i) ) client_print( i, print_chat, "[TeamScore] %i - %i", arg1, arg2 );
}

?

But does it take the clan tag in consideration ?

[-GAIA-] vs #Eus || 567 - 103 || can't it just take the information from ClanMatch ?

Relaxen
03-02-2008, 07:38 PM
? Is there anybody here to help me?

Wilson [29th ID]
03-03-2008, 07:59 PM
i'll get to it be patient

Wilson [29th ID]
03-04-2008, 08:56 AM
I was hoping you'd read some scripting tutorials and actually do some of the coding yourself. That's the best way to learn....


#include <amxmodx>
#include <dodx>

// Declare the global variable
new scores[2];

// Change this quoted string to how you want your server name to be
new const servername[64] = "My Server (Allies: %i - Axis: %i)";

public plugin_init() {
register_message( get_user_msgid("TeamScore"), "msg_TeamScore" );
}

public msg_TeamScore() {
// Read the hooked message
new arg1 = get_msg_arg_int(1);
new arg2 = get_msg_arg_int(2);

// Store the score from the message in the global variable
if( arg1 == ALLIES ) scores[0] = arg2;
else if( arg1 == AXIS ) scores[1] = arg2;

// Set the server name to include the updated global variable data
new newname[32]
format( newname, 31, servername, scores[0], scores[1] )
set_cvar_string( "hostname", newname )
}

snake26
09-11-2010, 01:23 PM
link download plugin????

please :)