AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Aiming the teammate and enemy info (https://forums.alliedmods.net/showthread.php?t=147257)

GarbageBox 01-07-2011 09:50

Aiming the teammate and enemy info
 
This code is I write, but as everyone know I am a newbie.
This time, I want to ask how can I to detect a player are aiming enemy?
As you look, I use "if(... == CS_TEAM_T){set_hudmessage....}" below. But I want to also add if when the player are terrorists, they aim the enemy also show the hud message.
I try to add else in if (... == ...), but it seem a wrong structure...
I dont know how to do it.
Code:

#include <amxmodx>
#include <cstrike>

#define PLUGIN "Aim replacer"
#define VERSION "1.0"
#define AUTHOR ".:)"

new SzTeamMates[32]

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_event("StatusValue", "set_team", "be", "1=1")
        register_event("StatusValue", "show_status", "be", "1=2", "2!0")
        register_event("StatusValue", "hide_status", "be", "1=1", "2=0")
       
        return PLUGIN_CONTINUE
}

public set_team(id)
{
        SzTeamMates[id] = read_data(2)
}       
       
public hide_status(id)
{
        set_hudmessage(0, 0, 0, 0.0, 0.0, 0, 0.0, 0.01, 0.0, 0.0, 4)
        show_hudmessage(id, "")
}

public show_status(id)
{
        new SzName[32], SzPid = read_data(2)
        get_user_name(SzPid, SzName, 31)
        new CsTeams:SzUserTeam = cs_get_user_team(id)
        if (SzTeamMates[id] == 1)
        {
                new SzClip, SzAmmo, SzSzWpnId = get_user_weapon(SzPid, SzClip, SzAmmo)
                new SzWpnName[32]
                get_weaponname(SzSzWpnId, SzWpnName, 31)
                if(SzUserTeam == CS_TEAM_T)
                {
                        set_hudmessage(0, 50, 255, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, 4)
                        show_hudmessage(id, "%s^n%d HP^n%d AP^n%s", SzName, get_user_health(SzPid) ,get_user_armor(SzPid), SzWpnName[7])
                }
                else
                if(SzUserTeam == CS_TEAM_CT)
                {
                        set_hudmessage(255, 50, 0, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, 4)
                        show_hudmessage(id, "%s^n%d HP^n%d AP^n%s", SzName, get_user_health(SzPid) ,get_user_armor(SzPid), SzWpnName[7])
                }
        }
}



All times are GMT -4. The time now is 01:57.

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