Payday problem
#1

Hey guys. I've got a little script for a payday.
This is what actualy must happen:

Every 60 seconds now. Will be an hour after it works though.
You will get 1 exp.
After 5 exp you will get +1score.
Then your exp has to set to 0 again too.

This is my script:
Код:
public PayDay()
{
  for(new i = 0; i < GetMaxPlayers(); i++)
  {
    if(IsPlayerConnected(i))
    {
      if(PlayerInfo[i][Exp] >= 6)
      {
      PlayerInfo[i][Exp] += 1;
      	GameTextForPlayer(i,"PayDay",1000,1);
      	}
      	else
      	{
      	if(PlayerInfo[i][Exp] >= 5)
      	SetPlayerScore(i,GetPlayerScore(i)+1);
      	PlayerInfo[i][Exp] = 0;
      	}
    }
}
}
My problem:
The +1 exp is coming . that is working.
But after I have 5 exp my exp is still growing t0 6 then 7 then 8 then 9 etc.
And I don't get +1 score.
So actualy the only thing that works is that I get +1 exp.
Please somenoe fix it for me.

thanks

Reply
#2

pawn Код:
public PayDay()
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][Exp] != 5)
{
PlayerInfo[i][Exp] += 1;
GameTextForPlayer(i,"PayDay",1000,1);
return 1;
}
SetPlayerScore(i,GetPlayerScore(i)+1);
PlayerInfo[i][Exp] = 0;
}
}
}
}
I don't understand why you were checking if EXP was more or equals 6 when it can never be 6, because when it hits 5, it resets?
Anyway, that code should work.

https://sampwiki.blast.hk/wiki/Control_Structures#Operators
Reply
#3

Well joe. I want to have it that when the exp is 5 or higher the exp points will reset and the score will be +1.
It is really not working. I tested it.
Reply
#4

pawn Код:
public PayDay()
{
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][Exp] != 5)
            {
                PlayerInfo[i][Exp] += 1;
                GameTextForPlayer(i,"PayDay",1000,1);
                return 1;
            }
            else
            {
                SetPlayerScore(i,GetPlayerScore(i)+1);
                PlayerInfo[i][Exp] = 0;
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
Sorry, I'm not testing, I'm just working off logic in code only lol, so excuse me if it don't work first time.

I am checking if exp does not equal ( != ) 5 and if it doesn't equal 5, exp goes up
otherwise if the does not equal 5 check returns 0 (exp is 5) you will get +1 score and it will reset EXP.
Reply
#5

Alright I will text it. And you really don't have to appologize that you didn't test it.
You are taking time for me to make this and I really think that is just great.
I'll post if it works.
Reply
#6

Still doesn't work.
Reply
#7

I don't know, if you still have the problem I will help you tomorrow, I'm off now lol, sorry.
Reply
#8

haha ok :PO no problem mate. Thanks for helping
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)