AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How To Fix Run time errors (https://forums.alliedmods.net/showthread.php?t=20163)

joka69 11-02-2005 21:04

How To Fix Run time errors
 
Dose anyone have any ideas how to fix run time errors :roll:

Code:

L 11/02/2005 - 19:28:11: [ENGINE] Invalid player 11
L 11/02/2005 - 19:28:11: [AMXX] Displaying debug trace (plugin "adminlisten.amxx")
L 11/02/2005 - 19:28:11: [AMXX] Run time error 10: native error (native "set_speak")
L 11/02/2005 - 19:28:11: [AMXX]    [0] adminlisten.sma::client_infochanged (line 48)
L 11/02/2005 - 19:28:11: [ENGINE] Invalid player 11
L 11/02/2005 - 19:28:11: [AMXX] Displaying debug trace (plugin "adminlisten.amxx")
L 11/02/2005 - 19:28:11: [AMXX] Run time error 10: native error (native "set_speak")
L 11/02/2005 - 19:28:11: [AMXX]    [0] adminlisten.sma::client_infochanged (line 48)
L 11/02/2005 - 19:31:33:
L 11/02/2005 - 19:39:49: [ENGINE] Invalid player 9
L 11/02/2005 - 19:39:49: [AMXX] Displaying debug trace (plugin "adminlisten.amxx")
L 11/02/2005 - 19:39:49: [AMXX] Run time error 10: native error (native "set_speak")
L 11/02/2005 - 19:39:49: [AMXX]    [0] adminlisten.sma::client_infochanged (line 48)
L 11/02/2005 - 19:39:49: [ENGINE] Invalid player 9
L 11/02/2005 - 19:39:49: [AMXX] Displaying debug trace (plugin "adminlisten.amxx")
L 11/02/2005 - 19:39:49: [AMXX] Run time error 10: native error (native "set_speak")
L 11/02/2005 - 19:39:49: [AMXX]    [0] adminlisten.sma::client_infochanged (line 48)
L 11/02/2005 - 19:40:01: [ENGINE] Invalid player 9
L 11/02/2005 - 19:40:01: [AMXX] Displaying debug trace (plugin "adminlisten.amxx")
L 11/02/2005 - 19:40:01: [AMXX] Run time error 10: native error (native "set_speak")
L 11/02/2005 - 19:40:01: [AMXX]    [0] adminlisten.sma::client_infochanged (line 48)
L 11/02/2005 - 19:40:01: [ENGINE] Invalid player 9
L 11/02/2005 - 19:40:01: [AMXX] Displaying debug trace (plugin "adminlisten.amxx")
L 11/02/2005 - 19:40:01: [AMXX] Run time error 10: native error (native "set_speak")
L 11/02/2005 - 19:40:01: [AMXX]    [0] adminlisten.sma::client_infochanged (line 48)


haimmaik 11-02-2005 21:12

can we see the script?

Hawk552 11-02-2005 21:13

Add

Code:
if(!is_user_connected(id)) return 0;

Somewhere

It would help a lot if you posted the source, there's like 20 versions of admin listen floating around.

joka69 11-02-2005 21:41

Sry i should have done that :oops:
Code:
#include <amxmodx> #include <amxmisc> #include <engine> // Counter for the SayText event. new count[32][32]     new g_voice_status[2] public plugin_init(){    register_plugin("AdminListen","2.3x","/dev/ urandom")    register_srvcmd("amx_adminlisten_voice","voice_status")    register_event("SayText","catch_say","b")    return PLUGIN_CONTINUE } public plugin_modules(){    require_module("engine") } public client_infochanged(id) {    if ((get_user_flags(id) & ADMIN_LEVEL_B) && equal(g_voice_status,"1")) set_speak(id, 4) } public client_connect(id) {    if ((get_user_flags(id) & ADMIN_LEVEL_B) && equal(g_voice_status,"1")) set_speak(id, 4) } public voice_status(){    read_argv(1,g_voice_status,1)    new player_count = get_playersnum()    new players[32] //Player IDs    get_players(players, player_count, "c")    for (new i = 0; i < player_count; i++) {       if ((get_user_flags(players[i]) & ADMIN_LEVEL_B)){                  if (equal(g_voice_status,"0")) set_speak(players[i], 0)          if (equal(g_voice_status,"1")) set_speak(players[i], 4)       }    } }   public catch_say(id) {     new reciever = read_data(0) //Reads the ID of the message recipient     new sender = read_data(1)   //Reads the ID of the sender of the message     new message[151]            //Variable for the message     new channel[151]     new sender_name[32]     if (is_running("czero")||is_running("cstrike"))     {         read_data(2,channel,150)         read_data(4,message,150)         get_user_name(sender, sender_name, 31)     } else {             read_data(2,message,150)     }         // DEBUG.     // console_print(0, "DEBUG MESSAGE: %s", message)     // console_print(0, "DEBUG channel: %s", channel)     // console_print(0, "DEBUG sender: %s, %i", sender_name, sender)     // console_print(0, "DEBUG receiver: %i", reciever)         //With the SayText event, the message is sent to the person who sent it last.     //It's sent to everyone else before the sender recieves it.     // Keeps count of who recieved the message     count[sender][reciever] = 1               // If current SayText message is the last then...     if (sender == reciever)     {                   new player_count = get_playersnum()  //Gets the number of players on the server             new players[32] //Player IDs             get_players(players, player_count, "c")             for (new i = 0; i < player_count; i++)         {             // If the player is an admin...                 if (get_user_flags(players[i]) & ADMIN_LEVEL_B)             {                     // If the player did not recieve the message then...                         if (count[sender][players[i]] != 1)                 {                                           message_begin(MSG_ONE, get_user_msgid("SayText"),{0,0,0},players[i])                             // Appends the ID of the sender to the message, so the engine knows what color to make the name.                             write_byte(sender)                             // Appends the message to the message (depending on the mod).                     if (is_running("czero")||is_running("cstrike"))                         {                         write_string(channel)                             write_string(sender_name)                         }                             write_string(message)                             message_end()                         }                 }                 count[sender][players[i]] = 0  //Set everyone's counter to 0 so it's ready for the next SayText             }     }         return PLUGIN_CONTINUE }

Hawk552 11-02-2005 21:51

Change these:

Code:
if ((get_user_flags(id) & ADMIN_LEVEL_B) && equal(g_voice_status,"1")) set_speak(id, 4)

To

Code:
if ((get_user_flags(id) & ADMIN_LEVEL_B) && equal(g_voice_status,"1") && is_user_connected(id)) set_speak(id, 4)

That probably won't do it, as get_user_flags checks if they're online anyway, but it doesn't hurt to try.

joka69 11-02-2005 22:02

Another error im getting :cry:

Code:

L 11/02/2005 - 20:09:26: [AMXX] Displaying debug trace (plugin "jedi_grab.amxx")
L 11/02/2005 - 20:09:26: [AMXX] Run time error 10: native error (native "entity_get_vector")
L 11/02/2005 - 20:09:26: [AMXX]    [0] jedigrab.sma::grabtask (line 124)
L 11/02/2005 - 20:09:26: [ENGINE] Invalid player 6 (not in-game)
L 11/02/2005 - 20:09:26: [AMXX] Displaying debug trace (plugin "jedi_grab.amxx")
L 11/02/2005 - 20:09:26: [AMXX] Run time error 10: native error (native "entity_get_vector")
L 11/02/2005 - 20:09:26: [AMXX]    [0] jedigrab.sma::grabtask (line 124)
(plugin "jedi_grab.amxx")
L 11/02/2005 - 20:09:27: [AMXX] Run time error 10: native error (native "entity_get_vector")
L 11/02/2005 - 20:09:28: [ENGINE] Invalid player 6 (not in-game)
L 11/02/2005 - 20:09:28: [AMXX] Displaying debug trace (plugin "jedi_grab.amxx")

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <engine> new grabbed[33] new grablength[33] new bool:grabmodeon[33] new velocity_multiplier new Throw_force #define JEDI ADMIN_LEVEL_A stock is_player(id) {     new players[32], inum     get_players(players,inum,"a")     for(new i = 1 ;i <= inum ;i++)     {         if (i == id)         {             return true         }     }     return false } public grabtask(parm[]) {     new id = parm[0]     new targetid, body     if (!grabbed[id])     {         get_user_aiming(id, targetid, body)         if (targetid)         {             set_grabbed(id, targetid)         }     }     if (grabbed[id])     {         new origin[3], look[3], direction[3], moveto[3], Float:grabbedorigin[3], Float:velocity[3], length         get_user_origin(id, origin, 1)         get_user_origin(id, look, 3)         entity_get_vector(grabbed[id], EV_VEC_origin, grabbedorigin)         direction[0]=look[0]-origin[0]         direction[1]=look[1]-origin[1]         direction[2]=look[2]-origin[2]         length = get_distance(look,origin)         if (!length) length=1 // avoid division by 0         moveto[0]=origin[0]+direction[0]*grablength[id]/length         moveto[1]=origin[1]+direction[1]*grablength[id]/length         moveto[2]=origin[2]+direction[2]*grablength[id]/length         velocity[0]=(moveto[0]-grabbedorigin[0])*velocity_multiplier         velocity[1]=(moveto[1]-grabbedorigin[1])*velocity_multiplier         velocity[2]=(moveto[2]-grabbedorigin[2])*velocity_multiplier         entity_set_vector(grabbed[id], EV_VEC_velocity, velocity)     } } //Toggles grab. public grab_toggle(id) {     if (get_cvar_num("amx_jedigrab"))     {         if (grabmodeon[id])             release(id)         else             grab(id)     }     else     {         client_print(id,print_chat,"[AMX] Jedi Grab has been disabled")     }     return PLUGIN_CONTINUE } //Actually does the grabbing. public grab(id) {     if (!(get_user_flags(id)&JEDI))     {         console_print(id,"[AMX] You have no access to that command")         return PLUGIN_CONTINUE     }     if (get_cvar_num("amx_jedigrab"))     {         if (!grabmodeon[id])         {             new targetid, body             new parm[1]             parm[0] = id             velocity_multiplier = get_cvar_num("sv_grabforce")             grabmodeon[id]=true             set_task(0.1, "grabtask", 100+id, parm, 1, "b")             get_user_aiming(id, targetid, body)             if (targetid)             {                 if (get_cvar_num("amx_jedigrab_playersonly"))                 {                     if (is_player(targetid))                         set_grabbed(id, targetid)                     else                         client_print(id,print_chat,"[AMX] You can only grab players")                                       }                 else                 {                     set_grabbed(id, targetid)                               }             }             else             {                 client_print(id,print_chat,"[AMX] Searching for a target")             }         }     }     else     {         client_print(id,print_chat,"[AMX] Jedi Grab has been disabled")     }             return PLUGIN_CONTINUE } //Releases the grab. public release(id) {     if (!(get_user_flags(id)&JEDI))     {         console_print(id,"[AMX] You have no access to that command")         return PLUGIN_CONTINUE     }     if (grabmodeon[id])     {         grabmodeon[id]=false         if (grabbed[id])         {             set_rendering(grabbed[id])             client_print(id,print_chat,"[AMX] You have released something!")         }         else         {             client_print(id,print_chat,"[AMX] No target found")         }         grabbed[id]=0         remove_task(100+id)     }     return PLUGIN_CONTINUE } public throw(id) {     if (!(get_user_flags(id)&JEDI))     {         console_print(id,"[AMX] You have no access to that command")         return PLUGIN_CONTINUE     }     if (grabbed[id])     {         Throw_force = get_cvar_num("sv_throwforce")         new Float:pVelocity[3]         VelocityByAim(id,Throw_force,pVelocity)         entity_set_vector(grabbed[id],EV_VEC_velocity,pVelocity)         client_print(id,print_chat,"[AMX] You have thrown something!")         grabbed[id]=0         grabmodeon[id]=false         set_rendering(grabbed[id])         remove_task(100+id)     }     return PLUGIN_CONTINUE } //Allows you to spec grab. public spec_event(id) {     new targetid = read_data(2)     if (targetid < 1 || targetid > 32)         return PLUGIN_CONTINUE     if (grabmodeon[id] && !grabbed[id])     {         set_grabbed(id, targetid)     }     return PLUGIN_CONTINUE } //Grabs onto someone public set_grabbed(id, targetid) {     new origin1[3], origin2[3], Float:forigin2[3]     get_user_origin(id, origin1)     entity_get_vector(targetid, EV_VEC_origin, forigin2)         set_rendering(targetid,kRenderFxGlowShell,get_cvar_num("sv_glowred"),get_cvar_num("sv_glowgreen"),get_cvar_num("sv_glowblue"), kRenderNormal, 16)     FVecIVec(forigin2, origin2)     grabbed[id]=targetid     grablength[id]=get_distance(origin1,origin2)     client_print(id,print_chat,"[AMX] You have grabbed something!") } public disttask(parm[]) {     new id = parm[0]     if (grabbed[id])     {         if (parm[1] == 1)         {             grablength[id] -= 35         }         else if (parm[1] == 2)         {             grablength[id] += 35         }     } } public startpull(id) {     if (!(get_user_flags(id)&JEDI))     {         console_print(id,"[AMX] You have no access to that command")         return PLUGIN_CONTINUE     }     if (grabbed[id])     {         new parm[2]         parm[0] = id         parm[1] = 1         set_task(0.1, "disttask", 500+id, parm, 2, "b")     }     return PLUGIN_CONTINUE } public startpush(id) {     if (!(get_user_flags(id)&JEDI))     {         console_print(id,"[AMX] You have no access to that command")         return PLUGIN_CONTINUE     }     if (grabbed[id])     {         new parm[2]         parm[0] = id         parm[1] = 2         set_task(0.1, "disttask", 500+id, parm, 2, "b")     }     return PLUGIN_CONTINUE } public stopdist(id) {     if (!(get_user_flags(id)&JEDI))     {         console_print(id,"[AMX] You have no access to that command")         return PLUGIN_CONTINUE     }     if (grabbed[id])     {         remove_task(500+id)     }     return PLUGIN_CONTINUE } public choke_func(id) {     if (!(get_user_flags(id)&JEDI))     {         console_print(id,"[AMX] You have no access to that command")         return PLUGIN_CONTINUE     }     if (grabbed[id]>0 && grabbed[id]<33 && !task_exists(id+200))     {         new victim_name[33]         get_user_name(grabbed[id], victim_name, 32)         client_print(grabbed[id],print_chat,"*** You Are Being Choked By A Jedi !")         client_print(id,print_chat,"*** You Are Choking %s !", victim_name)         message_begin(MSG_ONE, get_user_msgid("ScreenShake") , {0,0,0}, grabbed[id])         write_short(1<<14)         write_short(1<<14)         write_short(1<<14)         message_end()         message_begin(MSG_ONE, get_user_msgid("ScreenFade") , {0,0,0}, grabbed[id])         write_short(1<<1) //total duration         write_short(1<<0) //time it stays one color         write_short(0<<1) //fade out, which means it goes away         write_byte(255) //red         write_byte(30) //green         write_byte(30) //blue         write_byte(180) //alpha, 255 means non-transparent         message_end()         new vec[3]         get_user_origin(grabbed[id],vec)         message_begin(MSG_ONE, get_user_msgid("Damage"), {0,0,0}, grabbed[id])         write_byte(30) // dmg_save         write_byte(30) // dmg_take         write_long(1<<0) // visibleDamageBits         write_coord(vec[0]) // damageOrigin.x         write_coord(vec[1]) // damageOrigin.y         write_coord(vec[2]) // damageOrigin.z         message_end()         new var[1],health         var[0]=id         set_task(1.0,"repeat_shake",id+200,var,1,"a",get_cvar_num("sv_choketime") )         emit_sound(grabbed[id],CHAN_BODY,"player/PL_PAIN2.WAV",1.0,ATTN_NORM,0, PITCH_NORM)         health=get_user_health(grabbed[id])         if(health>3)             set_user_health(grabbed[id],get_user_health(grabbed[id])-3)     }     return PLUGIN_CONTINUE } public repeat_shake(var[]) {     new id=var[0]     if (grabbed[id]>0 && grabbed[id]<33)     {         message_begin(MSG_ONE, get_user_msgid("ScreenShake") , {0,0,0}, grabbed[id])         write_short(1<<14)         write_short(1<<14)         write_short(1<<14)         message_end()         message_begin(MSG_ONE, get_user_msgid("ScreenFade") , {0,0,0}, grabbed[id])         write_short(1<<1) //total duration         write_short(1<<0) //time it stays one color         write_short(0<<1) //fade out, which means it goes away         write_byte(255) //red         write_byte(30) //green         write_byte(30) //blue         write_byte(180) //alpha, 255 means non-transparent         message_end()         new vec[3]         get_user_origin(grabbed[id],vec)         message_begin(MSG_ONE, get_user_msgid("Damage"), {0,0,0}, grabbed[id])         write_byte(30) // dmg_save         write_byte(30) // dmg_take         write_long(1<<0) // visibleDamageBits         write_coord(vec[0]) // damageOrigin.x         write_coord(vec[1]) // damageOrigin.y         write_coord(vec[2]) // damageOrigin.z         message_end()         new health=get_user_health(grabbed[id])         if(health>3)             set_user_health(grabbed[id],get_user_health(grabbed[id])-3)         emit_sound(grabbed[id],CHAN_BODY,"player/PL_PAIN2.WAV",1.0,ATTN_NORM,0, PITCH_NORM)     }     else     {         if(task_exists(id+200))             remove_task(id+200)     }     return PLUGIN_CONTINUE } //Forces them into your vision and grabs em. /* * * Right now still buggy as the grabee gets stuck into the wall or floor * */ public force_grab(id){     if (!(get_user_flags(id)&JEDI))     {         console_print(id,"[AMX] You have no access to that command")         return PLUGIN_CONTINUE     }     else     {     new arg[33], aimvec[3]     read_argv(1, arg, 32)     new targetid = cmd_target(id, arg, 1)     if (targetid < 1 || targetid > 32) return PLUGIN_CONTINUE     get_user_origin(id,aimvec,3)     set_user_origin(targetid,aimvec)     grab(id) //      return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE } public client_disconnect(id) {     if(grabbed[id] || grabmodeon[id])     {     release(id)     } } public plugin_precache() {     precache_sound("player/PL_PAIN2.WAV")     return PLUGIN_CONTINUE } public plugin_init() {     register_plugin("Jedi Force Grab","1.6.2","SpaceDude")     register_cvar("amx_jedigrab","1")     register_cvar("amx_jedigrab_playersonly","0")     register_cvar("sv_throwforce","1500")     register_cvar("sv_grabforce","8")     register_cvar("sv_choketime", "8")     register_cvar("sv_glowred","50")     register_cvar("sv_glowblue","0")     register_cvar("sv_glowgreen","0")     register_clcmd("grab_toggle","grab_toggle",JEDI,"press once to grab and again to release")     register_clcmd("+grab","grab",JEDI,"bind a key to +grab")     register_clcmd("-grab","release",JEDI)     register_clcmd("+pull","startpull",JEDI,"bind a key to +pull")     register_clcmd("-pull","stopdist",JEDI)     register_clcmd("+push","startpush",JEDI,"bind a key to +push")     register_clcmd("-push","stopdist",JEDI)     register_concmd("choke","choke_func",JEDI,"chokes the grabee")     register_concmd("throw","throw",JEDI,"throws the grabee")     register_event("StatusValue","spec_event","be","1=2") }

Hawk552 11-02-2005 22:06

Can you tell me what line 124 is?

When I pasted that, I got this

Code:
            else             {                 client_print(id,print_chat,"[AMX] Searching for a target")             }         }     }  // ********this line is 124**********     else     {         client_print(id,print_chat,"[AMX] Jedi Grab has been disabled")     }

joka69 11-02-2005 22:11

Sry my bad i took the info off the plugin & messed up the line numbers :x here is line 124
Code:
entity_get_vector(grabbed[id], EV_VEC_origin, grabbedorigin)
[/code]

Hawk552 11-02-2005 22:13

Code:
if (grabbed[id])

To

Code:
if (grabbed[id] && is_user_alive(id))

Only problem is that you can't grab ents with that.

EDIT: a better solution would be:

Code:
if (grabbed[id] && is_valid_ent(id))

joka69 11-02-2005 22:14

ah ok ty :)


All times are GMT -4. The time now is 23:46.

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