formula
#1

Hello, can I have some help so
RLTnfo [playerid] [Scavenge] it is a skill every level down 3% from the time of the search (which is 3 minutes (180 seconds)) how do I make the formula to calculate how long to cut the whole time searching for example if the level of my skill is 5 which is 15%.
How can I make my example, decreased time of 180 seconds - 15% of the time??
Reply
#2

Wait, what? I have no idea what you're saying, but I am going to have a go -

pawn Code:
GetPlayerSearchTime(playerid)
{
      new pLevel = RLTnfo[playerid][Scavenge],
             percent = ( pLevel * 3 ),
               totalTime = floatround((180 - ( (percent * 180) / 100 )));
     
      printf("Level: %d || Percent: %d%% || Searchtime (reduced): %d seconds", pLevel, percent, totalTime);

      return totalTime;
}
Reply
#3

Quote:
Originally Posted by RajatPawar
View Post
Wait, what? I have no idea what you're saying, but I am going to have a go -

pawn Code:
GetPlayerSearchTime(playerid)
{
      new pLevel = RLTnfo[playerid][Scavenge],
             percent = ( pLevel * 3 ),
               totalTime = floatround((180 - ( (percent * 180) / 100 )));
     
      printf("Level: %d || Percent: %d%% || Searchtime (reduced): %d seconds", pLevel, percent, totalTime);

      return totalTime;
}
How can I use this code in addition to my timer?
PHP Code:
SetTimer("StartScavenging"180*1000false); 
Reply
#4

Quote:
Originally Posted by rumen98
View Post
How can I use this code in addition to my timer?
PHP Code:
SetTimer("StartScavenging"180*1000false); 
And I guess that's the part where we don't know anymore what you want to do xD
At least for me it is. Please try to be a bit more explainatory
Reply
#5

How can I add code to the timer means by level of RLTnfo [playerid] [Scavenge] + entire formula to reduce the timer according to the result?
Reply
#6

Well just do
pawn Code:
SetTimer("StartScavenging", GetPlayerSearchTime(playerid) * 1000, false);
Reply
#7

thanks
Reply
#8

Quote:
Originally Posted by rumen98
View Post
How can I add code to the timer means by level of RLTnfo [playerid] [Scavenge] + entire formula to reduce the timer according to the result?
If you wanted to reduce the timer you'd have to kill the existant one an set a new timer. For that you have to save the return value of SetTimer in order to being able to kill it later on. But I don't think that's what you want. The question is, what does the timer do? It executes the search? Then just use the function by RajatPawar:
pawn Code:
SetTimer("StartScavenging", GetPlayerSearchTime(playerid)*1000, false);
when setting the timer in general.
Of course you should use SetTimerEx then as you are going to have more than one person searching right?
Reply
#9

Timer is individual for each player is not mass
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)