Jump to content
  • 0

Kindly check this source code


Jin Freecs

Question


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  63
  • Reputation:   3
  • Joined:  12/22/11
  • Last Seen:  

i recently add this src mod in my server when i recompile my server no error appears but when i try to start the server theres also no error and working fine but the problem is im getting random MAP CRASH and DONT SEND error appears. is there any way to see the logs of map server crash?? (windows os) and also i noticed if i use @killmonster the map server crash.

mob.c

//Increase drop rate if user is a premium user

if (sd->gmlevel == 1) // now rig the drop rate to never be over 90% unless it is originally >90%.

drop_rate = max(drop_rate,cap_value((int)(0.5+drop_rate*(120)/100.),0,9000));

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

do you have a coredump or something ?,

anyway jugging by this snippet, I bet your sd probably null something wich cause null pointer exception, (sigfault in C sorry)

so try out something like :

if(sd && sd->gmlevel ==1).......

Edited by Lighta
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  63
  • Reputation:   3
  • Joined:  12/22/11
  • Last Seen:  

sorry i dont have the coredump im using the windows os and i dont know how to get that coredump

ok i will try that code then i will update you once ive finish testing

@Lighta wow it works haha dont have any errors in compiling and also when i used the @killmonster my map server not crash anymore. anyway thanks and can you just give some hint why im having a map crash b4? i got random map crash when i add the

//Increase drop rate if user is a premium user

if (sd->gmlevel == 1) // now rig the drop rate to never be over 90% unless it is originally >90%.

drop_rate = max(drop_rate,cap_value((int)(0.5+drop_rate*(120)/100.),0,9000));

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

I can try, I dunno where is this but I assume it's when a mob is dead right, your issue here is that you assumed that everyone (every object) that killed a mob had a gmlevel attribute wich ain't the case.

To try to be more explicite you have lot of bl_type : bl_mob, bl_pet, bl_hom, and only bl_pc would fit you're case.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  63
  • Reputation:   3
  • Joined:  12/22/11
  • Last Seen:  

oh i see new knowledge thanks Lighta anyway do you think this will be fixed my map crash?

Thanks for all the info

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  43
  • Reputation:   2
  • Joined:  01/17/12
  • Last Seen:  

More like, it was a null reference exception (dereferencing a null pointer).

(sd->gmlevel == 1) is same as (*sd).gmlevel; in this case, if (sd == null), you're doing a forbidden operation (*null)

The expression

(sd && sd->gmlevel ==1)

is true only when both statements "sd" and "sd->gmlevel==1" are true, so when program encounters "sd" being false (sd == null) it stops reading the expression and gets it as false, thus not doing the *null operation in the next part of expression.

Hope I'm clear enough.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...