Score doesn't Upgrade..
#1

Hello guys,

I made a zombie vs survivors Gamemode,

But, i have one problem;

So, the issue's when i scripted the : Zombie score : and Survivors Score :

It doesn't upgrade when a survivor kill a zombie..

I'll show you my codes,

The textdraws :

PHP код:
TDMTD[0] = TextDrawCreate(17.000000431.000000"Team Survivants :");
    
TextDrawBackgroundColor(TDMTD[0], 255);
    
TextDrawFont(TDMTD[0], 1);
    
TextDrawLetterSize(TDMTD[0], 0.5000001.000000);
    
TextDrawColor(TDMTD[0], -1);
    
TextDrawSetOutline(TDMTD[0], 0);
    
TextDrawSetProportional(TDMTD[0], 1);
    
TextDrawSetShadow(TDMTD[0], 1);
    
TextDrawUseBox(TDMTD[0], 1);
    
TextDrawBoxColor(TDMTD[0], -2139062102);
    
TextDrawTextSize(TDMTD[0], 650.000000, -89.000000);
    
TDMTD[1] = TextDrawCreate(169.000000431.000000"0");
    
TextDrawBackgroundColor(TDMTD[1], 255);
    
TextDrawFont(TDMTD[1], 1);
    
TextDrawLetterSize(TDMTD[1], 0.5000001.000000);
    
TextDrawColor(TDMTD[1], 65535);
    
TextDrawSetOutline(TDMTD[1], 0);
    
TextDrawSetProportional(TDMTD[1], 1);
    
TextDrawSetShadow(TDMTD[1], 1);
    
TDMTD[2] = TextDrawCreate(401.000000430.000000"Team Zombie:");
    
TextDrawBackgroundColor(TDMTD[2], 255);
    
TextDrawFont(TDMTD[2], 1);
    
TextDrawLetterSize(TDMTD[2], 0.5000001.000000);
    
TextDrawColor(TDMTD[2], 1433087914);
    
TextDrawSetOutline(TDMTD[2], 0);
    
TextDrawSetProportional(TDMTD[2], 1);
    
TextDrawSetShadow(TDMTD[2], 1);
    
TDMTD[3] = TextDrawCreate(523.000000431.000000"0");
    
TextDrawBackgroundColor(TDMTD[3], 255);
    
TextDrawFont(TDMTD[3], 1);
    
TextDrawLetterSize(TDMTD[3], 0.5000001.000000);
    
TextDrawColor(TDMTD[3], 16711935);
    
TextDrawSetOutline(TDMTD[3], 0);
    
TextDrawSetProportional(TDMTD[3], 1);
    
TextDrawSetShadow(TDMTD[3], 1); 
the stock for updating the "0" score:
PHP код:
stock TextUpd() {
    new 
SurvivantText[20],ZombieText[20];
    
format(SurvivantText,sizeof(SurvivantText),"%d",SurvivantScore);
    
format(ZombieText,sizeof(ZombieText),"%d",ZombieScore);
    
TextDrawSetString(TDMTD[1], SurvivantText);
    
TextDrawSetString(TDMTD[3], ZombieText);

The OnPlayerDeath :

PHP код:
if(gTeam[killerid] == TEAM_SURVIVANT || gTeam[playerid] == TEAM_ZOMBIE)SurvivantScore++;
    if(
gTeam[killerid] == TEAM_ZOMBIE|| gTeam[playerid] == TEAM_SURVIVANT)ZombieScore++; 
The stock of ending :

PHP код:
stock TdmEnd() {
    new 
string[64];
    if(
SurvivantScore ZombieScore) {
            
formatstringsizeof(string), "~b~Les Survivants ~g~gagnent");
            
GameTextForAll(string50005);
            
TdmEndTime TDM_TIME;
            
SurvivantScore 0;
            
ZombieScore 0;
            
TextUpd();
            foreach(
Playeri) {
                if(
gTeam[i] == TEAM_SURVIVANTPlayerPlaySound(iWIN_SOUND0.00.00.0);
                else if(
gTeam[i] == TEAM_ZOMBIEPlayerPlaySound(ilOSE_SOUND0.00.00.0);
            } 
Help ? :S
Reply
#2

If I am correct, and I am not sure I am, you have to hide and re-show the textdraw.
Reply
#3

Hum.. Pretty sure.. ?
Reply
#4

You have made a function for the update textdraw score.

The problem is, you used that function when the Round Ends, You should at least put it somewhere which is a timer (repeating one), so that the textdraw updates.
Reply
#5

First off you don't need to re-show textdraws when updating the text.
Furthermore you shouldn't need a timer for this either.

Call the TextUpd() function on OnPlayerDeath and it should update.

Also, I think this:

Код:
if(gTeam[killerid] == TEAM_SURVIVANT || gTeam[playerid] == TEAM_ZOMBIE)SurvivantScore++;
    if(gTeam[killerid] == TEAM_ZOMBIE|| gTeam[playerid] == TEAM_SURVIVANT)ZombieScore++;
should be this:

Код:
if(gTeam[killerid] == TEAM_SURVIVANT && gTeam[playerid] == TEAM_ZOMBIE)SurvivantScore++;
    if(gTeam[killerid] == TEAM_ZOMBIE && gTeam[playerid] == TEAM_SURVIVANT)ZombieScore++;
It works correctly but it would also count teamkills and killing teamless players.
Reply
#6

In OnPlayerDeath,

It's already Defined :

if(Team[killerid] == 1|| Team[playerid] == 2)SurvivantScore++;
if(Team[killerid] == 2|| Team[playerid] == 1)ZombieScore++;
TextUpd();
Reply
#7

Anyone ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)