Raised This Month: $ Target: $400
 0% 

Native error... Why?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AbeX
Junior Member
Join Date: Mar 2007
Old 03-17-2007 , 10:25   Native error... Why?
Reply With Quote #1

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

#define PLUGIN "Demo Auto Record"
#define VERSION "1.0"
#define AUTHOR "AbeX"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("abex_demo_time""5.0"
}

public 
client_putinserver(id) {
    new 
params[1]
    
params[0] = id
    set_task
(get_cvar_float("abex_demo_time"),"startrecord",id,params,1);
}

public 
startrecord(params[], id) {

    new 
playerid params[0]
    
    if(
is_user_connected(playerid))  {
        new 
datetime[9]
        
get_time("%m-%d-%Y_%H-%M-%S",datetime,20
        
        new 
name[50]
        
get_user_name(playerid,name,49)
        
        new 
map[50]
        
get_mapname(map,49)    
        
        
log_amx("Demo: Recording player '%s' on map '%s' at datetime '%s'",name,map,datetime)
        
        
client_print(playerid,print_chat,"* Recording demo %s_%s_%s.dem",name,map,datetime)
        
        
client_cmd(playerid"record %s_%s_%s.dem",name,map,datetime)    
    }
    
remove_task(id)
    
    return 
PLUGIN_HANDLED

Quote:
L 03/17/2007 - 16:06:40: Invalid player id 54
L 03/17/2007 - 16:06:40: [AMXX] Displaying debug trace (plugin "abex_demo.amxx")
L 03/17/2007 - 16:06:40: [AMXX] Run time error 10: native error (native "client_print")
L 03/17/2007 - 16:06:40: [AMXX] [0] abex_demo.sma::startrecord (line 37)
AbeX is offline
AbeX
Junior Member
Join Date: Mar 2007
Old 03-27-2007 , 13:01   Re: Native error... Why?
Reply With Quote #2

mm?
AbeX is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 03-27-2007 , 13:44   Re: Native error... Why?
Reply With Quote #3

use another method. I don't think if params is required there, because you just need the id . Set to id an number like 4985 and on
public
startrecord use taskid -
4985 to get the playerid
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
pRED*
Join Date: Dec 2006
Old 03-27-2007 , 19:17   Re: Native error... Why?
Reply With Quote #4

you shouldn't need to pass an array.
The 'id' you passed with the timer will contain the users id num..

Just use that.

Remove the params and the 1 from set_task.
Change the function to only have id at the start. Change all playerid 's to id.

No need to remove task. Since you didn't specify any flags it will only run once and then remove itself.

Last edited by pRED*; 03-27-2007 at 19:20.
pRED* is offline
Reply



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 07:29.


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