Raised This Month: $32 Target: $400
 8% 

Solved [REQ] Jailbreak Simon line


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
saarthbhosale
Member
Join Date: Feb 2020
Old 03-25-2020 , 23:03   [REQ] Jailbreak Simon line
Reply With Quote #1

Hello,
Can somebody make a plugin where only simon can make a line by pressing the +use button (e) anywhere in the map for jailbreak mod?
The line should last for 15 seconds and also if simon type /line he should have menu where he can choose line colour!
Instead of telling Ts to follow simon, simon can make a line to show them the path!

Last edited by saarthbhosale; 04-01-2020 at 03:00.
saarthbhosale is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-26-2020 , 07:59   Re: [REQ] Jailbreak Simon line
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=56301
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
saarthbhosale
Member
Join Date: Feb 2020
Old 03-26-2020 , 08:43   Re: [REQ] Jailbreak Simon line
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
I said for simon only
Atleast can u edit it to ct only?

Last edited by saarthbhosale; 03-26-2020 at 08:47.
saarthbhosale is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 03-26-2020 , 09:19   Re: [REQ] Jailbreak Simon line
Reply With Quote #4

Can u be more polite next time?

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>
#include <cstrike>

#define PLUGIN "Magic Marker"
#define VERSION "3.1"
#define AUTHOR "stupok69"

#define MAX_PLAYERS 32
#define USAGE_LEVEL ADMIN_USER

new Float:origin[MAX_PLAYERS+1][3]
new 
prethink_counter[MAX_PLAYERS+1]
new 
bool:is_drawing[MAX_PLAYERS+1]
new 
bool:is_holding[MAX_PLAYERS+1]

new 
spriteid

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("+paint""paint_handler"USAGE_LEVEL"Paint on the walls!")
    
register_clcmd("-paint""paint_handler"USAGE_LEVEL"Paint on the walls!")
    
register_forward(FM_PlayerPreThink"forward_FM_PlayerPreThink"0)
}

public 
plugin_precache()
{
    
spriteid precache_model("sprites/lgtning.spr")
}

public 
paint_handler(idlevelcid)
{
    if(!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED
    
    
if(!is_user_alive(id))
    {
        
client_print(idprint_chat"* You cannot use the magic marker when you are dead.")
        return 
PLUGIN_HANDLED
    
}
    
    if(
cs_get_user_team(id) != CS_TEAM_CT)
    {
        
client_print(idprint_chat"* Only CT's can use the magic marker.")
        return 
PLUGIN_HANDLED
    
}
    
    static 
cmd[2]
    
read_argv(0cmd1)
    
    switch(
cmd[0])
    {
        case 
'+'is_drawing[id] = true
        
case '-'is_drawing[id] = false
    
}
    return 
PLUGIN_HANDLED
}

public 
forward_FM_PlayerPreThink(id)
{
    if(
prethink_counter[id]++ > 5)
    {
        if(
is_drawing[id] && !is_aiming_at_sky(id))
        {
            static 
Float:cur_origin[3], Float:distance

            cur_origin 
origin[id]
            
            if(!
is_holding[id])
            {
                
fm_get_aim_origin(idorigin[id])
                
move_toward_client(idorigin[id])
                
is_holding[id] = true
                
return FMRES_IGNORED
            
}
            
            
fm_get_aim_origin(idorigin[id])
            
move_toward_client(idorigin[id])
            
            
distance get_distance_f(origin[id], cur_origin)
            
            if(
distance 2)
            {
                
draw_line(origin[id], cur_origin)
            }
        }
        else
        {
            
is_holding[id] = false
        
}
        
prethink_counter[id] = 0
    
}
    
    return 
FMRES_IGNORED
}

stock draw_line(Float:origin1[3], Float:origin2[3])
{
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_BEAMPOINTS)
    
engfunc(EngFunc_WriteCoordorigin1[0])
    
engfunc(EngFunc_WriteCoordorigin1[1])
    
engfunc(EngFunc_WriteCoordorigin1[2])
    
engfunc(EngFunc_WriteCoordorigin2[0])
    
engfunc(EngFunc_WriteCoordorigin2[1])
    
engfunc(EngFunc_WriteCoordorigin2[2])
    
write_short(spriteid)
    
write_byte(0)
    
write_byte(10)
    
write_byte(255)
    
write_byte(50)
    
write_byte(0)
    
write_byte(random(255))
    
write_byte(random(255))
    
write_byte(random(255))
    
write_byte(255)
    
write_byte(0)
    
message_end()
}

//from fakemeta_util.inc
stock fm_get_aim_origin(indexFloat:origin[3])
{
    static 
Float:start[3], Float:view_ofs[3]
    
pev(indexpev_originstart)
    
pev(indexpev_view_ofsview_ofs)
    
xs_vec_add(startview_ofsstart)
    
    static 
Float:dest[3]
    
pev(indexpev_v_angledest)
    
engfunc(EngFunc_MakeVectorsdest)
    
global_get(glb_v_forwarddest)
    
xs_vec_mul_scalar(dest9999.0dest)
    
xs_vec_add(startdestdest)
    
    
engfunc(EngFunc_TraceLinestartdest0index0)
    
get_tr2(0TR_vecEndPosorigin)
    
    return 
1
}

stock move_toward_client(idFloat:origin[3])
{        
    static 
Float:player_origin[3]
    
    
pev(idpev_originplayer_origin)
    
    
origin[0] += (player_origin[0] > origin[0]) ? 1.0 : -1.0
    origin
[1] += (player_origin[1] > origin[1]) ? 1.0 : -1.0
    origin
[2] += (player_origin[2] > origin[2]) ? 1.0 : -1.0
}
//Thanks AdaskoMX!
bool:is_aiming_at_sky(index)
{
    new 
Float:origin[3];
    
fm_get_aim_origin(indexorigin);

    return 
engfunc(EngFunc_PointContentsorigin) == CONTENTS_SKY;

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-26-2020 , 09:48   Re: [REQ] Jailbreak Simon line
Reply With Quote #5

Quote:
Originally Posted by saarthbhosale View Post
I said for simon only
Atleast can u edit it to ct only?
Can I read your mind to see which mod you're using?
__________________

Last edited by OciXCrom; 03-26-2020 at 09:48.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
saarthbhosale
Member
Join Date: Feb 2020
Old 03-26-2020 , 09:57   Re: [REQ] Jailbreak Simon line
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
Can I read your mind to see which mod you're using?
Its not mod of allied modders.. is it allowed to post the another site's links?
saarthbhosale is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 03-26-2020 , 10:00   Re: [REQ] Jailbreak Simon line
Reply With Quote #7

Quote:
Originally Posted by saarthbhosale View Post
Its not mod of allied modders.. is it allowed to post the another site's links?
I just posted a code for you, test it and give feedback.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-26-2020 , 10:35   Re: [REQ] Jailbreak Simon line
Reply With Quote #8

Quote:
Originally Posted by saarthbhosale View Post
Its not mod of allied modders.. is it allowed to post the another site's links?
Why does it matter? You can upload the .sma directly if you think it isn't allowed, even though it is. Or at least give us the .inc file if it has one.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 03-26-2020 , 13:08   Re: [REQ] Jailbreak Simon line
Reply With Quote #9

Here is a modification I've made few years ago,
didn't optimize it but should work (not tested).

Atm I added is_user_admin check, you'll need to replace that with is_user_commander or something.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>
#include <cstrike>
#include <colorchat>
#include <hamsandwich>

#define PLUGIN "Magic Marker"
#define VERSION "4.3"
#define AUTHOR "stupok"

#define MAX_PLAYERS 32
new Float:origin[MAX_PLAYERS+1][3]

enum _:enumPlayer
{
    
PLAYER_DRAWING,
    
PLAYER_HOLDING,

    
Float:PLAYER_FL_MESSAGE,
    
PLAYER_PRETHINK_DLEAY
}
new 
g_arrayPlayer[33][enumPlayer];

new 
g_spritePaintg_cvarMessagecooldown;

public 
plugin_precache()
{
    
g_spritePaint precache_model("sprites/lgtning.spr")
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

  
// Register: Cvar
    
g_cvarMessagecooldown register_cvar("paint_message_cooldown""10.0");

    
// Register: Ham
    
RegisterHam(Ham_Player_PreThink"player""Ham_PlayerPrethink_Pre"0);
    
RegisterHam(Ham_ObjectCaps"player""Ham_ObjectCaps_Pre"0);
    
RegisterHam(Ham_Spawn"player""Ham_PlayerSpawn_Post"1);
}

// Public: Ham
public Ham_PlayerSpawn_Post(id)
{
    if(
is_user_alive(id))
    {
        
arrayset(g_arrayPlayer[id], 0enumPlayer);
    }
}
public 
Ham_ObjectCaps_Pre(id)
{
    if(
is_user_alive(id)
    && 
cs_get_user_team(id) == CS_TEAM_CT
       
&& is_user_admin(id)) // CHANGE THIS TO COMMAND FLAG
    
{
        if(!
g_arrayPlayer[id][PLAYER_DRAWING])
        {
            if(
pev(idpev_button) & IN_USE
            
&& pev(idpev_oldbuttons) & IN_USE)
            {
                
Message_Drawing(id);
                
g_arrayPlayer[id][PLAYER_HOLDING] = 0;
                
g_arrayPlayer[id][PLAYER_DRAWING] = 1;
            }
            return 
HAM_IGNORED;
        }
        if(~
pev(idpev_button) & IN_USE)
        {
            
g_arrayPlayer[id][PLAYER_DRAWING] = 0;
        }
    }
    return 
HAM_IGNORED;
}
public 
Ham_PlayerPrethink_Pre(id)
{
    if(
g_arrayPlayer[id][PLAYER_DRAWING]
    && 
is_user_alive(id)
    && 
g_arrayPlayer[id][PLAYER_PRETHINK_DLEAY]++ > 5)
    {
        if(
g_arrayPlayer[id][PLAYER_DRAWING] && !is_aiming_at_sky(id))
        {
            static 
Float:cur_origin[3], Float:distance;

            
cur_origin origin[id];

            if(!
g_arrayPlayer[id][PLAYER_HOLDING])
            {
                
fm_get_aim_origin(idorigin[id]);
                
move_toward_client(idorigin[id]);

                
g_arrayPlayer[id][PLAYER_HOLDING] = 1;

                return 
FMRES_IGNORED
            
}

            
fm_get_aim_origin(idorigin[id])
            
move_toward_client(idorigin[id])

            
distance get_distance_f(origin[id], cur_origin);

            if(
distance 2)
            {
                
draw_line(origin[id], cur_origin);
            }
        }
        else
        {
            
g_arrayPlayer[id][PLAYER_HOLDING] = 0;
        }
        
g_arrayPlayer[id][PLAYER_PRETHINK_DLEAY] = 0;
    }

    return 
FMRES_IGNORED
}


// Stocks
stock draw_line(Float:origin1[3], Float:origin2[3])
{
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_BEAMPOINTS)
    
engfunc(EngFunc_WriteCoordorigin1[0])
    
engfunc(EngFunc_WriteCoordorigin1[1])
    
engfunc(EngFunc_WriteCoordorigin1[2])
    
engfunc(EngFunc_WriteCoordorigin2[0])
    
engfunc(EngFunc_WriteCoordorigin2[1])
    
engfunc(EngFunc_WriteCoordorigin2[2])
    
write_short(g_spritePaint)
    
write_byte(0)
    
write_byte(10)
    
write_byte(255)
    
write_byte(50)
    
write_byte(0)
    
write_byte(random(255))
    
write_byte(random(255))
    
write_byte(random(255))
    
write_byte(255)
    
write_byte(0)
    
message_end()
}

stock fm_get_aim_origin(indexFloat:origin[3])
{
    static 
Float:start[3], Float:view_ofs[3]
    
pev(indexpev_originstart)
    
pev(indexpev_view_ofsview_ofs)
    
xs_vec_add(startview_ofsstart)

    static 
Float:dest[3]
    
pev(indexpev_v_angledest)
    
engfunc(EngFunc_MakeVectorsdest)
    
global_get(glb_v_forwarddest)
    
xs_vec_mul_scalar(dest9999.0dest)
    
xs_vec_add(startdestdest)

    
engfunc(EngFunc_TraceLinestartdest0index0)
    
get_tr2(0TR_vecEndPosorigin)

    return 
1
}

stock move_toward_client(idFloat:origin[3])
{
    static 
Float:player_origin[3]

    
pev(idpev_originplayer_origin)

    
origin[0] += (player_origin[0] > origin[0]) ? 1.0 : -1.0
    origin
[1] += (player_origin[1] > origin[1]) ? 1.0 : -1.0
    origin
[2] += (player_origin[2] > origin[2]) ? 1.0 : -1.0
}
        
//Thanks AdaskoMX!
bool:is_aiming_at_sky(index)
{
    new 
Float:origin[3];
    
fm_get_aim_origin(indexorigin);

    return 
engfunc(EngFunc_PointContentsorigin) == CONTENTS_SKY;
}
stock Message_Drawing(id)
{
    
// Message
    
if(Float:g_arrayPlayer[id][PLAYER_FL_MESSAGE] < get_gametime())
    {
        new 
strName[32];
        
get_user_name(idstrNamecharsmax(strName));

        
ColorChat(0, (cs_get_user_team(id) ? RED BLUE), "^4>Simon>^3 %s^1 is now drawing."strName);

        
g_arrayPlayer[id][PLAYER_FL_MESSAGE] = _:(get_gametime() + get_pcvar_float(g_cvarMessagecooldown));
    }

__________________
Retired.
Xalus is offline
saarthbhosale
Member
Join Date: Feb 2020
Old 04-01-2020 , 02:58   Re: [REQ] Jailbreak Simon line
Reply With Quote #10

Quote:
Originally Posted by Xalus View Post
Here is a modification I've made few years ago,
didn't optimize it but should work (not tested).

Atm I added is_user_admin check, you'll need to replace that with is_user_commander or something.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>
#include <cstrike>
#include <colorchat>
#include <hamsandwich>

#define PLUGIN "Magic Marker"
#define VERSION "4.3"
#define AUTHOR "stupok"

#define MAX_PLAYERS 32
new Float:origin[MAX_PLAYERS+1][3]

enum _:enumPlayer
{
    
PLAYER_DRAWING,
    
PLAYER_HOLDING,

    
Float:PLAYER_FL_MESSAGE,
    
PLAYER_PRETHINK_DLEAY
}
new 
g_arrayPlayer[33][enumPlayer];

new 
g_spritePaintg_cvarMessagecooldown;

public 
plugin_precache()
{
    
g_spritePaint precache_model("sprites/lgtning.spr")
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

  
// Register: Cvar
    
g_cvarMessagecooldown register_cvar("paint_message_cooldown""10.0");

    
// Register: Ham
    
RegisterHam(Ham_Player_PreThink"player""Ham_PlayerPrethink_Pre"0);
    
RegisterHam(Ham_ObjectCaps"player""Ham_ObjectCaps_Pre"0);
    
RegisterHam(Ham_Spawn"player""Ham_PlayerSpawn_Post"1);
}

// Public: Ham
public Ham_PlayerSpawn_Post(id)
{
    if(
is_user_alive(id))
    {
        
arrayset(g_arrayPlayer[id], 0enumPlayer);
    }
}
public 
Ham_ObjectCaps_Pre(id)
{
    if(
is_user_alive(id)
    && 
cs_get_user_team(id) == CS_TEAM_CT
       
&& is_user_admin(id)) // CHANGE THIS TO COMMAND FLAG
    
{
        if(!
g_arrayPlayer[id][PLAYER_DRAWING])
        {
            if(
pev(idpev_button) & IN_USE
            
&& pev(idpev_oldbuttons) & IN_USE)
            {
                
Message_Drawing(id);
                
g_arrayPlayer[id][PLAYER_HOLDING] = 0;
                
g_arrayPlayer[id][PLAYER_DRAWING] = 1;
            }
            return 
HAM_IGNORED;
        }
        if(~
pev(idpev_button) & IN_USE)
        {
            
g_arrayPlayer[id][PLAYER_DRAWING] = 0;
        }
    }
    return 
HAM_IGNORED;
}
public 
Ham_PlayerPrethink_Pre(id)
{
    if(
g_arrayPlayer[id][PLAYER_DRAWING]
    && 
is_user_alive(id)
    && 
g_arrayPlayer[id][PLAYER_PRETHINK_DLEAY]++ > 5)
    {
        if(
g_arrayPlayer[id][PLAYER_DRAWING] && !is_aiming_at_sky(id))
        {
            static 
Float:cur_origin[3], Float:distance;

            
cur_origin origin[id];

            if(!
g_arrayPlayer[id][PLAYER_HOLDING])
            {
                
fm_get_aim_origin(idorigin[id]);
                
move_toward_client(idorigin[id]);

                
g_arrayPlayer[id][PLAYER_HOLDING] = 1;

                return 
FMRES_IGNORED
            
}

            
fm_get_aim_origin(idorigin[id])
            
move_toward_client(idorigin[id])

            
distance get_distance_f(origin[id], cur_origin);

            if(
distance 2)
            {
                
draw_line(origin[id], cur_origin);
            }
        }
        else
        {
            
g_arrayPlayer[id][PLAYER_HOLDING] = 0;
        }
        
g_arrayPlayer[id][PLAYER_PRETHINK_DLEAY] = 0;
    }

    return 
FMRES_IGNORED
}


// Stocks
stock draw_line(Float:origin1[3], Float:origin2[3])
{
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_BEAMPOINTS)
    
engfunc(EngFunc_WriteCoordorigin1[0])
    
engfunc(EngFunc_WriteCoordorigin1[1])
    
engfunc(EngFunc_WriteCoordorigin1[2])
    
engfunc(EngFunc_WriteCoordorigin2[0])
    
engfunc(EngFunc_WriteCoordorigin2[1])
    
engfunc(EngFunc_WriteCoordorigin2[2])
    
write_short(g_spritePaint)
    
write_byte(0)
    
write_byte(10)
    
write_byte(255)
    
write_byte(50)
    
write_byte(0)
    
write_byte(random(255))
    
write_byte(random(255))
    
write_byte(random(255))
    
write_byte(255)
    
write_byte(0)
    
message_end()
}

stock fm_get_aim_origin(indexFloat:origin[3])
{
    static 
Float:start[3], Float:view_ofs[3]
    
pev(indexpev_originstart)
    
pev(indexpev_view_ofsview_ofs)
    
xs_vec_add(startview_ofsstart)

    static 
Float:dest[3]
    
pev(indexpev_v_angledest)
    
engfunc(EngFunc_MakeVectorsdest)
    
global_get(glb_v_forwarddest)
    
xs_vec_mul_scalar(dest9999.0dest)
    
xs_vec_add(startdestdest)

    
engfunc(EngFunc_TraceLinestartdest0index0)
    
get_tr2(0TR_vecEndPosorigin)

    return 
1
}

stock move_toward_client(idFloat:origin[3])
{
    static 
Float:player_origin[3]

    
pev(idpev_originplayer_origin)

    
origin[0] += (player_origin[0] > origin[0]) ? 1.0 : -1.0
    origin
[1] += (player_origin[1] > origin[1]) ? 1.0 : -1.0
    origin
[2] += (player_origin[2] > origin[2]) ? 1.0 : -1.0
}
        
//Thanks AdaskoMX!
bool:is_aiming_at_sky(index)
{
    new 
Float:origin[3];
    
fm_get_aim_origin(indexorigin);

    return 
engfunc(EngFunc_PointContentsorigin) == CONTENTS_SKY;
}
stock Message_Drawing(id)
{
    
// Message
    
if(Float:g_arrayPlayer[id][PLAYER_FL_MESSAGE] < get_gametime())
    {
        new 
strName[32];
        
get_user_name(idstrNamecharsmax(strName));

        
ColorChat(0, (cs_get_user_team(id) ? RED BLUE), "^4>Simon>^3 %s^1 is now drawing."strName);

        
g_arrayPlayer[id][PLAYER_FL_MESSAGE] = _:(get_gametime() + get_pcvar_float(g_cvarMessagecooldown));
    }

Thanks dude, really helpful..
saarthbhosale 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 00:40.


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