AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   [CZ][INC&NATIVE] Czero Tutor (https://forums.alliedmods.net/showthread.php?t=172038)

Dark Style 11-14-2011 06:40

[CZ][INC&NATIVE] Czero Tutor
 
2 Attachment(s)
[Description]
This include able you to make advices with czero tutor!
Works ONLY in CS: Condition-Zero

OBS: I know that have another czero tutor inc, but that have so many erros.

- Put the file czerotutor.amxx in: amxmodx/plugins/
- Open the file amxmodx/configs/plugins.ini and write czerotutor.amxx


[Functions]
Code:

enum
{
        NONE = 0,
        RED,
        BLUE,
        YELLOW,
        GREEN
}

/**
 * Create a tutor
 *
 * @param id                Player index.
 * @param color                Color of the text.
 * @param sound                Sound to play when display tutor.
 * @param time                Time to the tutor still alive.
 * @param input                Text to display in tutor.
 * @return                        1 on success, 0 otherwise.
 */
native create_user_cztutor(id, color = GREEN, sound[] = "", Float:time = 0.0, const input[] = "");


/**
 * Remove player tutor.
 *
 * @param id                Player index.
 * @return                        1 on success, 0 otherwise.
 */
native remove_user_cztutor(id);


/**
 * Check if a tutor is displaying to this player.
 *
 * @param id                Player index.
 * @return                        Color of player tutor (If not exists will return NONE).
 */
native is_user_cztutor(id);

[Example]
Code:

#include <amxmodx>
#include <czerotutor>

// Native only support .wav sounds
new szSound[] = { "sound/misc/tutor.wav" }

public plugin_precache()
{
        // Renember you have to precache the sound
        precache_sound(szSound)
}

public plugin_init()
{
        register_plugin("New Plugin", "1.0", "Dark Style")
       
        register_event("HLTV", "roundstart", "a", "1=0", "2=0")
}

public client_authorized(id)
{
        // Index, Text, Color, Sound, Time.
        create_user_cztutor(id, RED, szSound, 5.0, "Welcome!")
}

public roundstart()
{
        // You don't need to get_players when don't have id, the native do it for you.
        if(is_user_cztutor(0) != NONE)
                remove_user_cztutor(0), create_user_cztutor(0, RED, szSound, 5.0, "Dungerous Server^nIP: XXX.XXX.XXX:XXXXX!")
        else
                create_user_cztutor(0, RED, szSound, 5.0, "Dungerous Server^nIP: XXX.XXX.XXX:XXXXX!")
}


drekes 11-14-2011 07:49

Re: [CZ][INC&NATIVE] Czero Tutor
 
http://forums.alliedmods.net/showthread.php?t=148170 ?

Dark Style 11-14-2011 08:17

Re: [CZ][INC&NATIVE] Czero Tutor
 
OBS: I know that have another czero tutor inc, but that have so many erros.

nikhilgupta345 11-14-2011 16:51

Re: [CZ][INC&NATIVE] Czero Tutor
 
Quote:

Originally Posted by Dark Style (Post 1596457)
OBS: I know that have another czero tutor inc, but that have so many erros.

I don't see any complaints in the thread.

ConnorMcLeod 11-14-2011 18:04

Re: [CZ][INC&NATIVE] Czero Tutor
 
I also have one version to post :)
More flexible and support ML and formatting.

Code:

#if defined _cz_tutor_included
  #endinput
#endif
#define _cz_tutor_included

#pragma reqlib cztutor

enum TutorSounds {
        DefaultTutor,
        FriendDied,
        EnemyDied,
        TaskComplete,
        TutorNoSound
}

enum TutorColors
{
        TutorGreen = 1,
        TutorRed = 2,
        TutorBlue = 4,
        TutorYellow = 8
}

native client_tutor(id, TutorColors:iColor=TutorGreen, TutorSounds:iSound=DefaultTutor, Float:flCloseDelay=8.0, const fmt[], any:...);

PHP Code:

/*    Formatright © 2010, ConnorMcLeod

    This plugin is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this plugin; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>

#define VERSION "0.0.1"
#define PLUGIN "TutorText"

#define TASK_OFFSET 1354897

enum TutorSounds {
    
DefaultTutor,
    
FriendDied,
    
EnemyDied,
    
TaskComplete,
    
TutorNoSound
}

new const 
g_szTutorSounds[TutorSounds][] = 
{
    
"sound/events/tutor_msg.wav"// Yellow, Green
    
"sound/events/friend_died.wav"// Red
    
"sound/events/enemy_died.wav"// Blue
    
"sound/events/task_complete.wav" // Green
}

enum TutorColors ( <<= )
{
    
TutorGreen 1,
    
TutorRed,
    
TutorBlue,
    
TutorYellow
}

new 
g_iTutorTextg_iTutorClose

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
g_iTutorText get_user_msgid("TutorText")
    
g_iTutorClose get_user_msgid("TutorClose")
}

public 
plugin_natives()
{
    
register_library("cztutor")
    
register_native("client_tutor""client_tutor")
}

public 
plugin_precache()
{
    new 
szModName[9]
    
get_modname(szModNamecharsmax(szModName))
    if( !
equal(szModName"czero") )
    {
        
set_fail_state("Only works on condition zero")
    }
}

// client_tutor(id, TutorColors:iColor, TutorSounds:iSound, Float:flCloseDelay=8.0, fmt[], any:...)
public client_tutor(iPluginiParams)
{
    new 
id get_param(1)
    new 
TutorColors:iColor TutorColors:get_param(2)
    new 
TutorSounds:iSound TutorSounds:get_param(3)
    new 
Float:flDelay get_param_f(4)
    new 
szText[256]
    if( 
iParams == )
    {
        
get_string(5szTextcharsmax(szText))
        
Send_TutorText(idiColoriSoundflDelayszText)
    }
    else if( 
id || iParams == )
    {
        
vdformat(szTextcharsmax(szText), 56)
        
Send_TutorText(idiColoriSoundflDelayszText)
    }
    else 
// iParams > 6
    
{
        new 
iPlayers[32], iNum
        get_players
(iPlayersiNum"ch")
        if( !
iNum )
        {
            return 
0
        
}
        new 
ij, Array:aStoreML ArrayCreate(), iMlCount
        
for(i=6i<iParamsi++)
        {
            if( 
get_param_byref(i) == LANG_PLAYER )
            {
                
get_string(i+1szTextcharsmax(szText))
                if( 
GetLangTransKey(szText) != TransKey_Bad )
                {
                    
ArrayPushCell(aStoreMLi++)
                    
iMlCount++
                }
            }
        }
        if( !
iMlCount )
        {
            
vdformat(szTextcharsmax(szText), 56)
            
Send_TutorText(idiColoriSoundflDelayszText)
        }
        else
        {
            for(
i=0i<iNumi++)
            {
                
id iPlayers[i]
                for(
j=0j<iMlCountj++)
                {
                    
set_param_byref(ArrayGetCell(aStoreMLj), id)
                }
                
vdformat(szTextcharsmax(szText), 56)
                
Send_TutorText(idiColoriSoundflDelayszText)
            }
        }
        
ArrayDestroy(aStoreML)
    }
    return 
1
}

Send_TutorText(idTutorColors:iTypeTutorSounds:iSoundFloat:flDelay, const szText[])
{
    if( 
iSound != TutorNoSound )
    {
        
client_cmd(id"spk %s"g_szTutorSounds[iSound])
    }

    
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTg_iTutorText, .player=id)
    
write_string(szText)
    
write_byte(0)
    
write_short(-1// TutorMessageEventI
    
write_shortid && !is_user_alive(id) ) 
    
write_short_:iType )
    
message_end()

    
id += TASK_OFFSET
    remove_task
(id)
    if( 
flDelay 0.0 )
    {
        
set_task(flDelay"TutorClose"id)
    }
}

public 
TutorClose(id)
{
    
id -= TASK_OFFSET
    
if( id )
    {
        
message_begin(MSG_ONE_UNRELIABLEg_iTutorClose, .player=id)
        
message_end()
    }
    else
    {
        new 
iPlayers[32], iNum
        get_players
(iPlayersiNum"ch")
        for(new 
ii<iNumi++)
        {
            
id iPlayers[i]
            if( !
task_exists(id+TASK_OFFSET) )
            {
                
message_begin(MSG_ONE_UNRELIABLEg_iTutorClose, .player=id)
                
message_end()
            }
        }
    }



drekes 11-14-2011 18:19

Re: [CZ][INC&NATIVE] Czero Tutor
 
Quote:

Originally Posted by ConnorMcLeod (Post 1596621)
I also have one version to post :)
More flexible and support ML and formatting.

:mrgreen:

Dark Style 11-15-2011 04:50

Re: [CZ][INC&NATIVE] Czero Tutor
 
Quote:

Originally Posted by ConnorMcLeod (Post 1596621)
I also have one version to post :)
More flexible and support ML and formatting.

Better.

TheArmagedon 11-16-2011 10:31

Re: [CZ][INC&NATIVE] Czero Tutor
 
You're just a fucking ripper of MMYTH's plugin.
C'mon, look at your plugins man! all of them... the original author is the "MMYTH".
You just edit one or two things and you say "I made this plugin, i'm fucking awesome!" GTFO!

DarkGod 11-16-2011 11:05

Re: [CZ][INC&NATIVE] Czero Tutor
 
Quote:

Originally Posted by TheArmagedon (Post 1597441)
You're just a fucking ripper of MMYTH's plugin.
C'mon, look at your plugins man! all of them... the original author is the "MMYTH".

Fun fact: Dark Style registered the day .MMYTH. got banned.

Dark Style 11-16-2011 15:52

Re: [CZ][INC&NATIVE] Czero Tutor
 
Quote:

Originally Posted by TheArmagedon (Post 1597441)
You're just a fucking ripper of MMYTH's plugin.
C'mon, look at your plugins man! all of them... the original author is the "MMYTH".
You just edit one or two things and you say "I made this plugin, i'm fucking awesome!" GTFO!

I think the problem is mine, and I create my plugins yes.


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

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