Raised This Month: $ Target: $400
 0% 

random msg


Post New Thread Reply   
 
Thread Tools Display Modes
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 06-10-2010 , 13:13   Re: random msg
Reply With Quote #11

i made this.. i think it will work, gonna try it now..
PHP Code:
#include <amxmodx>
#include <colorchat>


public plugin_init() 
{
    
register_plugin("ad""1.0""blah")
    
set_task(60.0"advertisements")
}

public 
advertisements()
{
    switch(
random_num(1,4))
    {
        case 
1:
        {
            
ColorChat(0RED"blah")
        }
        case 
2:
        {
            
ColorChat(0RED"drekes has a ponytail")
        }
        case 
3:
        {
            
ColorChat(0RED"gneegg gnegg")
        }
        case 
4:
        {
            
ColorChat(0RED"test")
        }
    }

FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-10-2010 , 13:23   Re: random msg
Reply With Quote #12

Quote:
Originally Posted by Brreaker View Post
As far as I know ( I may be mistaking ):
client_putinserver client_connect = client starting to connect ( console connecting )
client_connected client_putinserver = client is on the server, ready to choose the team...
...
__________________
xPaw is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 06-10-2010 , 14:15   Re: random msg
Reply With Quote #13

Horse in ur code u forgot to reset a new task, so it will only show 1 advertise. U can change set_task flags to make it automaticly repeat itself but I don't know them anymore.
__________________
I am out of order!
grimvh2 is offline
vL.
Senior Member
Join Date: Aug 2009
Location: Estonia
Old 06-10-2010 , 14:23   Re: random msg
Reply With Quote #14

Btw is there a way so they wouldn't be random, but would go from 1 to 4 and then 1 to 4 again and between every advert there is 60 seconds?
vL. is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 06-10-2010 , 14:31   Re: random msg
Reply With Quote #15

just make a variable like :

PHP Code:
new inumber;

//then at the function

switch(inumber)
{
   
//all ur cases
}

if(
inumber == maxadvertises)
    
inumber=0
else
    
inumber++ 
__________________
I am out of order!
grimvh2 is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-10-2010 , 15:20   Re: random msg
Reply With Quote #16

Code:
new const strings[][] = {     "lol", // 4th     "stuff", // 1st     "more", // 2nd     "dotdotdot" // 3rd } new iCount func() {     client_print( 0, print_chat, "%s", strings[++iCount%sizeof strings] ) }
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT

Last edited by wrecked_; 06-10-2010 at 18:53.
wrecked_ is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-10-2010 , 17:37   Re: random msg
Reply With Quote #17

Quote:
Originally Posted by wrecked_ View Post
Code:
new const strings[][] = {     "lol",     "stuff",     "more",     "dotdotdot" } new iCount func() {     client_print( 0, print_chat, "%s", strings[++iCount%sizeof strings] ) }
FYI, "lol" will be the fourth message printed . "stuff" will be first.
__________________
fysiks is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-10-2010 , 18:52   Re: random msg
Reply With Quote #18

Fixed. =]

Code:
new const strings[][] = {     "lol",     "stuff",     "more",     "dotdotdot" } new iCount func() {     client_print( 0, print_chat, "%s", strings[iCount++%sizeof strings] ) }
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 06-10-2010 , 19:39   Re: random msg
Reply With Quote #19

or i could just do this?
PHP Code:
#include <amxmodx>
#include <colorchat>

#define MAX_MSG 4

new const PLUGIN[ ] = "Advertisements"
new const VERSION[ ] = "1.0"
new const AUTHOR[ ] = "FlyingHorse"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
set_task(30.0"advertisements"id___"b");
}

public 
advertisements(id)
{
    switch (
random_num(1MAX_MSG))
    {
        case 
1:
        {
            
ColorChat(idRED"lol")
        }
        case 
2:
        {
            
ColorChat(idRED"blah")
        }
        case 
3:
        {
            
ColorChat(idRED"Drekes has a ponytail!")
        }
        case 
4:
        {
            
ColorChat(idRED"omfg")
        }
    }

FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-10-2010 , 19:43   Re: random msg
Reply With Quote #20

you can't use id in a function that doesn't use id. use wrecked's code. It's way easier then this
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
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:07.


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