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

[req] Bug in magic marker


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 11-29-2014 , 17:29   [req] Bug in magic marker
Reply With Quote #1

Magic marker it's not suported anymore, it has a big bug.

If you die holding "+paint" then when you spectate someone you can paint all the walls.
It would be nice if someone could fix this.
Attached Files
File Type: sma Get Plugin or Get Source (magic_marker.sma - 368 views - 3.5 KB)
sigerman is offline
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 12-06-2014 , 19:24   Re: [req] Bug in magic marker
Reply With Quote #2

This is an example of what has been happening
sigerman is offline
Albanian Zombie
Senior Member
Join Date: May 2013
Location: void
Old 12-07-2014 , 08:14   Re: [req] Bug in magic marker
Reply With Quote #3

Don't double post please, use Edit button!
Albanian Zombie is offline
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 12-10-2014 , 11:58   Re: [req] Bug in magic marker
Reply With Quote #4

Quote:
Originally Posted by Albanian Zombie View Post
Don't double post please, use Edit button!
Ok, and what about something related to the problem?

Last edited by sigerman; 12-10-2014 at 12:00.
sigerman is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-10-2014 , 12:47   Re: [req] Bug in magic marker
Reply With Quote #5

Just try below code:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>

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

#define MAX_PLAYERS 32
#define USAGE_LEVEL ADMIN_KICK

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
    
}
    
    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(
is_user_alive(id) && 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;

zmd94 is offline
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 12-11-2014 , 19:33   Re: [req] Bug in magic marker
Reply With Quote #6

Quote:
Originally Posted by zmd94 View Post
Just try below code:
PHP Code:
code 
It works!, I tested the plugin, theres only one thing wrong, when you spawn starts painting on its own. Thanks in advance!
sigerman is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-11-2014 , 20:27   Re: [req] Bug in magic marker
Reply With Quote #7

Nice.

By the way, what do you mean by it start painting on its own when you spawn?
zmd94 is offline
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 12-11-2014 , 20:31   Re: [req] Bug in magic marker
Reply With Quote #8

Quote:
Originally Posted by zmd94 View Post
Nice.

By the way, what do you mean by it start painting on its own when you spawn?
When you die painting, automatically when you spawn, you paint as if you were doing +paint
I Don't have a brillant english, sorry! If you don't understand, I'll explain it to you again
sigerman is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-11-2014 , 21:22   Re: [req] Bug in magic marker
Reply With Quote #9

Sorry, I'm not sure how to fix it.
zmd94 is offline
sigerman
Senior Member
Join Date: Aug 2013
Location: Argentina, Bs.As.
Old 12-12-2014 , 15:56   Re: [req] Bug in magic marker
Reply With Quote #10

Quote:
Originally Posted by zmd94 View Post
Sorry, I'm not sure how to fix it.
Thanks, what youve done is enough

If someone else knows how to fix it, nows the time to say it.
sigerman 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:08.


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