Skip to content
This repository was archived by the owner on Oct 30, 2019. It is now read-only.

Commit 3eced34

Browse files
CleversonCleverson
authored andcommitted
Fixed type names for functions
Also made a fix to stop pug with correct number of minimum players
1 parent d9b1625 commit 3eced34

File tree

1 file changed

+40
-41
lines changed

1 file changed

+40
-41
lines changed

addons/amxmodx/scripting/PugCore.sma

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ public plugin_init()
7878

7979
g_tReconnect = TrieCreate();
8080

81-
register_concmd("say","HandleSay");
82-
register_concmd("say_team","HandleSay");
81+
register_concmd("say","fnHandleSay");
82+
register_concmd("say_team","fnHandleSay");
8383

84-
PugRegisterCommand("help","CommandHelp",ADMIN_ALL,"PUG_DESC_HELP");
85-
PugRegisterAdminCommand("help","CommandHelpAdmin",PUG_CMD_LVL,"PUG_DESC_HELP");
84+
PugRegisterCommand("help","fnHelp",ADMIN_ALL,"PUG_DESC_HELP");
85+
PugRegisterAdminCommand("help","fnAdminHelp",PUG_CMD_LVL,"PUG_DESC_HELP");
8686

87-
PugRegisterCommand("status","CommandStatus",ADMIN_ALL,"PUG_DESC_STATUS");
88-
PugRegisterCommand("score","CommandScore",ADMIN_ALL,"PUG_DESC_SCORE");
87+
PugRegisterCommand("status","fnStatus",ADMIN_ALL,"PUG_DESC_STATUS");
88+
PugRegisterCommand("score","fnScore",ADMIN_ALL,"PUG_DESC_SCORE");
8989

90-
PugRegisterAdminCommand("pugstart","CommandStart",PUG_CMD_LVL,"PUG_DESC_START");
91-
PugRegisterAdminCommand("pugstop","CommandStop",PUG_CMD_LVL,"PUG_DESC_STOP");
90+
PugRegisterAdminCommand("pugstart","fnStart",PUG_CMD_LVL,"PUG_DESC_START");
91+
PugRegisterAdminCommand("pugstop","fnStop",PUG_CMD_LVL,"PUG_DESC_STOP");
9292

9393
g_iEventWarmup = CreateMultiForward("PugEventWarmup",ET_IGNORE,FP_CELL);
9494
g_iEventStart = CreateMultiForward("PugEventStart",ET_IGNORE,FP_CELL);
@@ -117,7 +117,7 @@ public plugin_end()
117117
{
118118
if(STAGE_FIRSTHALF <= g_iStage <= STAGE_OVERTIME)
119119
{
120-
PugEnd(GetWinner());
120+
PugEnd(fnGetWinner());
121121
}
122122

123123
TrieDestroy(g_tReconnect);
@@ -214,7 +214,7 @@ public client_authorized(id)
214214

215215
public client_disconnected(id,bool:bDrop,szMessage[],iLen)
216216
{
217-
new bool:bSendDrop = false;
217+
new bool:bSendDrop = false;
218218

219219
if(equali(szMessage,"Client sent 'drop'") || equali(szMessage,"Timed out") /*ALT+F4 user too*/)
220220
{
@@ -238,9 +238,9 @@ public client_disconnected(id,bool:bDrop,szMessage[],iLen)
238238
{
239239
new iPlayersMin = get_pcvar_num(g_pPlayersMin);
240240

241-
if(PugGetPlayers(1) <= (iPlayersMin / 2))
241+
if(PugGetPlayers(1) < (iPlayersMin / 2))
242242
{
243-
PugEnd(GetWinner());
243+
PugEnd(fnGetWinner());
244244

245245
return PLUGIN_CONTINUE;
246246
}
@@ -251,8 +251,7 @@ public client_disconnected(id,bool:bDrop,szMessage[],iLen)
251251

252252
if(iBanTime > 0)
253253
{
254-
server_cmd("banid %d #%d",iBanTime,get_user_userid(id));
255-
server_cmd("writeid");
254+
server_cmd("banid %i #%d;writeid",iBanTime,get_user_userid(id));
256255
server_exec();
257256
}
258257
}
@@ -261,7 +260,7 @@ public client_disconnected(id,bool:bDrop,szMessage[],iLen)
261260
return PLUGIN_CONTINUE;
262261
}
263262

264-
public HandleSay(id)
263+
public fnHandleSay(id)
265264
{
266265
new sArgs[192];
267266
read_args(sArgs,charsmax(sArgs));
@@ -389,12 +388,12 @@ public CoreEnd(id,iParms)
389388

390389
public PugEventEnd(iWinner)
391390
{
392-
PugDisplayScores(0,"PUG_END_WONALL");
391+
fnDisplayScores(0,"PUG_END_WONALL");
393392

394-
set_task(get_pcvar_float(g_pHandleTime),"CoreResetGame",g_pHandleTime);
393+
set_task(get_pcvar_float(g_pHandleTime),"fnResetGame",g_pHandleTime);
395394
}
396395

397-
public CoreResetGame()
396+
public fnResetGame()
398397
{
399398
g_iStage = STAGE_DEAD;
400399

@@ -553,13 +552,13 @@ public PugEventRoundEnd(iStage) /* THIS IS A FIX FOR LAST ROUND PROBLEM */
553552
{
554553
g_iScores[g_iRoundWinner]++;
555554

556-
HandleRound();
555+
fnHandleRound();
557556

558557
g_iRound++;
559558
}
560559
}
561560

562-
public HandleRound()
561+
fnHandleRound()
563562
{
564563
new iRoundsTotal = get_pcvar_num(g_pRoundsMax);
565564

@@ -573,14 +572,14 @@ public HandleRound()
573572
}
574573
else
575574
{
576-
PugDisplayScores(0,"PUG_SCORE_WINNING");
575+
fnDisplayScores(0,"PUG_SCORE_WINNING");
577576
}
578577
}
579578
case STAGE_SECONDHALF:
580579
{
581-
if(PugCheckScore(iRoundsTotal / 2) || (g_iRound >= iRoundsTotal))
580+
if(fnCheckScore(iRoundsTotal / 2) || (g_iRound >= iRoundsTotal))
582581
{
583-
new iWinner = GetWinner();
582+
new iWinner = fnGetWinner();
584583

585584
if(iWinner)
586585
{
@@ -600,7 +599,7 @@ public HandleRound()
600599
}
601600
else
602601
{
603-
PugDisplayScores(0,"PUG_SCORE_WINNING");
602+
fnDisplayScores(0,"PUG_SCORE_WINNING");
604603
}
605604
}
606605
case STAGE_OVERTIME:
@@ -615,9 +614,9 @@ public HandleRound()
615614
{
616615
PugHalfTime();
617616
}
618-
else if(PugCheckOvertimeScore((iStoreOTRounds / 2),(iRoundsTotal / 2),iStoreOTRounds) || !iOTRounds)
617+
else if(fnCheckOvertimeScore((iStoreOTRounds / 2),(iRoundsTotal / 2),iStoreOTRounds) || !iOTRounds)
619618
{
620-
new iWinner = GetWinner();
619+
new iWinner = fnGetWinner();
621620

622621
if(iWinner)
623622
{
@@ -630,13 +629,13 @@ public HandleRound()
630629
}
631630
else
632631
{
633-
PugDisplayScores(0,"PUG_SCORE_WINNING");
632+
fnDisplayScores(0,"PUG_SCORE_WINNING");
634633
}
635634
}
636635
}
637636
}
638637

639-
public PugDisplayScores(id,sMethod[])
638+
fnDisplayScores(id,sMethod[])
640639
{
641640
new sCurrentScore[PUG_MAX_TEAMS],iTopTeam = 0;
642641
new sTeam[64],sFinishedScores[PUG_MAX_TEAMS * 5];
@@ -651,7 +650,7 @@ public PugDisplayScores(id,sMethod[])
651650
sCurrentScore[i] = g_iScores[i];
652651
}
653652

654-
if(GetWinner())
653+
if(fnGetWinner())
655654
{
656655
formatex(sTeam,charsmax(sTeam),"%L",LANG_SERVER,sMethod,g_sTeams[iTopTeam]);
657656
}
@@ -677,7 +676,7 @@ public PugDisplayScores(id,sMethod[])
677676
}
678677
}
679678

680-
GetWinner()
679+
fnGetWinner()
681680
{
682681
new iWinner = 1,iTied;
683682
new iScoreA,iScoreB;
@@ -706,7 +705,7 @@ GetWinner()
706705
return iWinner;
707706
}
708707

709-
PugCheckScore(iValue)
708+
fnCheckScore(iValue)
710709
{
711710
for(new i = 1;i <= g_iTeams;i++)
712711
{
@@ -720,7 +719,7 @@ PugCheckScore(iValue)
720719
}
721720

722721

723-
PugCheckOvertimeScore(iCheck,iSub,iModulo)
722+
fnCheckOvertimeScore(iCheck,iSub,iModulo)
724723
{
725724
new iTempScore;
726725

@@ -738,7 +737,7 @@ PugCheckOvertimeScore(iCheck,iSub,iModulo)
738737
return 0;
739738
}
740739

741-
public CommandStatus(id)
740+
public fnStatus(id)
742741
{
743742
if(id)
744743
{
@@ -776,11 +775,11 @@ public CommandStatus(id)
776775
return PLUGIN_HANDLED;
777776
}
778777

779-
public CommandScore(id)
778+
public fnScore(id)
780779
{
781780
if(STAGE_FIRSTHALF <= g_iStage <= STAGE_OVERTIME)
782781
{
783-
PugDisplayScores(id,"PUG_SCORE_WINNING");
782+
fnDisplayScores(id,"PUG_SCORE_WINNING");
784783
}
785784
else
786785
{
@@ -790,7 +789,7 @@ public CommandScore(id)
790789
return PLUGIN_HANDLED;
791790
}
792791

793-
public CommandHelp(id)
792+
public fnHelp(id)
794793
{
795794
new sDir[64];
796795
PugGetConfigsDir(sDir,charsmax(sDir));
@@ -804,7 +803,7 @@ public CommandHelp(id)
804803
return PLUGIN_HANDLED;
805804
}
806805

807-
public CommandHelpAdmin(id,iLevel)
806+
public fnAdminHelp(id,iLevel)
808807
{
809808
if(access(id,PUG_CMD_LVL) && (id != 0))
810809
{
@@ -819,13 +818,13 @@ public CommandHelpAdmin(id,iLevel)
819818
}
820819
else
821820
{
822-
CommandHelp(id);
821+
fnHelp(id);
823822
}
824823

825824
return PLUGIN_HANDLED;
826825
}
827826

828-
public CommandStart(id)
827+
public fnStart(id)
829828
{
830829
if(access(id,PUG_CMD_LVL) && (id != 0))
831830
{
@@ -842,14 +841,14 @@ public CommandStart(id)
842841
return PLUGIN_HANDLED;
843842
}
844843

845-
public CommandStop(id)
844+
public fnStop(id)
846845
{
847846
if(access(id,PUG_CMD_LVL) && (id != 0))
848847
{
849848
new sCommand[16];
850849
read_argv(0,sCommand,charsmax(sCommand));
851850

852-
PugAdminCommand(id,sCommand,"PUG_FORCE_END",PugEnd(GetWinner()));
851+
PugAdminCommand(id,sCommand,"PUG_FORCE_END",PugEnd(fnGetWinner()));
853852
}
854853
else
855854
{

0 commit comments

Comments
 (0)