AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   crashing error (https://forums.alliedmods.net/showthread.php?t=41424)

Mini_Midget 07-15-2006 01:01

crashing error
 
while playing my game, i wait for 12 secs for the special effects and crap to happen but when it does. It crashes the game with no error messages...

Code:
public lighting(id) {     client_cmd(0, "spk ambience/thunder_clap.wav")     message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)     write_short(1<<10)     write_short(1<<10)     write_short(0x0000)     write_byte(0)     write_byte(255)     write_byte(255)     write_byte(255)     message_end() } public admin_dark(id, level, cid) {     if (!cmd_access(id, level, cid, 2))         return PLUGIN_HANDLED         new arg[32]     read_argv(1,arg,31);     if(arg[0] == '1')     {           set_hudmessage(0, 255, 0, -1.0, 0.2, 0, 6.0, 4.0)         show_hudmessage(0, "Night Hour ENABLED")         set_lights("aaaaaaaaaaabbbbbaaa")         set_task(12.0, "lighting", 0, _, _, "b")         client_cmd(0, "spk ambience/wolfhowl01.wav")     }         else if(arg[0] == '0')     {         set_hudmessage(0, 255, 0, -1.0, 0.2, 0, 6.0, 4.0)         show_hudmessage(0, "Night Hour DISABLED")         set_lights("#OFF")     }     return PLUGIN_HANDLED }
but when i took out the screenfade part, everything works pefectly BUT when i set things back to normal
i can still hear the thunder every 12 secs

p3tsin 07-16-2006 06:55

Re: crashing error
 
Code:
set_task(12.0, "lighting", 0, _, _, "b") .. message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, id)
theres no id passed into the function :?

try this
Code:
message_begin(MSG_BROADCAST, get_user_msgid("ScreenFade"))

Mini_Midget 07-17-2006 03:27

Re: crashing error
 
sweet as
works now but i still have that error where when i disable night hour,
i can still hear and see the white screenfade every 12 seconds which really bugs when cause it doesn't suit it when its in day time

TheNewt 07-17-2006 14:07

Re: crashing error
 
Maybe cuase when you turn on the nightmode thing, it sets the task to run infinite amount of times, which includes even after you turn it off. I'd say have the task set up another function that checks whether its night or day
oh and put the set_task into the public plugin_init().
Add also a global variable that holds whether its night or day, like I don't know, 1 is night 0 is day?

So I unno like
Code:
bool:g_Night // False = Day || True = Night public plugin_init() {     register_plugin(PLUGIN,VERSION,AUTHOR)     set_task(12.0, "CheckTime", id, _, _, "b") } public CheckTime(id) {     if(!g_Night) {         set_hudmessage(0, 255, 0, -1.0, 0.2, 0, 6.0, 4.0)         show_hudmessage(0, "Night Hour DISABLED")         set_lights("#OFF")     }     else {         set_hudmessage(0, 255, 0, -1.0, 0.2, 0, 6.0, 4.0)         show_hudmessage(0, "Night Hour ENABLED")         set_lights("aaaaaaaaaaabbbbbaaa")         lightning(id)         client_cmd(0, "spk ambience/wolfhowl01.wav")     } }
something like that you know?


All times are GMT -4. The time now is 08:07.

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