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

Make sound not play so often


Post New Thread Reply   
 
Thread Tools Display Modes
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 04-26-2023 , 08:36   Re: Make sound not play so often
Reply With Quote #11

enjoy

PHP Code:
public client_putinserver(id)
{
    static 
iTimestampiWaitNext
    
    iTimestamp 
get_systime()
    
    if(
iWaitNext iTimestamp
    {
        
iWaitNext iTimestamp 30
        
        ExecuteFuction
(id)
    }
}

public 
ExecuteFuction(id)
{
    
client_cmd(0"spk buttons/bell1")

__________________
mlibre is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 04-26-2023 , 09:43   Re: Make sound not play so often
Reply With Quote #12

Quote:
Originally Posted by mlibre View Post
enjoy

PHP Code:
public client_putinserver(id)
{
    static 
iTimestampiWaitNext
    
    iTimestamp 
get_systime()
    
    if(
iWaitNext iTimestamp
    {
        
iWaitNext iTimestamp 30
        
        ExecuteFuction
(id)
    }
}

public 
ExecuteFuction(id)
{
    
client_cmd(0"spk buttons/bell1")

Mate.. ExecuteFunction doesn’t need to be public
Sorry, couldn’t resist
__________________
Jhob94 is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 04-26-2023 , 11:31   Re: Make sound not play so often
Reply With Quote #13

Quote:
Originally Posted by Jhob94 View Post
Mate.. ExecuteFunction doesn’t need to be public
Sorry, couldn’t resist
without warning me
Code:
Symbol is never used: "id"
the @ omits this, how curious really

PHP Code:
@ExecuteFuction(id
__________________
mlibre is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-26-2023 , 19:05   Re: Make sound not play so often
Reply With Quote #14

Don't use the @ symbol, fix your problem correctly. If you're not going to use the argument, it should be removed. If you're going to use the argument then you need to use it in the code.

IIRC, the @ symbol also makes the function public.
__________________

Last edited by fysiks; 04-26-2023 at 19:05.
fysiks is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 04-27-2023 , 11:21   Re: Make sound not play so often
Reply With Quote #15

clear it's just a sample in case you want to add other extra natives

hey potter, you mean stock in that way
__________________
mlibre is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 04-27-2023 , 14:20   Re: Make sound not play so often
Reply With Quote #16

I mean private. That function is internal so you don’t have to use public. You can even make it a bool like:
Code:
bool:MyPrivateFunction(id)
{
if(get_user_health(id) > 50) return true

return false
}
That’s probably something you will never use but yeah
__________________

Last edited by Jhob94; 04-27-2023 at 14:22.
Jhob94 is offline
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 04-28-2023 , 13:03   Re: Make sound not play so often
Reply With Quote #17

Quote:
Originally Posted by mlibre View Post
or

PHP Code:
public client_putinserver(id)
{
    static 
iTimestampiWaitNext
            
    iTimestamp 
get_systime()
            
    if(
iWaitNext iTimestamp) return
            
    
iWaitNext iTimestamp 30
    
    client_cmd
(0"spk buttons/bell1")

Guys this has worked fine for me.. Thanks for all of your support
HowToRuski is offline
Reply



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 14:42.


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