Question help
#1

hej there
i was hoping if anyone from u help me out with this it might be easy but idk how

i have a system where player can collect money from the house
now what i want is something which shows for example a textdraw "Collecting : x amount"
i can make the textdraw but i dont know how to make the other part for example Collecting : 310 and it keeps updating by second 330 - 340 etc till the end
can you show me something ?
Reply
#2

PHP код:
format(collectstringsizeof(collectstring), "Collecting : %d"Collecting[playerid]); 
Reply
#3

you didnt get me
this is the amount the player can collect
Код:
new collectamount= dini_Int(tmpf, "cancollect") / 5;
this is an X amount for example 30000

this is time that player has to wait to collect it all
Код:
 robtimer= dini_Int(tmpf, "cancollect") / 3000;
now what i want is to set a player amount that is collecting during this time
The player has to collect 30000$ for 3 minutes lets say

player can collect X amount per second so it will fill up 30000$ at the end of time
Reply
#4

I did get you, but now you're simply wanting more.

This is scripting help, not script for you.


The only thing you have is an idea, and a maximum value... You actually don't have any other code at all do you....
Reply
#5

well i asked if you could give me an example not script it for me
and i used them just to show you what i meant not tell you to do it for me
Reply
#6

pawn Код:
((earnings * (gettime() - timestamp)) / time_to_wait))
Reply
#7

i made this
new collecting = 0;
collecting = collectamount /5 + robtimer / 60000;
then amount shows okay
but it doesnt get upgraded for second
it only stays the start amount
Reply
#8

pawn Код:
((total_money_you_can_get_during_the_time_you_set * (gettime() - the_gettime_function_since_you_last_gotten_the_money)) / the_total_time_you_have_to_wait))
Validate timestamps and check if the time hasn't passed, if it has, give them the total money they can get within that time.

And thanks for ignoring me trying to help you, I appreciate it.
Reply
#9

i putted it but when it starts to collect it goes - x then after a x amount of time has passed it goes + ...
Reply
#10

This is what I mean, you haven't got the code required. You're going to need a timer, that covers updating the collection, and in that can also be the updating of the string that covers the textdraw.

PHP код:
format(collectstringsizeof(collectstring), "Collecting : %d"Collecting[playerid]); 
You will NEED collecting to be an array, otherwise only one person will have this, or, the same value will be shown to all.


Just beware, that usually when people request help in this manner, with the "examples" keyword, they actually have no code.



A tick timer, of 1 second, counting the collection up, and making the change to the textdraw string is what you need.

SickAttack has some bits for you as well. It won't count as such. It will, if the result from it is checked inside a timer.

Using a ticktimer, and simply counting up, is a simple method. The tick timer would be a script wide one, going through all players, and it should check if the player is collecting, and change the Collecting[playerid] accordingly.



Something which you may benefit from is the Turf system tutorials.

One that does cover a timer is https://sampforum.blast.hk/showthread.php?tid=467604 . The ZonesUpdate function, instead of looking at players, looks at zones. You'd need to remember that when looking at it, and make a similar function (Don't copy paste, use it as an example to show a for loop, and how to condition check for the collector) that covers the players instead.

You will get there, just make some portions of code, and show you can understand for loops, and timers.

Once you get those portions understood, things will become a lot easier for you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)