Raised This Month: $ Target: $400
 0% 

script worked for a bit then crashed and stopped working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nick123
BANNED
Join Date: Dec 2006
Old 07-25-2007 , 04:19   script worked for a bit then crashed and stopped working
Reply With Quote #1

here it is , it worked for about 5 mins then made the server and then never worked
Code:
 /* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <engine> #include <cstrike> #include <fakemeta> #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" new g_spriteLightning public plugin_init() {  register_plugin(PLUGIN, VERSION, AUTHOR)     } public plugin_precache() {  g_spriteLightning = precache_model("sprites/lgtning.spr") } public client_PreThink(id) {  new targetid, body  get_user_aiming(id, targetid, body)      if(get_user_button(id) & IN_ATTACK2)  {   if (is_user_alive(targetid) && cs_get_user_team(id) != cs_get_user_team(targetid))   {    client_print(0, print_chat, "VALID TARGET")    TakeHp(id, targetid)     }  }  return PLUGIN_HANDLED } public TakeHp(id, targetid) {  new AttackerHp  pev(id, pev_health, AttackerHp)  new VictimHp    pev(targetid, pev_health, targetid)    AttackerHp += 20.0  VictimHp -= 20.0  set_pev(id, pev_health, AttackerHp)  set_pev(targetid, pev_health,  VictimHp)  CreateBeam(id, targetid)   } public CreateBeam(id, targetid) {    message_begin( MSG_BROADCAST, SVC_TEMPENTITY )  write_byte(8)   // TE_BEAMENTS  write_short(targetid)  // start entity  write_short(id) // entity  write_short(g_spriteLightning) // model  write_byte(0)  // starting frame  write_byte(15)  // frame rate  write_byte(1)  // life  write_byte(80)  // line width  write_byte(10)  // noise amplitude  write_byte(255) // r, g, b  write_byte(00) // r, g, b  write_byte(0)  // r, g, b  write_byte(35)  // brightness  write_byte(5)  // scroll speed  message_end() }
nick123 is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-25-2007 , 04:57   Re: script worked for a bit then crashed and stopped working
Reply With Quote #2

Hmm...here
Code:
 new AttackerHp 
 pev(id, pev_health, AttackerHp)
 new VictimHp  
 pev(targetid, pev_health, targetid) //error
replace line 4 with
Code:
pev(targetid, pev_health, VictimHp)


Why are you using engine too? 0_o
use
Code:
register_forward(FM_PlayerPreThink,"Fwd_PlayerPreThink")
;)
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 07-25-2007 at 05:02.
Alka is offline
nick123
BANNED
Join Date: Dec 2006
Old 07-25-2007 , 05:12   Re: script worked for a bit then crashed and stopped working
Reply With Quote #3

hmmm i couldn't find a way to check if user is using in attack2 button
edit: ty for the catch but i still think it wouldn't work cuz either way i didn't say VALID ENT print
nick123 is offline
nick123
BANNED
Join Date: Dec 2006
Old 07-25-2007 , 05:23   Re: script worked for a bit then crashed and stopped working
Reply With Quote #4

sry for double post but i just tried it alka it doesn't work.. i still can't said vaid.. so its something in the client prethink .. but i dunno what would be i kept checking it
nick123 is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-25-2007 , 05:45   Re: script worked for a bit then crashed and stopped working
Reply With Quote #5

Hum...i remaked this! Try it now from this post!

*Updated*
Attached Files
File Type: sma Get Plugin or Get Source (take_health.sma - 825 views - 1.6 KB)
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 07-25-2007 at 06:13.
Alka is offline
nick123
BANNED
Join Date: Dec 2006
Old 07-25-2007 , 05:57   Re: script worked for a bit then crashed and stopped working
Reply With Quote #6

hmm kinda of works. the beam works and valid target appears but it adds hp to the attacker and the victims and not just 20. lotz lotz more than 20
nick123 is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-25-2007 , 06:13   Re: script worked for a bit then crashed and stopped working
Reply With Quote #7

Strange; add hp to both i saw that 0o...hum :-? Dunno...but is adding so much health because client_prethink is called ~60 times per second or something like that! now i updated the plugin to stop at 100 hp! ;)
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
nick123
BANNED
Join Date: Dec 2006
Old 07-25-2007 , 06:18   Re: script worked for a bit then crashed and stopped working
Reply With Quote #8

well for that i have another solution but im just worries about the subtrachting part. for the health max ill have a var allows the player to use this ability 7 times only but the subtracthin part is it fixable? or could it be that since there was no max the player hp subtracted too fast and hl couldn't catch when his hp was 0 and didn't register a sucide?
nick123 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 17:45.


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