AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Last Seen Player (https://forums.alliedmods.net/showthread.php?t=50830)

Phantom Warrior 02-04-2007 17:43

Last Seen Player
 
Hello, and good evening to all, hope your watching the SuperBowl /Go COLTS!

Anyway:

I need help on Part of my plugin, This first half is going to relate on: /lastseen which will in chat(ADVANCED DEFINITION: CTSAY) display a message, leave the message space blank if you will. But this chat command should tell you the last player you saw was and there HP. If you will please produce this code for me. I thank anyone who helps me, and help's me out with my problem. Your help will be engraved(if you will) Into the code and post, onced released.

Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Chat Commands"
#define VERSION "0.1"
#define AUTHOR "Phantom Warrior"


public plugin_init() {
    register_plugin(Chat Commands, 0.1, Phantom Warrior)
   
    register_clcmd("say /lastseen", "SeenPlayer")
}


Lord_Destros 02-05-2007 22:22

Re: Last Seen Player
 
Your register_plugin was done wrong :lol:.

Add quotes around your parameters or replace them with PLUGIN, VERSION, and AUTHOR.

Code:

#include <amxmodx>
#include <engine>

new lastseen[33]

public plugin_init()
{
        register_plugin("Chat Commands", "0.1", "Phantom Warrior")
   
        register_clcmd("say /lastseen", "SeenPlayer")

        register_event("ResetHUD","resetHUD","b")
}

public client_PreThink(id)
{
        new target,body
        get_user_aiming(id,target,body,100)
        if (target != 0)
                lastseen[id] = target
}

public SeenPlayer(id)
{
        new name[33]
        get_user_name(lastseen[id],name,32)
        if (lastseen[id] != 0)
                client_print(id,print_chat,"You last saw %s who currently has %d health.",name,get_user_health(lastseen[id]))
        else
                client_print(id,print_chat,"You have not seen anyone since your last the last time you spawned.")
}

public client_disconnect(id)
{
        lastseen[id] = 0
}

public resetHUD(id)
{
        lastseen[id] = 0
}

You don't need to add me in the credits.

EDIT: Errrm, left something out when I originally posted.

Phantom Warrior 02-05-2007 23:11

Re: Last Seen Player
 
Ok, I shall PM you.

Read.

Zenith77 02-07-2007 22:58

Re: Last Seen Player
 
Lord Destros, you're method won't work. With this you have to actually aim at them in order to "see" them. When in reality you can see them without aiming at them. Just use is_in_viewcone() in a player loop.

Lord_Destros 02-08-2007 00:09

Re: Last Seen Player
 
Quote:

Originally Posted by Zenith77 (Post 436983)
Lord Destros, you're method won't work. With this you have to actually aim at them in order to "see" them. When in reality you can see them without aiming at them. Just use is_in_viewcone() in a player loop.

I intentionally did it so that you have to aim at them (with cross hair). Theres a few game play issues with your method.

1. When you use the command you probably want to see the person you just shot remaining HP. Not the person you last saw (which may be an ally or simply a person you don't care about).

2. I'm not sure if your method would work if there are 2 people in your view.

3. Gaben.

Adding a cvar may not be bad however........

lunarwolfx 02-08-2007 00:15

Re: Last Seen Player
 
Quote:

2. I'm not sure if your method would work if there are 2 people in your view.
It'll just take whatever player is looped last in the view cone.

Zenith77 02-08-2007 09:14

Re: Last Seen Player
 
Or, you could just take the closest one.


All times are GMT -4. The time now is 00:39.

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