Raised This Month: $ Target: $400
 0% 

enemy on radar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sb123
Senior Member
Join Date: Jan 2007
Old 08-20-2010 , 06:16   enemy on radar
Reply With Quote #1

i use the plugins for CSDM
so i want changed Radar Always shows enemy
and delete team for Radar
just shows enemy
who can help me?
PHP Code:
#define ENEMY_MSG "Enemy has been seen in this sector"
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define INTERVAL 0.5
#define FRQ (1 / INTERVAL)

#define PLUGIN "Enemy Radar"
#define VERSION "1.32"
#define AUTHOR "AdaskoMX"

#pragma semicolon 1

#define ENEMY_POS 62520
#define R_BACKUP 0
#define R_ENEMYSPOTTED 1
#define R_TAKINGFIRE 2

new m_fakeHostagem_fakeHostageDie;
new 
enemy_origin[32][3];
new 
e_o_time[32], billyWasHere[32], friends[32], CsTeams:reportedAs[32],
    
spottedInt[32], radioBan[32], bool:reported[32], teamRadioBan[CsTeams];

new 
PLUGIN_ENABLEDTIME_ON_RADARSHOW_ATTACKERRADIO_CMDSSHOW_WARNING;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);

    
PLUGIN_ENABLED register_cvar("amx_erenabled""1"FCVAR_SERVER);
    
TIME_ON_RADAR register_cvar("amx_ertime""4");
    
SHOW_ATTACKER register_cvar("amx_ershowattacker""0");
    
RADIO_CMDS register_cvar("amx_erradiocmds""1");
    
SHOW_WARNING register_cvar("amx_ershowmsg""10");

    
register_event("StatusValue","setTeam","be","1=1");
    
register_event("StatusValue""showStatus""be""1=2""2!0");
    
register_event("StatusValue""hideStatus""be""1=1""2=0");
    
register_event("Damage","damage","b","2!0","3=0","4!0");
    
register_event("HLTV""newRound""a""1=0""2=0");
    
register_event("DeathMsg""death""a");

    
m_fakeHostage get_user_msgid("HostagePos");
    
m_fakeHostageDie get_user_msgid("HostageK");

    
set_task(INTERVAL"showEnemies"___"b");
    return 
PLUGIN_CONTINUE;
}

public 
hideStatus(id) {
    if ( 
task_exists(ENEMY_POS id) )
        
remove_task(ENEMY_POS id);
    return 
PLUGIN_CONTINUE;
}

public 
updatePos(param[]) {
    if( !
get_pcvar_num(PLUGIN_ENABLED) )
        return 
PLUGIN_CONTINUE;

    if( 
friends[param[0] - 1] == || (!is_user_alive(param[0]) && !param[2]) || !is_user_alive(param[1]) ) {
        
hideStatus(param[0]);
    } else {
        
get_user_origin(param[1], enemy_origin[param[1] - 1]);
        
e_o_time[param[1] - 1] = floatround(get_pcvar_num(TIME_ON_RADAR) * FRQ);
        
billyWasHere[param[1] - 1] = floatround(get_pcvar_num(SHOW_WARNING) * FRQ);
    }
    
reported[param[0] - 1] = true;

    return 
PLUGIN_CONTINUE;
}

public 
setTeam(id) {
    
friends[id 1] = read_data(2);
}

radio(idtypemaxBan 0banFor 8) {
    new 
CsTeams:team cs_get_user_team(id);
    
    if(
radioBan[id 1] > maxBan || teamRadioBan[team] > maxBan) {
        return ;
    }
    
    new 
rcmd[11];
    switch(
type) {
        case 
R_BACKUPrcmd "needbackup";
        case 
R_ENEMYSPOTTEDrcmd "enemyspot";
        case 
R_TAKINGFIRE rcmd "takingfire";
    }
    
engclient_cmd(idrcmd);
    
radioBan[id 1] = banFor;
    
teamRadioBan[team] = 4;
}

public 
showStatus(id) {
    if( !
get_pcvar_num(PLUGIN_ENABLED) )
        return 
PLUGIN_CONTINUE;

    new 
param[3], CsTeams:tmp;
    
param[0] = id;
    
param[1] = read_data(2);
    if(
param[1] < || param[1] > 32)
        return 
PLUGIN_CONTINUE;
    
    
param[2] = 0;
    
    if (
friends[id 1] == 2) {
        
updatePos(param);
        
tmp cs_get_user_team(param[1]);
        if(
tmp != reportedAs[param[1] - 1] && get_pcvar_num(RADIO_CMDS)) {
            if(
spottedInt[id 1]) {
                
radio(idR_BACKUP812);
            } else if(!
radioBan[id 1]) {
                
radio(idR_ENEMYSPOTTED);
            }
            
spottedInt[id 1] = 4;

            
reportedAs[param[1] - 1] = tmp;
        }
        
set_task(0.2"updatePos"ENEMY_POS idparam3"b");
    }
    return 
PLUGIN_CONTINUE;
}

public 
damage(id)
{
    if( !
get_pcvar_num(PLUGIN_ENABLED) )
        return 
PLUGIN_CONTINUE;

    new 
dmg read_data(2);
    new 
param[3], weapon;
    
param[0] = get_user_attacker(idweapon);
    if(
param[0] < || param[0] > 32)
        return 
PLUGIN_CONTINUE;
    
param[1] = id;
    
param[2] = 1;
    
    if(
cs_get_user_team(id) == cs_get_user_team(param[0]))
        return 
PLUGIN_CONTINUE;

    new 
attackerHPvictimHP;
    
    if(
get_pcvar_num(RADIO_CMDS) && weapon != CSW_HEGRENADE && weapon != CSW_KNIFE) {
        
victimHP get_user_health(id);
        
attackerHP get_user_health(param[0]);
        if((
dmg 50 || victimHP 20) && victimHP attackerHP) {
            
radio(idR_BACKUP412);
        }
        if((
dmg 40 && attackerHP 30) && victimHP attackerHP) {
            
radio(param[0], R_TAKINGFIRE412);
        }
    }
    
updatePos(param);
    if(
get_pcvar_num(SHOW_ATTACKER)) {
        
param[1] = param[0];
        
param[0] = id;
        
updatePos(param);
    }
    return 
PLUGIN_CONTINUE;
}

public 
death(){
    
hideStatus(read_data(2));
    return 
PLUGIN_CONTINUE;
}

public 
newRound(){
    for( new 
i32++) {
        
hideStatus(i);
        
enemy_origin[i] = {000};
        
reportedAs[i] = CS_TEAM_UNASSIGNED;
        
spottedInt[i] = 0;
        
e_o_time[i] = 0;
        
billyWasHere[i] = 0;
        
reported[i] = false;
    }
    return 
PLUGIN_CONTINUE;
}

showOnRadar(idpidi) {
    
message_begin(MSG_ONE_UNRELIABLEm_fakeHostage, {0,0,0}, id);
    
write_byte(id);
    
write_byte(i);
    
write_coord(enemy_origin[pid 1][0]);
    
write_coord(enemy_origin[pid 1][1]);
    
write_coord(enemy_origin[pid 1][2]);
    
message_end();

    
message_begin(MSG_ONE_UNRELIABLEm_fakeHostageDie, {0,0,0}, id);
    
write_byte(i);
    
message_end();
}

reportEnemy(id) {
    if(!
reported[id 1]) {
        
set_hudmessage(255000.70.701.03.00.21.03);
        
show_hudmessage(idENEMY_MSG);
    } else 
reported[id 1] = true;
}

public 
showEnemies() {
    if( !
get_pcvar_num(PLUGIN_ENABLED) )
        return 
PLUGIN_CONTINUE;

    new 
players[32], numijidpidCsTeams:teamcnt;
    new 
pos1[3], pos2[3], bool:repp;
    
get_players(playersnum"a");
    
    for( 
032++) {
        if(
e_o_time[i])
            
e_o_time[i] --;
    }
    if(
teamRadioBan[CS_TEAM_T]) teamRadioBan[CS_TEAM_T] --;
    if(
teamRadioBan[CS_TEAM_CT]) teamRadioBan[CS_TEAM_CT] --;

    for( 
0num++) {
        
id players[i];

        if(
billyWasHere[id 1])
            
billyWasHere[id 1] --;
        if(
spottedInt[id 1])
            
spottedInt[id 1] --;
        if(
radioBan[id 1])
            
radioBan[id 1] --;
        
        
team cs_get_user_team(id);
        if(
team != CS_TEAM_T && team != CS_TEAM_CT)
            continue;
        
cnt 10;
        
repp false;
        for (
0num++ ) {
            
pid players[j];
            
            if( 
id != pid && cs_get_user_team(pid) != team) {
                if(
billyWasHere[pid 1] > 0) {
                    
get_user_origin(idpos1);
                    
pos2 enemy_origin[pid 1];

                    if(
abs(pos1[2] - pos2[2]) < 150) {
                        
pos1[2] = pos2[2];
                        if(
get_distance(pos1pos2) < 400) {
                            
repp true;
                            
reportEnemy(id);
                        }
                    }
                }

                if(
e_o_time[pid 1] > 0) {
                    
cnt ++;
                    
showOnRadar(idpidcnt);
                }
            }
        }
        if(!
reppreported[id 1] = false;
    }
    return 
PLUGIN_CONTINUE;

sb123 is offline
Send a message via ICQ to sb123 Send a message via MSN to sb123 Send a message via Yahoo to sb123
jim_yang
Veteran Member
Join Date: Aug 2006
Old 08-20-2010 , 06:46   Re: enemy on radar
Reply With Quote #2

This best way I can think is to hack this part
Code:
if ( *(_DWORD *)(v38 + 420) != -2147483648 )
{
    if ( !*(_DWORD *)(v38 + 368) )
    {
        if ( *(_DWORD *)(v36 + 456) == *(_DWORD *)(_ESI + 456) )
        {
            MESSAGE_BEGIN(MSG_ONE, MSG_Radar, 0, *(_DWORD *)(v38 + 520));
            v77 = ENTINDEX(*(_DWORD *)(*(_DWORD *)(_ESI + 4) + 520));
            WRITE_BYTE(v77);
            WRITE_COORD(*(_DWORD *)(*(_DWORD *)(_ESI + 4) + 8));
            WRITE_COORD(*(_DWORD *)(*(_DWORD *)(_ESI + 4) + 12));
            WRITE_COORD(*(_DWORD *)(*(_DWORD *)(_ESI + 4) + 16));
            MESSAGE_END();
        }
    }
}
This is part of CBasePlayer::UpClientData()
Code:
if ( *(_DWORD *)(v36 + 456) == *(_DWORD *)(_ESI + 456) )
esi register store the client's pointer from 1 to maxclient
this checks if the clients are in the same team and should update the data(sending msg_radar)
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
Rossonero
Senior Member
Join Date: Mar 2009
Location: Location
Old 08-20-2010 , 06:56   Re: enemy on radar
Reply With Quote #3

what about showing the radar of the player we are spectating?
useful for admin use, specially when trying to see if the player is going to pick up the bomb or not
__________________
signature
Rossonero is offline
sb123
Senior Member
Join Date: Jan 2007
Old 08-20-2010 , 15:09   Re: enemy on radar
Reply With Quote #4

please give me a full code
sb123 is offline
Send a message via ICQ to sb123 Send a message via MSN to sb123 Send a message via Yahoo to sb123
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-20-2010 , 15:12   Re: enemy on radar
Reply With Quote #5

You are in the scripting section, meaning you are willing to learn. If not, that's not the right section for you.
__________________
Arkshine is offline
sb123
Senior Member
Join Date: Jan 2007
Old 08-21-2010 , 07:39   Re: enemy on radar
Reply With Quote #6

i try
but i can't
sb123 is offline
Send a message via ICQ to sb123 Send a message via MSN to sb123 Send a message via Yahoo to sb123
jim_yang
Veteran Member
Join Date: Aug 2006
Old 08-22-2010 , 03:51   Re: enemy on radar
Reply With Quote #7

I tested this
Code:
if ( *(_DWORD *)(v36 + 456) == *(_DWORD *)(_ESI + 456) )
changed to
Code:
if ( *(_DWORD *)(v36 + 456) != *(_DWORD *)(_ESI + 456) )
the radar doesn't work properly
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
sb123
Senior Member
Join Date: Jan 2007
Old 08-22-2010 , 04:06   Re: enemy on radar
Reply With Quote #8

yes..i test again
__________________
sb123 is offline
Send a message via ICQ to sb123 Send a message via MSN to sb123 Send a message via Yahoo to sb123
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 21:57.


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