AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   GPS block on BlockMaker (https://forums.alliedmods.net/showthread.php?t=173461)

nikolov 12-05-2011 14:10

GPS block on BlockMaker
 
I search action code of blockmaker who shows where is CT's and TT's players.
Example with Paint Image...
http://img846.**************/img846/6398/showw.png

Sry about my bad creation with PAINT...

With another words... When player steppeed on this block will show Red and Blue lines. To CT (blue lines) players and (red lines) to TT players.

CT - Counter-Terrorists Team
TT - Terrorists Team

Sry about my english...

diablix 12-10-2011 11:16

Re: GPS block on BlockMaker
 
I didn't make this action to show all players, your dedicated server wouldn't feel good with action like that.. Instead, I made action that will show your neariest enemy.

PHP Code:

enum Type {
    
DONT_IGNORE_TEAMMATES,
    
IGNORE_TEAMMATES
};

new 
g_sSprLaser;

public 
plugin_precache() g_sSprLaser engfunc(EngFunc_PrecacheModel"sprites/laserbeam.spr");

public 
actionGps(id){
    new 
iClosestEnemy getClosestPlayer(idIGNORE_TEAMMATES);
    
    if(
is_user_alive(iClosestEnemy))
        
createColouredLineByTeam(idiClosestEnemy);
    else{
        
set_hudmessage(2552552550.030.3400.10.10.20.2);
        
show_hudmessage(id"Could not find any available enemies.");
    }
}

stock createColouredLineByTeam(idiTarget){
    new 
Float:fOrigin[0x2][0x3], iColor[0x3];
    
pev(idpev_originfOrigin[0]);
    
pev(iTargetpev_originfOrigin[1]);
    
    if(
get_user_team(iTarget)==0x2)
        
iColor[2]=0xFF;
    else
        
iColor[0]=0xFF;
    
    
message_begin(MSG_ONESVC_TEMPENTITY, {0x00x00x0}, id);
    
write_byte(0x0);
    
engfunc(EngFunc_WriteCoordfOrigin[0x0][0x0]);
    
engfunc(EngFunc_WriteCoordfOrigin[0x0][0x1]);
    
engfunc(EngFunc_WriteCoordfOrigin[0x0][0x2]);
    
engfunc(EngFunc_WriteCoordfOrigin[0x1][0x0]);
    
engfunc(EngFunc_WriteCoordfOrigin[0x1][0x1]);
    
engfunc(EngFunc_WriteCoordfOrigin[0x1][0x2]);
    
write_short(g_sSprLaser);
    
write_byte(0x3);
    
write_byte(0x0);
    
write_byte(0x1);
    
write_byte(0xA);
    
write_byte(0x0);
    
write_byte(iColor[0x0]);
    
write_byte(iColor[0x1]);
    
write_byte(iColor[0x2]);
    
write_byte(0x40);
    
write_byte(0x0);
    
message_end();
}

stock getClosestPlayer(idType:ignoreteammates){
    new 
iPlayers[0x20], Float:flClosestDist 9999.9Float:flDistFloat:fOrigin[0x2][0x3], iNumiPlayeriClosestPlayer;
    
ignoreteammates get_players(iPlayersiNum"ache"get_user_team(id) == "TERRORIST" "CT") : get_players(iPlayersiNum"ach");
    
    for(new 
0iNumi++){    
        
iPlayer iPlayers[i];
        
        
pev(iPlayerpev_originfOrigin[0x0]);
        
pev(idpev_originfOrigin[0x1]);
        
        
flDist get_distance_f(fOrigin[0x0], fOrigin[0x1]);
        
        if(
flDist <= flClosestDist){
            
iClosestPlayer     iPlayer;
            
flClosestDist     flDist;
        }
    }
    if(
is_user_alive(iClosestPlayer))
        return 
iClosestPlayer;
    
    return -
1;



nikolov 12-10-2011 14:12

Re: GPS block on BlockMaker
 
10x a lot of... Can you modify code to show lines from all ? When CT stepp on block this line can be seen from TT...

diablix 12-11-2011 04:50

Re: GPS block on BlockMaker
 
PHP Code:

message_begin(MSG_ONESVC_TEMPENTITY, {0x00x00x0}, id); 


->
PHP Code:

message_begin(MSG_ALLSVC_TEMPENTITY); 



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

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