Raised This Month: $12 Target: $400
 3% 

x number of times per day


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 02-24-2012 , 04:01   x number of times per day
Reply With Quote #1

I would like to know if its possible to do something like this :

[Person A] can slap [Person B] 10 times per day , then the next day he can slap person B 10 times again , point me in the right direction ... what sort of commands should i use? get_time()?

any help will be appreciated , thank you ^.^
EpicMonkey is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 02-24-2012 , 04:28   Re: x number of times per day
Reply With Quote #2

You need something to store which person can slap which.
And you need to use something like get_date().
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 02-24-2012 , 04:52   Re: x number of times per day
Reply With Quote #3

i already have stored which person can slap which
EpicMonkey is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 02-24-2012 , 04:52   Re: x number of times per day
Reply With Quote #4

Quote:
Originally Posted by EpicMonkey View Post
i already have stored which person can slap which
Then you also store how much times one person has slaped the other one.
And get the date in order to check the day.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 02-24-2012 at 04:53.
ot_207 is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 02-24-2012 , 05:25   Re: x number of times per day
Reply With Quote #5

tried ... but couldnt O.o

Last edited by EpicMonkey; 02-24-2012 at 10:33.
EpicMonkey is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-24-2012 , 20:39   Re: x number of times per day
Reply With Quote #6

Quote:
Originally Posted by EpicMonkey View Post
tried ... but couldnt O.o
Well, it might help us help you if you post your code to see if it's even possible with your current method.

Post the code after you tried to add this suggestion.
__________________
fysiks is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 02-25-2012 , 02:29   Re: x number of times per day
Reply With Quote #7

well what i thought of was

First i try to make it 5 minutes per 10 slap , after 5 minutes has passed he can slap 10 times again

PHP Code:
client_putinserver(id)
{
    if( 
get_gametime() > 300.0)
    {
        
g_slap[id] = g_slap[id] + 10
    
}

then in the slap menu , if g_slap[id] > 0
slap the selected player

but after 5 minutes my g_slap[id] is still 0 ...


I was also thinking of doing something like this :
saving his g_slap[id] in nvault

client_putinserver : if it is a new day , g_slap[id] = g_slap[id] + 10 , but if it is the same day load his g_slap[id] from nvault

also if player disconnect , save g_slap[id]

Would this work?

Last edited by EpicMonkey; 02-25-2012 at 02:33.
EpicMonkey is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 02-25-2012 , 02:31   Re: x number of times per day
Reply With Quote #8

if( get_gametime() > 300.0)
->
if( g_slap <= get_gametime() )

g_slap[id] = g_slap[id] + 10
->
g_slap[id] = get_gametime() + 300
__________________
You can do anything you set your mind to, man.


Last edited by Devil259; 02-25-2012 at 02:32.
Devil259 is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 02-25-2012 , 03:38   Re: x number of times per day
Reply With Quote #9

Quote:
Originally Posted by Devil259 View Post
if( get_gametime() > 300.0)
->
if( g_slap <= get_gametime() )

g_slap[id] = g_slap[id] + 10
->
g_slap[id] = get_gametime() + 300
what is it that you are doing?
EpicMonkey is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 02-25-2012 , 04:20   Re: x number of times per day
Reply With Quote #10

Try to imagine what the code does.

Code:
if( g_slap[ id ] <= get_gametime( ) ) // if the g_slap var is less or equal to get_gametime( ) (actual time) {     // do something     g_slap[ id ] = get_gametime( ) + 60; // set the var on actual time + 60 seconds (60 seconds to wait }
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Reply


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

Forum Jump


All times are GMT -4. The time now is 01:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode