Warning for adding +4 for Player's Variable
#1

I got a warning for this

pawn Код:
-Code Removed -
Warning:
Код:
E:\San Andreas Multiplayer Server Files (Classified)\Castaway Island Roleplay\gamemodes\CI-RP.pwn(1936) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Anyone know how to fix this ?
Reply
#2

pawn Код:
CMD:levelup(playerid, params[])
{
    new str[64];
    if(PlayerInfo[playerid][Exp] >= PlayerInfo[playerid][Expt])
    {
        PlayerInfo[playerid][Exp] = 0;
        PlayerInfo[playerid][Expt] += 4;
        PlayerInfo[playerid][Level] ++;
        SendClientMessage(playerid, -1, "You've reached to a new level");
    }
    else
    {
        format(str, sizeof(str), "You need %d Experience Points inorder to Level up", PlayerInfo[playerid][Expt]);
        SendClientMessage(playerid, COL_RED, "You need %d Experience Points inorder to Level up");
    }
    return 1;
}
Reply
#3

You can't do something like that. Do it like -
pawn Код:
var += 4;
EDIT:A bit late.
Reply
#4

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
pawn Код:
-Code Removed -
Gosh, silly me. Anyway Thanks
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
Doing:

pawn Код:
a + 4;
Has no effect, that's a sum but you do nothing with the result. It's like doing:

pawn Код:
8 + 4;
That doesn't change the value of 8, it just creates s new number, but nowhere do you store that new number.
O.... I understand now. Thanks for the explanation.
Reply


Forum Jump:


Users browsing this thread: