Raised This Month: $ Target: $400
 0% 

How to display different message every time when it appear


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bardukis
Member
Join Date: Jul 2014
Old 08-15-2014 , 10:20   How to display different message every time when it appear
Reply With Quote #1

Can you make me plugin which display automatically message every 3rd/4th round at spawn? I want this message to be different every time(the messages to be added in code, something like a numbers or chars). You can see what exactly I want in examples below. I want an option in code to add X rows of this codes, chars, manually in code.

------------------------------
lines in codes:
1st line of code: 1alkv$5&8#
2nd line of code: io54!@^)h(
3rd line of code: =025&cnow
------------------------------



------------------------------
in game:
1st round(appears 1st line of code): Type symbols to win something: 1alkv$5&8#
2nd round(next) nothing
3rd round(next) nothing
4rd round(appears 2nd line of code): Type symbols to win something: io54!@^)h(
5rd round(next) nothing
6th round(next) nothing
7th round(appears 3rd line of code): Type symbols to win something: =025&cnow
------------------------------

Edit:
[+++]

1) message to appear in hud
2) to have 5-10(or controlled by cvar) seconds to type the code
3) if you type the code in necessary time you have 50% chance to win something
4) if you have luck with the chance -> win something
5) if you dont have luck, appear message: Sorry, try again
6) if you type the code out of necessary time, appear message: Sorry, time for typing the code is left

Last edited by bardukis; 08-20-2014 at 13:23.
bardukis is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 08-15-2014 , 11:19   Re: How to display different message every time when it appear
Reply With Quote #2

Not tested :B

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new const your_weird_codes[][] =
{
    
"1alkv$5&8#",
    
"io54!@)h(",
    
"=025&cnow"
}

new 
g_roundnum

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
register_logevent("round_start"2"0=World triggered""1=Round_Start")
    
register_clcmd("say","sayasdf")
}

public 
round_start()
{
    if(
g_roundnum == 0)
    {
        
client_print(0print_chat"The weird code of the round is: %s"your_weird_codes[g_roundnum 3])
    }

    
g_roundnum++
}

public 
sayasdf(id)
{
    if(
g_roundnum != 0)
        return 
PLUGIN_CONTINUE

    
new said[64]
    
read_args(said63)
    
remove_quotes(said)

    if(
equal(saidyour_weird_codes[g_roundnum 3]))
    {
        
//winner = id
        
    
}

    return 
PLUGIN_CONTINUE

__________________
Hey ^_^
NikKOo31 is offline
bardukis
Member
Join Date: Jul 2014
Old 08-16-2014 , 13:14   Re: How to display different message every time when it appear
Reply With Quote #3

The code doesnt work. The plugin is running when I type amxx plugins in console, so the problem is not in me.
Also except fixing plugin, also I would like to add some extras.

1) message to appear in hud
2) to have 5-10(or controlled by cvar) seconds to type the code
3) if you type the code in necessary time you have 50% chance to win something
4) if you have luck with the chance -> win something
5) if you dont have luck, appear message: Sorry, try again
6) if you type the code out of necessary time, appear message: Sorry, time for typing the code is left

Last edited by bardukis; 08-16-2014 at 13:17.
bardukis is offline
Old 08-20-2014, 13:23
bardukis
This message has been deleted by hornet. Reason: Wait 14 days before you bump
bardukis
Member
Join Date: Jul 2014
Old 10-10-2014 , 05:08   Re: How to display different message every time when it appear
Reply With Quote #4

Bump. Can somebody makes the plugin?
bardukis is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 10-10-2014 , 12:06   Re: How to display different message every time when it appear
Reply With Quote #5

PHP Code:
/* Plugin generated by AMXX-Studio */ 

#include <amxmodx> 
#include <amxmisc> 

#define PLUGIN "New Plug-In" 
#define VERSION "1.0" 
#define AUTHOR "author" 

new const your_weird_codes[][] = 

    
"1alkv$5&8#",
    
"io54!@)h("
    
"=025&cnow" 


new 
g_roundnumg_codenum
new bool:g_timeexpired
new cvar_timecvar_chance

public plugin_init()

    
register_plugin(PLUGINVERSIONAUTHOR

    
register_logevent("round_start"2"0=World triggered""1=Round_Start"
    
register_clcmd("say""sayasdf")
    
register_clcmd("say_team""sayasdf")

    
cvar_time register_cvar("time_4_code""10")
    
cvar_chance register_cvar("chance_code""50")
    
time_expired()
}

public 
time_expired()
{
    
g_timeexpired true
}

public 
round_start() 

    
g_codenum = -1

    
if((g_roundnum-1) % == 0)
    {
        
g_codenum random(charsmax(your_weird_codes))
        
g_timeexpired false

        set_task
(get_pcvar_float(cvar_time), "time_expired")

        
set_hudmessage(25500, -1.00.01)
        
show_hudmessage(0"The weird code of the round is: %s^nYou have %d seconds to type it"your_weird_codes[g_codenum], get_pcvar_num(cvar_time))
    } 

    
g_roundnum++ 


public 
sayasdf(id

    if(
g_codenum 0)
        return 
PLUGIN_CONTINUE

    
new said[32
    
read_args(said31
    
remove_quotes(said

    if(
equal(saidyour_weird_codes[g_codenum])) 
    {
        if(
g_timeexpired)
        {
            
client_print(idprint_center"Sorry, time for typing the code is left")
        }
        else
        {
            if(
random_num(0100) > get_pcvar_num(cvar_chance))
            {
                
client_print(idprint_center"Sorry, try again")
            }
            else
            {
                
client_print(idprint_center"Yay, you won a pink pony")
            }
        }
    } 

    return 
PLUGIN_CONTINUE 

__________________
Hey ^_^
NikKOo31 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 17:56.


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