Warning
#1

I have this warnings:
Код:
C:\Users\Mihnea\Desktop\BloodZone\gamemodes\BloodZone.pwn(32002) : warning 213: tag mismatch
C:\Users\Mihnea\Desktop\BloodZone\gamemodes\BloodZone.pwn(32002) : warning 206: redundant test: constant expression is non-zero
The Line 32002 is this:
Код:
if(total > 0)
Te All script is:
Код:
if(PlayerInfo[playerid][pLevel] >= 0)
				{
					new nxtlevel = PlayerInfo[playerid][pLevel];
					new costlevel = nxtlevel*levelcost;//10k for testing purposes
					new expamount = nxtlevel*levelexp;
					new infostring[256];
					if(GetPlayerCash(playerid) < costlevel)
					{
						format(infostring, 256, "You do not have enough Cash ($%d) !",costlevel);
						SendClientMessage(playerid, COLOR_GRAD1, infostring);
						return 1;
					}
					else if (PlayerInfo[playerid][pExp] < expamount)
					{
						format(infostring, 256, "You need %d Respect Points, you curently have [%d] !",expamount,PlayerInfo[playerid][pExp]);
						SendClientMessage(playerid, COLOR_GRAD1, infostring);
						return 1;
					}
					else
					{
						format(string, sizeof(string), "~g~LEVEL UP~n~~w~You Are Now Level %d", nxtlevel);
						PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
						PlayerPlayMusic(playerid);
						GivePlayerCash(playerid, (-costlevel));
						PlayerInfo[playerid][pLevel]++;
						if(PlayerInfo[playerid][pDonateRank] > 0)
						{
						    PlayerInfo[playerid][pExp] -= expamount;
//						    new total = PlayerInfo[playerid][pExp];
						    if(total > 0)
						    {
						        PlayerInfo[playerid][pExp] = total;
						    }
						    else
						    {
						        PlayerInfo[playerid][pExp] = 0;
						    }
						}
						else
						{
							PlayerInfo[playerid][pExp] = 0;
						}
						PlayerInfo[playerid][gPupgrade] = PlayerInfo[playerid][gPupgrade]+2;
						GameTextForPlayer(playerid, string, 5000, 1);
						format(infostring, 256, "You bought Level %d for ($%d) Type /upgrade", nxtlevel, costlevel);
						SendClientMessage(playerid, COLOR_GRAD1, infostring);
						format(infostring, 256, "You gave %d unspent Upgrade Points",PlayerInfo[playerid][gPupgrade]);
						SendClientMessage(playerid, COLOR_GRAD2, infostring);
					}
				}
				return 1;
			}
can someone help me pls?
Reply
#2

Change if(total > 0) to if(total)
Reply
#3

warning: tag mismatch resolved !
But still having this: warning 206: redundant test: constant expression is non-zero
Reply
#4

Quote:
Originally Posted by ventilator1
Посмотреть сообщение
warning: tag mismatch resolved !
But still having this: warning 206: redundant test: constant expression is non-zero
Try doing
Код:
new total;  
total = PlayerInfo[playerid][pExp]; 
Then you can use if(total > 0)
Reply
#5

ERROR: error 022: must be lvalue (non-constant)
Reply
#6

'total' is defined as a macro or a constant somewhere, which means its value can never be changed during runtime. It is also the source of the earlier warning. It would essentially be doing something similar to:
pawn Код:
if(1000 > 0)
Which will always be true and which is therefore redundant.
Reply
#7

And i must write this: if(1000 > 0) ??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)