SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 26/05/2010, 08:33 PM   #1
bartje01
High-roller
 
Join Date: Jan 2009
Posts: 1,419
Reputation: 6
Default Payday problem

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:
Code:
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

bartje01 is offline  
Old 26/05/2010, 08:39 PM   #2
Joe_
Gangsta
 
Join Date: Mar 2010
Location: UK, Essex
Posts: 516
Reputation: 1
Default Re: Payday problem

pawn Code:
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.

http://wiki.sa-mp.com/wiki/Control_Structures#Operators
__________________
I'm coding a from scratch roleplay server, it's called Stanoplo Gaming.
If you want to try out a new roleplay server, follow my development at:

http://www.stanopolo.com/forum/index.php
Joe_ is offline  
Old 26/05/2010, 08:41 PM   #3
bartje01
High-roller
 
Join Date: Jan 2009
Posts: 1,419
Reputation: 6
Default Re: Payday problem

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.
bartje01 is offline  
Old 26/05/2010, 08:48 PM   #4
Joe_
Gangsta
 
Join Date: Mar 2010
Location: UK, Essex
Posts: 516
Reputation: 1
Default Re: Payday problem

pawn Code:
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.
__________________
I'm coding a from scratch roleplay server, it's called Stanoplo Gaming.
If you want to try out a new roleplay server, follow my development at:

http://www.stanopolo.com/forum/index.php
Joe_ is offline  
Old 26/05/2010, 08:49 PM   #5
bartje01
High-roller
 
Join Date: Jan 2009
Posts: 1,419
Reputation: 6
Default Re: Payday problem

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.
bartje01 is offline  
Old 26/05/2010, 08:55 PM   #6
bartje01
High-roller
 
Join Date: Jan 2009
Posts: 1,419
Reputation: 6
Default Re: Payday problem

Still doesn't work.
bartje01 is offline  
Old 26/05/2010, 08:56 PM   #7
Joe_
Gangsta
 
Join Date: Mar 2010
Location: UK, Essex
Posts: 516
Reputation: 1
Default Re: Payday problem

I don't know, if you still have the problem I will help you tomorrow, I'm off now lol, sorry.
__________________
I'm coding a from scratch roleplay server, it's called Stanoplo Gaming.
If you want to try out a new roleplay server, follow my development at:

http://www.stanopolo.com/forum/index.php
Joe_ is offline  
Old 26/05/2010, 08:58 PM   #8
bartje01
High-roller
 
Join Date: Jan 2009
Posts: 1,419
Reputation: 6
Default Re: Payday problem

haha ok :PO no problem mate. Thanks for helping
bartje01 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Payday problem. oliverrud Help Archive 9 25/06/2010 02:39 AM
Help! payday Awerop Help Archive 1 18/02/2010 03:35 AM
Payday help wordas Help Archive 6 21/12/2009 12:10 PM
Payday problem anumaz Help Archive 6 04/07/2009 12:12 AM
Payday Problem leon_sharped Help Archive 4 07/02/2009 05:30 PM


All times are GMT. The time now is 09:14 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.