formula -
rumen98 - 13.05.2014
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??
Re: formula -
RajatPawar - 13.05.2014
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;
}
Re: formula -
rumen98 - 13.05.2014
Quote:
Originally Posted by RajatPawar
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*1000, false);
Re: formula -
Madd92 - 13.05.2014
Quote:
Originally Posted by rumen98
How can I use this code in addition to my timer?
PHP Code:
SetTimer("StartScavenging", 180*1000, false);
|
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
Re: formula -
rumen98 - 13.05.2014
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?
AW: formula -
Nero_3D - 13.05.2014
Well just do
pawn Code:
SetTimer("StartScavenging", GetPlayerSearchTime(playerid) * 1000, false);
Re: formula -
rumen98 - 13.05.2014
thanks
Re: formula -
Madd92 - 13.05.2014
Quote:
Originally Posted by rumen98
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?
Re: formula -
rumen98 - 13.05.2014
Timer is individual for each player is not mass