[Help] Change Team score values
Hey there guys.
So, i pick this structure up, and i am trying to edit it, but keep it simple, because i'm learning how to script in Pawn and C, and i want to be able to fully understand the source code and what's the function of every piece. So, this piece of code is supposed to make teams play 15 rounds (in total : for example CT: 8 and T: 7) and then swap them. But, what's happening is that the values don't change. So, if i play for the Counter-Terrorist team in the first half, and i win 14 rounds and the Terrorists team only 1, what happens is that when teams swap i am in disavantadge, because the score don't swap to. So, i'm looking in the cstrike func wiki, and can't find a way to swap the scores when teams swap places. PHP Code:
I am terrorist and i win the first half: 14 - 1; When teams are swaped, scores are resetted to : 0 - 0; When i am in CT (the second half), would it take only two rounds to win? Sorry if this is confusing, and thanks for your help in advance. </span></span> |
Re: [Help] Change Team score values
Don't use get_players() with "e" flag, it is has a bug (I believe it's explained in amxmodx.org), use instead only with flag h (skip HLTV) and in the loop check what's the players team.
To save the scores, I think that there is no function to retrieve team scores. So, you'll have to register TeamScore event and save the score to a global variable. Then you can check each round if a team has reached max wins. |
Re: [Help] Change Team score values
Quote:
get_players with the "e" flag is perfectly fine to use if used with another flag that verifies their status (such as "a" - alive). An update (of the last code I showed you - in this thread) to suite your current problem: Code:
|
Re: [Help] Change Team score values
Cool how you did that with your comments Xellath! :)
|
Re: [Help] Change Team score values
I agree. That was super helpful!
|
Re: [Help] Change Team score values
Xellath,
Working flawlessly this time. Thank you very much, once again! Sorry to insist in this topic, but i think that you guys understand the difficulties of finding some workarounds when we are new to scripting. Thanks again, and yes, the job with the comments it's perfect, because it helps me to understand what's the function of everything. Cheers mate. P.S. - By the way, is it possible to, just by executing a server command, change the map to the next one registered in the mapcycle? It was suppose to work that way with the mp_winlimit "16", but i don't know why, it's not. |
Re: [Help] Change Team score values
Saw a minor typo in the Swap() function. Forgot to increment the player index. Fixed.
Glad my comments are helping you guys! :) |
Re: [Help] Change Team score values
@Xellath: That code would work well if there aren't too many people on the server. I'd have some problems with switching everybody's teams when there are 32 people on the server (the server crashes). The only ways I know to fix them are to either delay the team switches (1-8 go 0.1 seconds after change, 9-17 go 0.2 seconds after, 18-24 go 0.3 seconds after, and 24-32 go 0.4 seconds after) OR you can use this module: http://forums.alliedmods.net/showthread.php?t=163555
|
Re: [Help] Change Team score values
Quote:
Quote:
|
Re: [Help] Change Team score values
Nbanow requested a "live" - "warmup" version of the code I posted above - so here it is.
Code:
|
| All times are GMT -4. The time now is 08:24. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.