SA-MP Forums Archive
hello help me with Team Score Textdraw - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: hello help me with Team Score Textdraw (/showthread.php?tid=454970)



hello help me with Team Score Textdraw - Xoomer - 31.07.2013

this showing me errors


Code
Код:
error 022: must be lvalue (non-constant)
 warning 215: expression has no effect
 warning 202: number of arguments does not match definition
 error 022: must be lvalue (non-constant)
 warning 215: expression has no effect
this is the code


error line 1476
pawn Код:
TEAM_ZOMBIE++; //Sets team1score
error line 1478
pawn Код:
GetPlayerScore(playerid, TEAM_ZOMBIE);
error line 1484
pawn Код:
TEAM_HUMAN++; //Sets team2score

pawn Код:
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    if(GetPlayerTeam(killerid) == 0)
    {
        TEAM_ZOMBIE++; //Sets team1score
        new newtext[41];
        GetPlayerScore(playerid, TEAM_ZOMBIE);
        format(newtext, sizeof(newtext), "ZOMBIE: %d",  TEAM_ZOMBIE);
        TextDrawSetString(Textdraw, newtext);
    }
    if(GetPlayerTeam(killerid) == 1)
    {
        TEAM_HUMAN++; //Sets team2score
        new newtext[41];
        format(newtext, sizeof(newtext), "HUMAN: %d", TEAM_HUMAN);
        TextDrawSetString(Textdraw1, newtext);
    }



Re: hello help me with Team Score Textdraw - [HiC]TheKiller - 31.07.2013

I take it TEAM_ZOMBIE and TEAM_HUMAN are just defines? If they are, you're not actually able to do what you're doing. Defines define a specific term to a value. What you want is a variable which you can change the values to:
pawn Код:
new TEAM_HUMAN_SCORE, TEAM_ZOMBIE_SCORE;
Then instead, do this:
pawn Код:
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    if(GetPlayerTeam(killerid) == 0)
    {
        TEAM_ZOMBIE_SCORE++; //Sets team1score
        new newtext[41];
        format(newtext, sizeof(newtext), "ZOMBIE: %d",  TEAM_ZOMBIE_SCORE);
        TextDrawSetString(Textdraw, newtext);
    }
    if(GetPlayerTeam(killerid) == 1)
    {
        TEAM_HUMAN_SCORE++; //Sets team2score
        new newtext[41];
        format(newtext, sizeof(newtext), "HUMAN: %d", TEAM_HUMAN_SCORE);
        TextDrawSetString(Textdraw1, newtext);
    }



Re: hello help me with Team Score Textdraw - dEcooR - 31.07.2013

and now if you will able to define it and use new..

you can use also this i guess

Код:
if(GetPlayerTeam(killerid) == TEAM_BLABLA)