AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help make the map a player when it comes to T flag (https://forums.alliedmods.net/showthread.php?t=171294)

kent4 11-04-2011 10:47

help make the map a player when it comes to T flag
 
PHP Code:

#define DAMAGE_RECIEVED
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fun>
#define VIP_FLAG ADMIN_LEVEL_H


public plugin_init()
{
    
register_plugin("VIP Privileges""1.1""Kent-4");
    
register_event("HLTV""event_round_start""a""1=0""2=0");
    
register_event("ResetHUD""ResetHUD""be")
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
    
    
register_clcmd("say /adminka""adminka");
    
register_clcmd("say /vip","ShowMotd");
    
register_clcmd("say""handle_say");
    }

public 
plugin_precache() 
{
    
precache_model("models/player/vip_t/vip_t.mdl")
    
precache_model("models/player/vip_ct/vip_ct.mdl")
        return 
PLUGIN_CONTINUE
}

public 
fwHamPlayerSpawnPost(id
{
        if (
get_user_flags(id) & VIP_FLAG
        {
                new 
CsTeams:userTeam cs_get_user_team(id)
                if (
userTeam == CS_TEAM_T) {
                        
cs_set_user_model(id"vip_t")
                }
                else if(
userTeam == CS_TEAM_CT) {
                        
cs_set_user_model(id"vip_ct")
                }
                else {
                        
cs_reset_user_model(id)
                }
        }

        return 
PLUGIN_CONTINUE
}

public 
client_putinserver(id)
{
    
set_task(0.1"vip_connect"id);
}

public 
vip_connect(id)
{
if ( 
get_user_flags id ) & VIP_FLAG )
    {
        new 
name[32];
        
get_user_name(idname31);
        
client_print(0,print_chat"Внимание подключился VIP"name)
    }
return 
PLUGIN_HANDLED
}
public 
ResetHUD(id)
{
    
set_task(0.5"VIP"id 6910)
}
public 
VIP(TaskID)
{
    new 
id TaskID 6910
    
    
if ( get_user_flags id ) & VIP_FLAG )
    {
        
message_begin(MSG_ALLget_user_msgid("ScoreAttrib"))
        
write_byte(id)
        
write_byte(4)
        
message_end()
        
give_item(id,"weapon_hegrenade")
        
give_item(id,"weapon_flashbang")
        
give_item(id,"weapon_flashbang")
        
give_item(id,"weapon_smokegrenade")
        
give_item(id,"item_assaultsuit")    
    }
    
    return 
PLUGIN_HANDLED
}

public 
ShowMotd(id)
{
 
show_motd(id"vip.txt")
}

public 
adminka(id)
{
 
show_motd(id"adminka.txt")
}

stock ChatColor(const id, const input[], any:...) 
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!team""^3"// Team Color
    
replace_all(msg190"!team2""^0"// Team2 Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1251\\ deff0\\ deflang1049{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/ 

plug-in compiles, but does not work
player when it comes to the flag T, there is no chat messages

the mistake in my code?

Bugsy 11-04-2011 12:18

Re: help make the map a player when it comes to T flag
 
Add is_user_alive() check to ham spawn forward. If you're referring to the connecting player not seeing the msg then your problem is probably the short set_task() interval, the player probably hasn't been shown the MOTD yet, change to atleast 4.0. if you don't care about player seeing msg then do client print directly in putinserver, set_task serves no purpose. Double check that T==ADMIN_LEVEL_H? Any errors?

joshknifer 11-04-2011 12:22

Re: help make the map a player when it comes to T flag
 
Quote:

Originally Posted by kent4 (Post 1589808)
PHP Code:

#define VIP_FLAG ADMIN_LEVEL_H 

player when it comes to the flag T, there is no chat messages

Maybe this is your issue?

kent4 11-04-2011 12:28

Re: help make the map a player when it comes to T flag
 
PHP Code:

public client_putinserver(id

    
set_task(0.7"vip_connect"id); 


so?

joshknifer 11-04-2011 12:36

Re: help make the map a player when it comes to T flag
 
Quote:

Originally Posted by kent4 (Post 1589892)
PHP Code:

public client_putinserver(id

    
set_task(0.7"vip_connect"id); 


so?

You said you were having problems with the "T" flag. VIP Flag is set to "H"

kent4 11-04-2011 13:06

Re: help make the map a player when it comes to T flag
 
Quote:

Originally Posted by amxconst.inl
#define ADMIN_LEVEL_H (1<<19) /* flag "t" */

All I have right

Bugsy 11-04-2011 13:23

Re: help make the map a player when it comes to T flag
 
ADMIN_LEVEL_H isn't the same as flag "h" in users.ini..joshknifer

joshknifer 11-04-2011 14:09

Re: help make the map a player when it comes to T flag
 
Quote:

Originally Posted by Bugsy (Post 1589929)
ADMIN_LEVEL_H isn't the same as flag "h" in users.ini..joshknifer

Yeah i see that. Thanks for the heads up :)

kent4 11-04-2011 14:11

Re: help make the map a player when it comes to T flag
 
So what? can someone help here?


All times are GMT -4. The time now is 14:18.

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