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

[HELP] CZ Tutor Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joaokb
Junior Member
Join Date: Apr 2021
Location: brazil
Old 04-30-2021 , 21:20   [HELP] CZ Tutor Plugin
Reply With Quote #1

I'm using this plugin: https://gamebanana.com/mods/39862
to show this messages in the game when the player writes like "/rules" in the chat it show the rules with the sprite, but when anyone says "/rules" it show the rules to everybody, i want it to show just for the player that have written the command, is this possible?!



thx
Attached Files
File Type: sma Get Plugin or Get Source (gmst_cztutor_enhanced.sma - 200 views - 6.6 KB)
__________________
⠀⠀⠀⠀⠀⠀
⠀⠀kabest

Last edited by joaokb; 04-30-2021 at 21:21.
joaokb is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 04-30-2021 , 23:57   Re: [HELP] CZ Tutor Plugin
Reply With Quote #2

Not tested

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

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "CZ Tutor Messages - Enhanced Edition 9-30-2017"
#define VERSION "1.0"
#define AUTHOR "Sneaky.amxx | GlobalModders.net"

#define MAP_GLOBAL "global.ini"
#define MAX_MESSAGE 16

#define TASK_TUT 1111
#define TUT_TYPE 0 // 0 - Global (one file for all maps) / 1 - By Map (one file for each map)
#define TUT_SOUND "events/tutor_msg.wav"

enum
{
    
RED 1,
    
BLUE,
    
YELLOW,
    
GREEN
}

new const 
g_TutorPrecache[][] =
{
    
"gfx/career/icon_!.tga",
    
"gfx/career/icon_!-bigger.tga",
    
"gfx/career/icon_i.tga",
    
"gfx/career/icon_i-bigger.tga",
    
"gfx/career/icon_skulls.tga",
    
"gfx/career/round_corner_ne.tga",
    
"gfx/career/round_corner_nw.tga",
    
"gfx/career/round_corner_se.tga",
    
"gfx/career/round_corner_sw.tga",
    
"resource/TutorScheme.res",
    
"resource/UI/TutorTextWindow.res"
}

new 
g_MsgTutor;
new 
g_MsgTutClose;

// Main
new Message_Command[MAX_MESSAGE][64];
new 
Message_Content[MAX_MESSAGE][256];
new 
Message_Color[MAX_MESSAGE];
new 
Message_Time[MAX_MESSAGE];

new 
MessageCount;
new 
g_MaxPlayers;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
g_MsgTutor get_user_msgid("TutorText")
    
g_MsgTutClose get_user_msgid("TutorClose")

    
register_clcmd("say""Say_Handler");
    
register_clcmd("say_team""Say_Handler");

    
g_MaxPlayers get_maxplayers();
}

public 
plugin_precache()
{
    
precache_sound(TUT_SOUND)
    
File_Load()

    for(new 
0sizeof g_TutorPrecachei++)
    {
        
precache_generic(g_TutorPrecache[i])
    }
}

public 
client_putinserver(id)
{
    if(
MessageCount 0)
        
set_task(1.0"Recheck_Join"id);
}

public 
Recheck_Join(id)
{
    if(!
is_user_connected(id))
        return;

    new 
CsTeams:TeamTeam cs_get_user_team(id)

    if(
Team == CS_TEAM_CT || Team == CS_TEAM_T || Team == CS_TEAM_SPECTATOR)
    {
        
MakeTutor(idMessage_Content[0], Message_Color[0], float(Message_Time[0]));
        return;
    }

    
set_task(1.0"Recheck_Join"id);
}

public 
Display_AllPeople(idMessID)
{
    if(!
is_user_connected(id))
        return

    
MakeTutor(idMessage_Content[MessID], Message_Color[MessID], float(Message_Time[MessID]));
}

public 
Say_Handler(id)
{
    new 
Message[32], Command[32];
    new Return;

    
read_args(Message31);
    
remove_quotes(Message);

    
parse(MessageCommand31);

    if(
Command[0] == '/')
    {
        
replace_all(Command31"/""");

        for(new 
0MessageCounti++)
        {
            if(
equal(Message_Command[i], Command))
            {
                
Display_AllPeople(idi);
                Return = 
1;

                break;
            }
        }
    }

    if(Return) return 
PLUGIN_HANDLED
    
return PLUGIN_CONTINUE
}

public 
File_Load()
{
    
// Build customization file path
    
new path[128]
    
get_configsdir(pathcharsmax(path))

    switch(
TUT_TYPE)
    {
        case 
0format(pathcharsmax(path), "%s/iTutor/%s"pathMAP_GLOBAL)
        case 
1: {
            static 
MapName[32]; get_mapname(MapName31);
            
format(pathcharsmax(path), "%s/iTutor/%s.ini"pathMapName)
        }
    }

    
// File not present
    
if (!file_exists(path))
    {
        static 
DataA[128]; formatex(DataAsizeof(DataA), "[iTutor] Can't load: %s"path)
        
set_fail_state(DataA)

        return 
false;
    }

    
// Open customization file for reading
    
new file fopen(path"rt")

    
// File can't be opened
    
if (!file)
        return 
false;

    
// Set up some vars to hold parsing info
    
new linedata[1024];
    new 
Command[64], ColorFuck[16], MessTime[8]

    new 
ReadState 0;

    
// Seek to setting's section
    
while (!feof(file))
    {
        
// Read one line at a time
        
fgets(filelinedatacharsmax(linedata))

        
// Replace newlines with a null character to prevent headaches
        
replace(linedatacharsmax(linedata), "^n""")

        if(
strlen(linedata) <= 0)
            continue;

        if(
linedata[0] == '[')
        {
            if(
MessageCount >= MAX_MESSAGE)
                continue;

            
ReadState 1;

            
replace_all(linedatacharsmax(linedata), "[""");
            
parse(linedataCommand63ColorFuck15MessTime7);

            
Message_Command[MessageCount] = Command;

            if(
equal(ColorFuck"red")) Message_Color[MessageCount] = RED;
            else if(
equal(ColorFuck"blue")) Message_Color[MessageCount] = BLUE;
            else if(
equal(ColorFuck"yellow")) Message_Color[MessageCount] = YELLOW;
            else if(
equal(ColorFuck"green")) Message_Color[MessageCount] = GREEN;
            else 
Message_Color[MessageCount] = GREEN;

            
Message_Time[MessageCount] = str_to_num(MessTime);
        } else if(
linedata[0] == ']') {
            if(
ReadState 0)
            {
                
MessageCount++;
                
ReadState 0;
            }
        } else {
            
ReadState 2;
            
formatex(Message_Content[MessageCount], 255"%s%s"Message_Content[MessageCount], linedata)
        }

        
/*
        replace_all(linedata, charsmax(linedata), " ", "_");
        replace_all(linedata, charsmax(linedata), "/", " ");

        client_print(0, print_chat, "[%s]", linedata);
        parse(linedata, Command, 63, ColorFuck, 15, MessTime, 7, Content, 255);
        replace_all(Content, 255, "_", " ");

        if(MessageCount < MAX_MESSAGE)
        {
            Message_Command[MessageCount] = Command;
            Message_Content[MessageCount] = Content;

            if(equal(ColorFuck, "red")) Message_Color[MessageCount] = RED;
            else if(equal(ColorFuck, "blue")) Message_Color[MessageCount] = BLUE;
            else if(equal(ColorFuck, "yellow")) Message_Color[MessageCount] = YELLOW;
            else if(equal(ColorFuck, "green")) Message_Color[MessageCount] = GREEN;
            else Message_Color[MessageCount] = GREEN;

            Message_Time[MessageCount] = str_to_num(MessTime);

            MessageCount++;
        }*/
    
}

    return 
true;
}

MakeTutor(idText[], ColorFloat:Time 0.0)
{
    static 
NewText[256];
    
formatex(NewText255"%s"Text);

    
replace_all(NewText255"\n""^n");

    if(
is_user_connected(id))
    {
        
PlaySound(idTUT_SOUND);

        
message_begin(MSG_ONE_UNRELIABLEg_MsgTutor_id)
        
write_string(NewText)
        
write_byte(0)
        
write_short(0)
        
write_short(0)
        
write_short(1<<Color)
        
message_end()
    }

    if(
Time != 0.0) {

        if( 
task_exists(id TASK_TUT ))
        {
            
remove_task(id TASK_TUT)
        }

        
set_task(Time,"RemoveTutor",id TASK_TUT)
    }
}

public 
RemoveTutor(taskID)
{
    new 
id taskID TASK_TUT
    message_begin
(MSG_ALL,g_MsgTutClose,_,id)
    
message_end()
}

stock PlaySound(id, const sound[])
{
    if(
equal(sound[strlen(sound)-4], ".mp3")) client_cmd(id"mp3 play ^"sound/%s^""sound)
    else 
client_cmd(id"spk ^"sound/%s^""sound)
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1042\\ f0\\ fs16 \n\\ par }
*/ 
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
joaokb
Junior Member
Join Date: Apr 2021
Location: brazil
Old 05-01-2021 , 10:26   Re: [HELP] CZ Tutor Plugin
Reply With Quote #3

Quote:
Originally Posted by iceeedr View Post
Not tested

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

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "CZ Tutor Messages - Enhanced Edition 9-30-2017"
#define VERSION "1.0"
#define AUTHOR "Sneaky.amxx | GlobalModders.net"

#define MAP_GLOBAL "global.ini"
#define MAX_MESSAGE 16

#define TASK_TUT 1111
#define TUT_TYPE 0 // 0 - Global (one file for all maps) / 1 - By Map (one file for each map)
#define TUT_SOUND "events/tutor_msg.wav"

enum
{
    
RED 1,
    
BLUE,
    
YELLOW,
    
GREEN
}

new const 
g_TutorPrecache[][] =
{
    
"gfx/career/icon_!.tga",
    
"gfx/career/icon_!-bigger.tga",
    
"gfx/career/icon_i.tga",
    
"gfx/career/icon_i-bigger.tga",
    
"gfx/career/icon_skulls.tga",
    
"gfx/career/round_corner_ne.tga",
    
"gfx/career/round_corner_nw.tga",
    
"gfx/career/round_corner_se.tga",
    
"gfx/career/round_corner_sw.tga",
    
"resource/TutorScheme.res",
    
"resource/UI/TutorTextWindow.res"
}

new 
g_MsgTutor;
new 
g_MsgTutClose;

// Main
new Message_Command[MAX_MESSAGE][64];
new 
Message_Content[MAX_MESSAGE][256];
new 
Message_Color[MAX_MESSAGE];
new 
Message_Time[MAX_MESSAGE];

new 
MessageCount;
new 
g_MaxPlayers;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
g_MsgTutor get_user_msgid("TutorText")
    
g_MsgTutClose get_user_msgid("TutorClose")

    
register_clcmd("say""Say_Handler");
    
register_clcmd("say_team""Say_Handler");

    
g_MaxPlayers get_maxplayers();
}

public 
plugin_precache()
{
    
precache_sound(TUT_SOUND)
    
File_Load()

    for(new 
0sizeof g_TutorPrecachei++)
    {
        
precache_generic(g_TutorPrecache[i])
    }
}

public 
client_putinserver(id)
{
    if(
MessageCount 0)
        
set_task(1.0"Recheck_Join"id);
}

public 
Recheck_Join(id)
{
    if(!
is_user_connected(id))
        return;

    new 
CsTeams:TeamTeam cs_get_user_team(id)

    if(
Team == CS_TEAM_CT || Team == CS_TEAM_T || Team == CS_TEAM_SPECTATOR)
    {
        
MakeTutor(idMessage_Content[0], Message_Color[0], float(Message_Time[0]));
        return;
    }

    
set_task(1.0"Recheck_Join"id);
}

public 
Display_AllPeople(idMessID)
{
    if(!
is_user_connected(id))
        return

    
MakeTutor(idMessage_Content[MessID], Message_Color[MessID], float(Message_Time[MessID]));
}

public 
Say_Handler(id)
{
    new 
Message[32], Command[32];
    new Return;

    
read_args(Message31);
    
remove_quotes(Message);

    
parse(MessageCommand31);

    if(
Command[0] == '/')
    {
        
replace_all(Command31"/""");

        for(new 
0MessageCounti++)
        {
            if(
equal(Message_Command[i], Command))
            {
                
Display_AllPeople(idi);
                Return = 
1;

                break;
            }
        }
    }

    if(Return) return 
PLUGIN_HANDLED
    
return PLUGIN_CONTINUE
}

public 
File_Load()
{
    
// Build customization file path
    
new path[128]
    
get_configsdir(pathcharsmax(path))

    switch(
TUT_TYPE)
    {
        case 
0format(pathcharsmax(path), "%s/iTutor/%s"pathMAP_GLOBAL)
        case 
1: {
            static 
MapName[32]; get_mapname(MapName31);
            
format(pathcharsmax(path), "%s/iTutor/%s.ini"pathMapName)
        }
    }

    
// File not present
    
if (!file_exists(path))
    {
        static 
DataA[128]; formatex(DataAsizeof(DataA), "[iTutor] Can't load: %s"path)
        
set_fail_state(DataA)

        return 
false;
    }

    
// Open customization file for reading
    
new file fopen(path"rt")

    
// File can't be opened
    
if (!file)
        return 
false;

    
// Set up some vars to hold parsing info
    
new linedata[1024];
    new 
Command[64], ColorFuck[16], MessTime[8]

    new 
ReadState 0;

    
// Seek to setting's section
    
while (!feof(file))
    {
        
// Read one line at a time
        
fgets(filelinedatacharsmax(linedata))

        
// Replace newlines with a null character to prevent headaches
        
replace(linedatacharsmax(linedata), "^n""")

        if(
strlen(linedata) <= 0)
            continue;

        if(
linedata[0] == '[')
        {
            if(
MessageCount >= MAX_MESSAGE)
                continue;

            
ReadState 1;

            
replace_all(linedatacharsmax(linedata), "[""");
            
parse(linedataCommand63ColorFuck15MessTime7);

            
Message_Command[MessageCount] = Command;

            if(
equal(ColorFuck"red")) Message_Color[MessageCount] = RED;
            else if(
equal(ColorFuck"blue")) Message_Color[MessageCount] = BLUE;
            else if(
equal(ColorFuck"yellow")) Message_Color[MessageCount] = YELLOW;
            else if(
equal(ColorFuck"green")) Message_Color[MessageCount] = GREEN;
            else 
Message_Color[MessageCount] = GREEN;

            
Message_Time[MessageCount] = str_to_num(MessTime);
        } else if(
linedata[0] == ']') {
            if(
ReadState 0)
            {
                
MessageCount++;
                
ReadState 0;
            }
        } else {
            
ReadState 2;
            
formatex(Message_Content[MessageCount], 255"%s%s"Message_Content[MessageCount], linedata)
        }

        
/*
        replace_all(linedata, charsmax(linedata), " ", "_");
        replace_all(linedata, charsmax(linedata), "/", " ");

        client_print(0, print_chat, "[%s]", linedata);
        parse(linedata, Command, 63, ColorFuck, 15, MessTime, 7, Content, 255);
        replace_all(Content, 255, "_", " ");

        if(MessageCount < MAX_MESSAGE)
        {
            Message_Command[MessageCount] = Command;
            Message_Content[MessageCount] = Content;

            if(equal(ColorFuck, "red")) Message_Color[MessageCount] = RED;
            else if(equal(ColorFuck, "blue")) Message_Color[MessageCount] = BLUE;
            else if(equal(ColorFuck, "yellow")) Message_Color[MessageCount] = YELLOW;
            else if(equal(ColorFuck, "green")) Message_Color[MessageCount] = GREEN;
            else Message_Color[MessageCount] = GREEN;

            Message_Time[MessageCount] = str_to_num(MessTime);

            MessageCount++;
        }*/
    
}

    return 
true;
}

MakeTutor(idText[], ColorFloat:Time 0.0)
{
    static 
NewText[256];
    
formatex(NewText255"%s"Text);

    
replace_all(NewText255"\n""^n");

    if(
is_user_connected(id))
    {
        
PlaySound(idTUT_SOUND);

        
message_begin(MSG_ONE_UNRELIABLEg_MsgTutor_id)
        
write_string(NewText)
        
write_byte(0)
        
write_short(0)
        
write_short(0)
        
write_short(1<<Color)
        
message_end()
    }

    if(
Time != 0.0) {

        if( 
task_exists(id TASK_TUT ))
        {
            
remove_task(id TASK_TUT)
        }

        
set_task(Time,"RemoveTutor",id TASK_TUT)
    }
}

public 
RemoveTutor(taskID)
{
    new 
id taskID TASK_TUT
    message_begin
(MSG_ALL,g_MsgTutClose,_,id)
    
message_end()
}

stock PlaySound(id, const sound[])
{
    if(
equal(sound[strlen(sound)-4], ".mp3")) client_cmd(id"mp3 play ^"sound/%s^""sound)
    else 
client_cmd(id"spk ^"sound/%s^""sound)
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1042\\ f0\\ fs16 \n\\ par }
*/ 
it worked, thx so much bro
__________________
⠀⠀⠀⠀⠀⠀
⠀⠀kabest
joaokb 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 22:30.


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