Raised This Month: $ Target: $400
 0% 

modified killcam help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lailoken
Junior Member
Join Date: Oct 2006
Old 10-20-2006 , 00:35   modified killcam help
Reply With Quote #1

I found a copy of Take13's killcam and tried to modify it so it'd only take a screenshot when someone makes a kill, once.

I wanted to be able to type into the console, amx_ss <player>, and have it disabled after they make a kill.

This is like the 4th hack into the code I did, the first hack worked out really well for me, when I loaded it onto my listen server, and amx_ss'd myself and got a couple screenshots, the results were as I expected.

However, when I uploaded it to the pub server, it wouldn't work, something about the id being 0 (further investigation indicates an index of 0 when using set_user_info is the server itself), which is clearly not the result I wanted.

I did some looking at some other code and tried to mash some codes together to make things work, but alas, no matter what I throw at the script, it keeps returning 0, and causing a runtime error on the script.

Code:
#include <amxmodx>
#include <amxmisc>

public killevent() {

    new kinfo[8];
    new kid = read_data (1);
    new vid = read_data (2);
    new msg[128];

    get_user_info (kid, "killcam", kinfo, sizeof(kinfo));
    
    if (equal (kinfo, "on", 0)) {
        if ((kid != vid) && (kid != 0)) {        
            set_hudmessage(255, 200, 000, 0.05, 0.7, 2, 0.02, 12.0, 0.0, 0.2, 4);
            
            format (msg, sizeof(msg), "Killcam took snapshot");
            show_hudmessage (kid, msg);
            client_cmd (kid, "snapshot");
            set_user_info (kid, "killcam", "off");
        }
    }

    return PLUGIN_HANDLED
}

public plugin_init(){
    register_plugin("Take13 KillCam", "0.1a", "GIR");
    register_event("DeathMsg", "killevent", "a");
    register_concmd("amx_ss", "cmdScreenShot", ADMIN_IMMUNITY, "<name>");
    return PLUGIN_CONTINUE
}

public cmdScreenShot(id, level, cid)
{
    new arg[32];
    new msg[128];
    read_argv(1, arg, 31)

    if (!cmd_access(id, level, cid, 2))
        return PLUGIN_HANDLED
        
    new player = cmd_target(id, arg, 1)
    
    if (!player) 
    {
        console_print (id, "AMXX_SS %L not valid!", id)
        return PLUGIN_HANDLED
    }
    set_user_info (player, "killcam", "on");
    set_hudmessage(255, 200, 000, 0.05, 0.7, 2, 0.02, 12.0, 0.0, 0.2, 4);
            
    format (msg, sizeof(msg), "Killcam Enabled!");
    
    return PLUGIN_HANDLED
}
Am I at least going in the right direction?

lailoken
lailoken is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-20-2006 , 00:41   Re: modified killcam help
Reply With Quote #2

instead of using user_info, you should just make a global array (ex. bool:KillCam[33]) and use that instead. (there are problems with user_info)
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
lailoken
Junior Member
Join Date: Oct 2006
Old 10-20-2006 , 12:08   Re: modified killcam help
Reply With Quote #3

I'm not even sure how to go about doing that.

This pretty much is my experience with pawn. My only other experience with pawn is modifying some runes for runemod 2 (more or less changing certain values, hehe)

Other than that, my coding experience is pretty much limited to mIRC scripts, php, some visual basic (pre- .net) and some C (took a class, can't remember much of it...)

Maybe an example line involving that Bool::KillCam[33] so I can try?

lailoken
lailoken is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-20-2006 , 12:11   Re: modified killcam help
Reply With Quote #4

If you took a class in C you should remeber what a global variable is or if you don't you should read the basic tutorials for AMXX.

Code:
// Declare global vars out side of functions, prefeably under the header and before plugin_init() #include <amxmodx> new bool:gKillCam[33]; public plugin_init() {      // Code... }
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-20-2006 , 17:48   Re: modified killcam help
Reply With Quote #5

Code:
    //set_user_info (player, "killcam", "on")
    gKillCam[id] = true

    //set_user_info (player, "killcam", "off")
    gKillCam[id] = false
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Reply


Thread Tools
Display Modes

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 04:52.


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