Raised This Month: $ Target: $400
 0% 

GPS block on BlockMaker


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
diablix
Senior Member
Join Date: Jan 2010
Location: Warsaw, Poland
Old 12-10-2011 , 11:16   Re: GPS block on BlockMaker
Reply With Quote #2

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;

diablix is offline
Send a message via Skype™ to diablix
 



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 20:59.


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