Raised This Month: $ Target: $400
 0% 

SaveScore plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Swisa
Senior Member
Join Date: Nov 2010
Location: Israel
Old 10-01-2011 , 15:34   SaveScore plugin
Reply With Quote #1

I thought about a new plugin server.
I have SCORE PLUGIN.
And I want to add such a thing.
If one of the groups reach 16 victories.
So it's only open to PRINT CHAT ADMIN and writes: "If you want to save score. Type !Save tagA tagB."
And that opens a file .txt or all file directory called MATCHS Configs.
Flat has

TIME: DATE: SCORE: TEAMS

Governor of today's date is: 09/26/2011 and time 18:02

Game 1:
Map:
09/26/2011 - 18:02
SCORE: TagA - 16 TagB-8
Swisa is offline
Send a message via Skype™ to Swisa
enjoi.
Veteran Member
Join Date: Mar 2011
Old 10-01-2011 , 19:33   Re: SaveScore plugin
Reply With Quote #2

how can we add shit if we have no sma. and why did you make 2 threads
__________________
Block Maker v6.0 []
Point Slay v3.0 []
Contact [ PM ]
enjoi. is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 10-02-2011 , 09:28   Re: SaveScore plugin
Reply With Quote #3

Seems like he want it done for him.
Post in request section if so
Erox902 is offline
Swisa
Senior Member
Join Date: Nov 2010
Location: Israel
Old 10-02-2011 , 10:51   Re: SaveScore plugin
Reply With Quote #4

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike> 

#define PLUGIN "Score"
#define VERSION "1.0"
#define AUTHOR "Swisa"

#define MR 15
#define TIE_MR 3

new CTScore 0
new TScore 0
new Old_AScore 0
new Old_BScore 0
new AScore 0
new BScore 0
new Half 0
new CT 'a'
new live 0

new HalfNames[4][32] = { "1st""2nd""MR3-1st""MR3-2nd" }

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
//register_concmd("say !Swap", "swap_teams", ADMIN_SLAY, "")
    
register_concmd("say !Start""start_game"ADMIN_SLAY"")
    
register_concmd("say !Live""start_game"ADMIN_SLAY"")
    
register_concmd("say !RR 1""restart_game"ADMIN_SLAY"")
    
register_concmd("say !Stop""stop_game"ADMIN_SLAY"")
    
register_concmd("say_team !Start""start_game"ADMIN_SLAY"")
    
register_concmd("say_team !Live""start_game"ADMIN_SLAY"")
    
register_concmd("say_team !Stop""stop_game"ADMIN_SLAY"")
    
register_concmd("say /Score""say_score"_"")
    
register_concmd("say !Score""say_score"_"")
    
register_concmd("say_team /Score""say_score"_"")
    
register_concmd("say_team !Score""say_score"_"")
    
register_event("SendAudio""t_win""a""2&%!MRAD_terwin")
    
register_event("SendAudio""ct_win""a""2&%!MRAD_ctwin")
    
register_event("TextMsg""restart_attempt""a""2=#Game_will_restart_in")
}

public 
swap_teams(idlevelcid) {
    if (!
cmd_access(idlevelcid1)) return PLUGIN_CONTINUE
    
    swap
()
    
set_cvar_num("sv_restart"1)
    return 
PLUGIN_CONTINUE
}

public 
say_score(idlevelcid) {
    if (
Half != 0ssay_score()
    else 
client_print(0print_chat"(Score) The game is no running, to run game type !start.")
    return 
PLUGIN_CONTINUE
}

public 
stop_game(idlevelcid) { 
    if (!
cmd_access(idlevelcid1)) return PLUGIN_CONTINUE
    
    Half 
0live 0;
    
client_print(0print_chat"(Score) Game has been stopped!")
    
server_cmd("exec prac.cfg")
    return 
PLUGIN_CONTINUE
}

public 
restart_game(idlevelcid) {
    if (!
cmd_access(idlevelcid1)) return PLUGIN_CONTINUE
    
    set_cvar_num
("sv_restart"1)
    if (
live == && Half 0client_print(0print_chat"(Score) Game is restarting...")
    return 
PLUGIN_CONTINUE
}

public 
start_game(idlevelcid) {
    if (!
cmd_access(idlevelcid1)) return PLUGIN_CONTINUE

    
if (Half == 0) {
        if (
cs_get_user_team(id) == CS_TEAM_CTCT 'a' 
        
else CT 'b'
    
        
Half 1
        Old_AScore 
0Old_BScore 0;
        
client_print(0print_chat"(Score) %s Half has been started! Live in 3 seconds..."HalfNames[Half -1])
        
server_cmd("exec mr15.cfg")
    }
    else {
        if (
live == 0) {
            if (
CT == 'a'CT 'b'
            
else CT 'a'
            
            
client_print(0print_chat"(Score) %s Half has been started! Live in 3 seconds..."HalfNames[Half -1])
        }
        else 
client_print(0print_chat"(Score) %s Half has been restarted! Live in 3 seconds..."HalfNames[Half -1])
        
    }
    
    
restart_attempt()
    
set_cvar_num("sv_restart"3)
    
live 1;
    return 
PLUGIN_CONTINUE
}

public 
round_end() {
    if (
Half == || live == 0) return
    if (
CT == 'a') { AScore CTScoreBScore TScore; }
    else { 
AScore TScoreBScore CTScore; }
    
    if (
Half == 1) {
        
ssay_score()
        if (
AScore BScore == MR) {
            
client_print(0print_chat"(Score) First half has ended.")
            
Old_AScore AScoreOld_BScore BScore;
            
Half++; live 0
            
            
swap()
            
restart_attempt()
            
set_cvar_num("sv_restart"1)
        }
    }
    else if (
Half == 2) {
        
ssay_score()
        if (
AScore Old_AScore == MR 1) {
            
client_print(0print_chat"(Score) The home team has won the game!")
            
server_cmd("exec prac.cfg")
            
Half 0live 0;
        }
        else if (
BScore Old_BScore == MR 1) { 
            
client_print(0print_chat"(Score) The guest team has won the game!")
            
server_cmd("exec prac.cfg")
            
Half 0live 0;
        }
        else if (
AScore Old_AScore BScore Old_BScore == MR 2) {
            
client_print(0print_chat"(Score) Its a tie, to start a MR3 use !live to end use !stop.")
            
server_cmd("exec mr3.cfg")
            
Old_AScore MROld_BScore MR//To be sure :|
            
Half++; live 0;
            
            
swap()
            
restart_attempt()
            
set_cvar_num("sv_restart"1)
        }
    }
    else if (
Half == 3) {
        
ssay_score()
        if (
AScore BScore == TIE_MR) {
            
client_print(0print_chat"(Score) MR3-1st half has ended.")
            
Old_AScore += AScoreOld_BScore += BScore;
            
Half++; live 0;
            
            
swap()
            
restart_attempt()
            
set_cvar_num("sv_restart"1)
        }
    }
    else if (
Half == 4) {
        
ssay_score()
        if (
AScore Old_AScore == MR TIE_MR 1) {
            
client_print(0print_chat"(Score) The home team has won the game!")
            
server_cmd("exec prac.cfg")
            
Half 0live 0;
        }
        else if (
BScore Old_BScore == MR TIE_MR 1) { 
            
client_print(0print_chat"(Score) The guest team has won the game!")
            
server_cmd("exec prac.cfg")
            
Half 0live 0;
        }
        else if (
AScore Old_AScore BScore Old_BScore == (MR TIE_MR) * 2) {
            
client_print(0print_chat"(Score) Game ended with a tie!")
            
Half 0live 0;
        }    
    }
}

public 
swap() {
    
set_cvar_num("mp_limitteams"0)
    
set_cvar_num("mp_autoteambalance"0)
    
    new 
Players[32], PlayerCounti
    get_players
(PlayersPlayerCount"")
    
    for (
0PlayerCounti++) {
        if (
cs_get_user_team(Players[i]) != CS_TEAM_SPECTATOR  &&  is_user_connected(Players[i])) {
            if (
cs_get_user_team(Players[i]) == CS_TEAM_CTcs_set_user_team(Players[i], CS_TEAM_T
            else 
cs_set_user_team(Players[i], CS_TEAM_CT)
        }
    }
}

public  
ssay_score() { client_print(0print_chat"(Score) Score is - Home team: %d, Guest team: %d, Half: %s"Old_AScore AScoreOld_BScore BScoreHalfNames[Half -1]); }
public 
t_win() { TScore++; round_end(); }
public 
ct_win() { CTScore++; round_end(); }
public 
restart_attempt() { CTScore 0TScore 0AScore 0BScore 0; } 
Swisa is offline
Send a message via Skype™ to Swisa
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 10-02-2011 , 11:26   Re: SaveScore plugin
Reply With Quote #5

Quote:
Originally Posted by Erox902 View Post
Seems like he want it done for him.
Post in request section if so
Read, think, repeat

PHP Code:
if ( Understood )
{
     
post_in_request
}
else
{
     
repeat

Erox902 is offline
Swisa
Senior Member
Join Date: Nov 2010
Location: Israel
Old 10-02-2011 , 12:42   Re: SaveScore plugin
Reply With Quote #6

Do not you see I already have there, do not help ...
I want the formula, how to write in a file with the parameters.
Swisa is offline
Send a message via Skype™ to Swisa
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 10-03-2011 , 02:46   Re: SaveScore plugin
Reply With Quote #7

Ok then I'll just give you a hint that might help you: write_file
However never needed to save to a file so I'm not sure this is the best option.
Erox902 is offline
Swisa
Senior Member
Join Date: Nov 2010
Location: Israel
Old 10-03-2011 , 07:57   Re: SaveScore plugin
Reply With Quote #8

Look what I wrote: There are some things I do not know: 1: I do !Save it saves on the same line again, which means it does not come off line and continues the details again.
2. I do not know how to count to play: that is how many games we played.

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"




public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd("say !save","Currentime"ADMIN_SLAY"")
    
register_concmd("say_team !save","Currentime"ADMIN_SLAY"")
}

public 
Currentime (idlevelcid)
{
    if (!
cmd_access(idlevelcid1)) return PLUGIN_CONTINUE
    
new CurrentTime[31
    new 
mapname[31]
    new 
text[256]
    new 
g_szMapCfgFile[256]
    new 
szConfigsDir[64]

    
get_configsdir(szConfigsDircharsmax(szConfigsDir))
    
formatex(g_szMapCfgFilecharsmax(g_szMapCfgFile), "%s/matchs"szConfigsDir)
    if( !
dir_exists(g_szMapCfgFile) )
    {
        
mkdir(g_szMapCfgFile)
    }
    
get_mapname(mapname31)
    
get_time("%m/%d/%Y - %H:%M:%S",CurrentTime,31)
    new 
fp fopen("addons/amxmodx/configs/matchs/matches.txt""wt")
    
fprintf(fp"Game Number: %s.^nMap: %s.^nTime and DATE: %s."mapnameCurrentTime)
    
fclose(fp)


Swisa is offline
Send a message via Skype™ to Swisa
Swisa
Senior Member
Join Date: Nov 2010
Location: Israel
Old 10-11-2011 , 07:36   Re: SaveScore plugin
Reply With Quote #9

up
Swisa is offline
Send a message via Skype™ to Swisa
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:40.


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