A bit confused .. ( var1 < var2 && var3 >= 1
#1

le solved
Reply
#2

Not sure it it will solve the problem, but maybe it will.
pawn Код:
if((gPlayerInfo[playerid][gExperience] >= gPlayerInfo[playerid][gNeededExp]) && gPlayerInfo[playerid][gLevel] < 50)
{
    //...
}
else if((gPlayerInfo[playerid][gExperience] < gPlayerInfo[playerid][gNeededExp]) && gPlayerInfo[playerid][gLevel] >= 1)
{
    //...
}
if((var < var) && var >= var)
Reply
#3

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Not sure it it will solve the problem, but maybe it will.
pawn Код:
if((gPlayerInfo[playerid][gExperience] >= gPlayerInfo[playerid][gNeededExp]) && gPlayerInfo[playerid][gLevel] < 50)
{
    //...
}
else if((gPlayerInfo[playerid][gExperience] < gPlayerInfo[playerid][gNeededExp]) && gPlayerInfo[playerid][gLevel] >= 1)
{
    //...
}
if((var < var) && var >= var)
Nope, still the same problem, goes nicely to Level 1(200 Experience needed), but if I then use /giveexp 0 199, it will set the Level to 0 again.

Like, if the NeededExp is more than the Experience in /giveexp(well, the stock), it will level him down
Reply
#4

pawn Код:
else if(gPlayerInfo[playerid][gExperience] < gPlayerInfo[playerid][gNeededExp] && gPlayerInfo[playerid][gLevel] >= 1)
Change this line to the following --
pawn Код:
else if(gPlayerInfo[playerid][gExperience] < 0 && gPlayerInfo[playerid][gLevel] >= 1)
When player experience fall below 0 then he will level down

But your code was if his experience is less than needed experience then he will be level downed
I hope u understand
Reply
#5

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
pawn Код:
else if(gPlayerInfo[playerid][gExperience] < gPlayerInfo[playerid][gNeededExp] && gPlayerInfo[playerid][gLevel] >= 1)
Change this line to the following --
pawn Код:
else if(gPlayerInfo[playerid][gExperience] < 0 && gPlayerInfo[playerid][gLevel] >= 1)
When player experience fall below 0 then he will level down

But your code was if his experience is less than needed experience then he will be level downed
I hope u understand
Okay, thanks that works.
But now another problem I just saw;
When I give someone a negative number of the XP, it still counts up instead of down.
Reply
#6

not sure
but i think there is same message when giving or taking exp so u got confused
so
pawn Код:
else
        {
            format(Text, sizeof(Text), "You've received {FC4949}%d experience!", amount), SendClientMessage(playerid, -1, Text);
            gPlayerInfo[playerid][gExperience] -= amount;
        }
change the above to following
pawn Код:
else
        {
            format(Text, sizeof(Text), "A amount of {FC4949}%d experience was taken from you..", amount), SendClientMessage(playerid, -1, Text);
            gPlayerInfo[playerid][gExperience] -= amount;
        }
Reply
#7

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
not sure
but i think there is same message when giving or taking exp so u got confused
so
pawn Код:
else
        {
            format(Text, sizeof(Text), "You've received {FC4949}%d experience!", amount), SendClientMessage(playerid, -1, Text);
            gPlayerInfo[playerid][gExperience] -= amount;
        }
change the above to following
pawn Код:
else
        {
            format(Text, sizeof(Text), "A amount of {FC4949}%d experience was taken from you..", amount), SendClientMessage(playerid, -1, Text);
            gPlayerInfo[playerid][gExperience] -= amount;
        }
I already changed the text, and yeah, it was a bit confusing too xD
Anyways, here's how I use the stock; ( just a small line )
pawn Код:
if(gPlayerInfo[playerid][gRExperience] >= 50) SendClientMessage(playerid, -1, "Nitestick bought for 50 xp!"), GiveExperience(playerid, -50), gPlayerInfo[playerid][Slot][1] = 1;
But If I use -, it counts it up.

Should I maybe create a "TakeExperience"? ;d

EDIT: Yeah, created a "TakeExperience" and it works now.
Reply
#8

Do u receive the right message?
i mean the exp taken message?
Reply
#9

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
Do u receive the right message?
i mean the exp taken message?
Yeah, but I created a "TakeExperience" and it works.
I guess the problem was the double - sign (-= -amount)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)