AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   0000 (https://forums.alliedmods.net/showthread.php?t=188974)

omer 07-02-2012 10:10

0000
 
0000

Neeeeeeeeeel.- 07-02-2012 10:16

Re: [HELP] problem in plugin set_user_rendering
 
Enable debug and show errors.

MiniBrackeur 07-02-2012 11:46

Re: [HELP] problem in plugin set_user_rendering
 
Do you tried that ?
PHP Code:

public ham_PlayerSpawn_Postid )
{
    if( 
is_user_aliveid ) )
    {
        if( 
g_bAdminMode )
        {
            
BlockBuyZones()
            
give_itemid"weapon_m249" )
            
cs_set_user_bpammoidCSW_M249200 )
            
engclient_cmdid"weapon_m249" )
            
            if(
access(idADMIN) || access(idSILVER) || access(idGOLDEN))
            {
                
BlockBuyZones()
                
strip_user_weapons(id)
                
engclient_cmdid"weapon_knife" )
                
set_user_rendering(idkRenderFxNone000kRenderTransAlpha 0);
            } else {
                
UnblockBuyZones()
                
set_user_rendering(id)
            }
        }
    }



MiniBrackeur 07-02-2012 12:57

Re: [HELP] problem in plugin set_user_rendering
 
Try this, I have added a check for round end..

PHP Code:

#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
#include <fakemeta_util>
#include <fakemeta >

#define ADMIN   ADMIN_RCON 
#define SILVER  ADMIN_LEVEL_G 
#define GOLDEN  ADMIN_LEVEL_H 

#define PLUGIN "DKS Invisible"
#define VERSION "0.2"
#define AUTHOR "Dubai King Server"

enum ChatColor 

CHATCOLOR_NORMAL 1
CHATCOLOR_GREEN
CHATCOLOR_TEAM_COLOR
CHATCOLOR_GREY,      
CHATCOLOR_RED,    
CHATCOLOR_BLUE,      
}

new 
bool:gBlockBuyZone;
new 
boolg_bAdminMode;
new 
gMsgStatusIcon;
new 
uflags[33];

new 
g_iMaxPlayers

public client_putinserver(id)
{
if(
get_user_flags(id)&ADMIN
    
uflags[id] = ADMIN 
    
else if(get_user_flags(id)&GOLDEN)
        
uflags[id] = GOLDEN
    
else if(get_user_flags(id)&SILVER)
        
uflags[id] = SILVER
    
else
        
uflags[id] = 
}


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHamHam_Spawn"player""ham_PlayerSpawn_Post");
    
register_logevent("logevent_round_end"2"1=Round_End");
    
register_concmd"dks_invisible""Cmd_AdminMode"ADMIN|SILVER|GOLDEN);
    
gMsgStatusIcon get_user_msgid("StatusIcon");
    
register_message(gMsgStatusIcon"MessageStatusIcon");
    
    
register_event"HLTV""Event_RoundStart""a""1=0""2=0" );
    
g_iMaxPlayers get_maxplayers()
}

public 
logevent_round_end()
{
    if( 
g_bAdminMode 
    { 
        for(new 
idid <= g_iMaxPlayersid++)
        {
            
set_user_rendering(id)
        }
    }
}

public 
MessageStatusIcon(msgIDdestreceiver) {
    
    
// Check if status is to be shown
    
if(gBlockBuyZone && get_msg_arg_int(1)) {
        
        new const 
buyzone[] = "buyzone";
        
        
// Grab what icon is being shown
        
new icon[sizeof(buyzone) + 1];
        
get_msg_arg_string(2iconcharsmax(icon));
        
        
// Check if buyzone icon
        
if(equal(iconbuyzone)) {
            
            
// Remove player from buyzone
            
RemoveFromBuyzone(receiver);
            
            
// Block icon from being shown
            
set_msg_arg_int(1ARG_BYTE0);
            
        }
        
    }
    
    return 
PLUGIN_CONTINUE;
    
}

BlockBuyZones() {
    
    
// Hide buyzone icon from all players
    
message_begin(MSG_BROADCASTgMsgStatusIcon);
    
write_byte(0);
    
write_string("buyzone");
    
message_end();
    
    
// Get all alive players
    
new players[32], pnum;
    
get_players(playerspnum"a");
    
    
// Remove all alive players from buyzone
    
while(pnum-- > 0) {
        
RemoveFromBuyzone(players[pnum]);
    }
    
    
// Set that buyzones should be blocked
    
gBlockBuyZone true;
    
}

RemoveFromBuyzone(id) {
    
    
// Define offsets to be used
    
const m_fClientMapZone 235;
    const 
MAPZONE_BUYZONE = (<< 0);
    const 
XO_PLAYERS 5;
    
    
// Remove player's buyzone bit for the map zones
    
set_pdata_int(idm_fClientMapZoneget_pdata_int(idm_fClientMapZoneXO_PLAYERS) & ~MAPZONE_BUYZONEXO_PLAYERS);
    
}

UnblockBuyZones() {
    
    
// Set that buyzone should not be blocked
    
gBlockBuyZone false;
    
}

public 
Event_RoundStart()
{
    if( 
g_bAdminMode )
        
set_task1.0"task_AdminMode" );
}

public 
ham_PlayerSpawn_Postid 

    if( 
is_user_aliveid ) ) 
    { 
        if( 
g_bAdminMode 
        { 
            
BlockBuyZones() 
            
give_itemid"weapon_m249" 
            
cs_set_user_bpammoidCSW_M249200 
            
engclient_cmdid"weapon_m249" 
             
            if(
access(idADMIN) || access(idSILVER) || access(idGOLDEN)) 
            { 
                
BlockBuyZones() 
                
strip_user_weapons(id
                
engclient_cmdid"weapon_knife" 
                
set_user_rendering(idkRenderFxNone000kRenderTransAlpha 0); 
            } else { 
                
UnblockBuyZones() 
                
set_user_rendering(id
            } 
        } 
    } 


public 
Cmd_AdminModeidlevelcid )
{
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED;
    
    if( 
g_bAdminMode )
        
g_bAdminMode false;
    else    
g_bAdminMode true;
    
    
g_bAdminMode true
    
new szName[32],level[10];
    
get_user_nameidszName31 );
    
get_level_by_flag(id,level);
    
    
    
colorChat(0,CHATCOLOR_NORMAL,"$g[$tDKS$g]$n Invisible mode will start on next round",szName,level);
    
client_print(idprint_chat"[DKS] Invisible mode activated by %s [%s]",szName,level);
    
set_hudmessage(25500, -1.00.026.0120.0)
    
show_hudmessage(id"Invisible mode will start on next round")
    return 
PLUGIN_HANDLED;
}

public 
task_AdminMode()
{
    
g_bAdminMode false;
}

get_level_by_flag(id,level[]){ 
    switch(
uflags[id]){ 
        case 
ADMINcopy(level,13,"ADMIN"
            case 
SILVERcopy(level,13,"SILVER"
            case 
GOLDENcopy(level,13,"GOLDEN"
        } 

colorChat(idChatColor:color, const msg[], {Float,Sql,Result,_}:...) 

new 
teamindexMSG_Type 
new bool:teamChanged false 
static message[192
switch(
color

    case 
CHATCOLOR_NORMAL// Normal 
    

        
message[0] = 0x01
    } 
    case 
CHATCOLOR_GREEN// Green 
    

        
message[0] = 0x04
    } 
    default: 
// Grey, Red, Blue 

    
message[0] = 0x03


vformat(message[1], 190msg4); 
replace_all(message190"$g""^x04"
replace_all(message190"$n""^x01"
replace_all(message190"$t""^x03"
if(
id == 0

index findAnyPlayer() 
MSG_Type MSG_ALL

else 

index id
MSG_Type MSG_ONE

if(
index != 0

team get_user_team(index);     
if(
color == CHATCOLOR_RED && team != 1

    
messageTeamInfo(indexMSG_Type"TERRORIST"
    
teamChanged true 

else 
    if(
color == CHATCOLOR_BLUE && team != 2
    { 
        
messageTeamInfo(indexMSG_Type"CT"
        
teamChanged true 
    

    else 
        if(
color == CHATCOLOR_GREY && team != 0
        { 
            
messageTeamInfo(indexMSG_Type,""
            
teamChanged true 
        
}
messageSayText(indexMSG_Typemessage);
if(
teamChanged
        { 
            
messageTeamInfo(indexMSG_Type"SPECTATOR")  
        } 
    } 

messageSayText(idtypemessage[]) 

message_begin(typeget_user_msgid("SayText"), _id
write_byte(id)     
write_string(message
message_end() 

messageTeamInfo(idtypeteam[]) 

message_begin(typeget_user_msgid("TeamInfo"), _id
write_byte(id
write_string(team
message_end() 

findAnyPlayer() 

static 
players[32], inumpid 

get_players
(playersinum"ch"

for (new 
0inuma++) 

pid players[a
if(
is_user_connected(pid)) 
return 
pid 


return 



This remove all rendering for all players.

MiniBrackeur 07-02-2012 13:56

Re: [HELP] problem in plugin set_user_rendering
 
Ok, replace:
Quote:

set_user_rendering(id) => set_user_rendering(id, kRenderFxNone, 0,0,0, kRenderNormal, 255)


All times are GMT -4. The time now is 15:21.

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