AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   script worked for a bit then crashed and stopped working (https://forums.alliedmods.net/showthread.php?t=58395)

nick123 07-25-2007 04:19

script worked for a bit then crashed and stopped working
 
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() }

Alka 07-25-2007 04:57

Re: script worked for a bit then crashed and stopped working
 
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")
;)

nick123 07-25-2007 05:12

Re: script worked for a bit then crashed and stopped working
 
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 07-25-2007 05:23

Re: script worked for a bit then crashed and stopped working
 
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

Alka 07-25-2007 05:45

Re: script worked for a bit then crashed and stopped working
 
1 Attachment(s)
Hum...i remaked this! Try it now from this post! :wink:

*Updated*

nick123 07-25-2007 05:57

Re: script worked for a bit then crashed and stopped working
 
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

Alka 07-25-2007 06:13

Re: script worked for a bit then crashed and stopped working
 
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! ;)

nick123 07-25-2007 06:18

Re: script worked for a bit then crashed and stopped working
 
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?


All times are GMT -4. The time now is 09:55.

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