AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Frag wont update scoreboard (https://forums.alliedmods.net/showthread.php?t=93102)

dstopgunner 05-24-2009 10:52

Frag wont update scoreboard
 
This plugin adds 10000health to a bot when it spawns (10100health)
and kills it when its health go lower than 10000 . (dont ask why =p)
Yes I have 100$ when I kill the bot BUT my frags didnt +1 imediately but only next round.
I think the set_msg_block(get_user_msgid("DeathMsg"),BLOC K_ONCE) is blocking it can someone help pls.

PHP Code:

register_event("Damage","event_damage_pain","be","2!0","3=0"
public 
event_damage_pain(id// bot id
{
 if(!
is_user_alive(id))
  return 
PLUGIN_HANDLED
  
 
new attacker get_user_attacker(id)
 if(
is_user_bot(id))
 {
  new 
hp get_user_health(id)
  if(
hp 10000)
  {
   
user_kill(id)
   
set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)
   new 
frags money
   frags 
get_user_frags(attacker)
   
fm_set_user_frags(attackerfrags+1)
   
money cs_get_user_money(attacker)
   
cs_set_user_money(attackermoney+100)
  }
 }
 return 
PLUGIN_CONTINUE



--kml-- 05-24-2009 22:47

Re: Frag wont update scoreboard
 
not sure this will work xD


PHP Code:

register_message(get_user_msgid("Damage"),"event_damage_pain","be","2!0","3=0"))
public 
event_damage_pain(id// bot id
{
 if(!
is_user_alive(id))
  return 
PLUGIN_HANDLED
  
 
new attacker get_user_attacker(id)
 if(
is_user_bot(id))
 {
  new 
hp get_user_health(id)
  if(
hp 10000)
  {
   
user_kill(id)
   
set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)
   new 
frags money
   frags 
get_user_frags(attacker)
   
fm_set_user_frags(attackerfrags+1)
   
money cs_get_user_money(attacker)
   
cs_set_user_money(attackermoney+100)
  }
 }
 return 
PLUGIN_CONTINUE


p.s : im a noob scripter

p.ss : why message? because I THINK not sure it is true or not

register_message is for editing the message.
example : You kill some one than your frag is + by 2

register_event
is for calling the event
example: You kill some 1 then prints at chat that says ZOMG
prints doesnt edit the message

But im not realy sure about this xD

Exolent[jNr] 05-24-2009 23:11

Re: Frag wont update scoreboard
 
Quote:

Originally Posted by --kml-- (Post 834081)
not sure this will work xD

No, it won't.
You don't even know how to script properly so why are you providing help?

Your solution is that you didn't the scoreboard.
http://wiki.amxmodx.org/Half-Life_1_...ents#ScoreInfo

Send a ScoreInfo event for the killer with the updated frags.

dstopgunner 05-25-2009 01:52

Re: Frag wont update scoreboard
 
Sry im not good at messaging , is the link refering to this?
I add this into the script?
Pls explain how thx.

........
........
..set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0, 0, 0}, 0)
write_byte()
write_byte()
write_byte(1) // 1frag?
message_end()
..new frags , money

Hunter-Digital 05-25-2009 03:01

Re: Frag wont update scoreboard
 
PHP Code:

message_begin(MSG_BROADCASTget_user_msgid("ScoreInfo"))
write_byte(id// the player you're updating score to...
write_short(get_user_frags(id) + 1// get player's frags and increase them by 1
write_short(get_user_deaths(id)) // death count stays the same
write_short(0// ClassID, this is not for CS, but for TFC and so... I think :}
write_short(get_user_team(id)) // team ID he's in
message_end() 

and you would best cache the value of get_user_msgid()

--kml-- 05-25-2009 08:09

Re: Frag wont update scoreboard
 
yes im a noob scripter .
i also have a strategy of learning .. instead of making more threads about help in scripting, i will try too help people too .

well this is my strategy

1) i try help some1
2) and i have errors in that post
3) so other people see it
4) they help a bit and fix it and solve the post
5) so i learn
6) thats why i am trying to help while learning :crab::crab::crab:

Arkshine 05-25-2009 08:13

Re: Frag wont update scoreboard
 
Bad strategy.

--kml-- 05-25-2009 08:58

Re: Frag wont update scoreboard
 
i already expected that kind of reply . oh well this is my strategy ( my way of learning ) so if You think it is bad then ok.

Arkshine 05-25-2009 10:45

Re: Frag wont update scoreboard
 
I mean if you want help ask it. This section is here for that. If you want to help others, make sure you did answer something correct otherwise don't do that. You will confuse people like that and It will not provide any help. You flood others threads by your "suggestions" and that's not good. It's fine to want to learn but do it properly without interfering with others threads like you do. Create as many threads you want if you want to learn something.

Bugsy 05-25-2009 10:51

Re: Frag wont update scoreboard
 
kml, with all due respect, until you learn scripting well enough to help others, try to keep your Scripting Help activity to reading and asking questions -- not offering help to others. It is frustrating and time consuming for people to be given false information when they are trying to write\debug their plugins.


All times are GMT -4. The time now is 01:31.

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