Raised This Month: $ Target: $400
 0% 

Sounds + Menus


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Werewolf
Senior Member
Join Date: Jan 2006
Location: Sweden
Old 03-24-2006 , 17:12   Sounds + Menus
Reply With Quote #1

Hello. I'm back
I still got some problems with my mod.
Reasons: when I emit sounds it continue to play until you disconnect + lack of ideas.

I tried both emit and the spk etc.
They don't play the sound or they play it until you disconnect, and that is very irritating with my current sounds + when it is a level up it should play a sound but it wont work.

Here is the codes I used for them. + No errors while compiling.
Code:
emit_sound(id, CHAN_AUTO, "mythmod/skilluse.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) <- This one plays until you disconnect. //Other at level up     if(g_PlayerXP[attacker] >= LEVELS[g_PlayerLevel[attacker]])       {           g_PlayerLevel[attacker] += 1           client_print(attacker,print_chat,"[Mythology Mod] Congratulations! You are now level %i!", g_PlayerLevel[attacker])           SaveXP(attacker)           ShowHUD(attacker)           emit_sound(id, CHAN_AUTO, "mythmod/levelup.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) <- This one doesn't work.     }

Here is my second problem on the mod.
This is a menu that doesn't work.
Code:
public DoShopMenu(id, key)     {     new usermoney = cs_get_user_money(id)     new userhealth = get_user_health(id)     switch(key)     {         case 0:         {             if(usermoney < EXTRA_HP_COST)             {             return PLUGIN_HANDLED             }             set_user_health(id, userhealth + EXTRA_HP_AMOUNT)             cs_set_user_money(id, usermoney - EXTRA_HP_COST)             return PLUGIN_CONTINUE         }         case 1:         {             if(usermoney < EXTRA_XP_COST)             { return PLUGIN_HANDLED             }             g_PlayerXP[id] += EXTRA_XP_AMOUNT             cs_set_user_money(id, usermoney - EXTRA_XP_COST)             return PLUGIN_CONTINUE         }         case 2:         {             if(usermoney < EXTRA_SPEED_COST)             {             return PLUGIN_HANDLED             }             set_user_maxspeed(id, EXTRA_SPEED.0)             client_cmd(id, "cl_forwardspeed EXTRA_SPEED")             client_cmd(id, "cl_backspeed EXTRA_SPEED")             client_cmd(id, "cl_sidespeed EXTRA_SPEED")             cs_set_user_money(id, usermoney - EXTRA_SPEED_COST)             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE }

On this menu I don't really know what to do so please help me.
__________________
~~~~~Hawk~~~~~
Werewolf is offline
akysiev
Junior Member
Join Date: Mar 2006
Location: Earth
Old 03-24-2006 , 20:37  
Reply With Quote #2

What is wrapping the emit_sound? Check to see if it is looping via constant function calls such as by set_task.

What exactly is wrong with the menu? Does it not display or does some part of it not function?
akysiev is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 03-24-2006 , 21:40  
Reply With Quote #3

Code:
set_user_maxspeed(id, EXTRA_SPEED.0)             client_cmd(id, "cl_forwardspeed EXTRA_SPEED")             client_cmd(id, "cl_backspeed EXTRA_SPEED")             client_cmd(id, "cl_sidespeed EXTRA_SPEED")

First off. LMAO
Second.
Code:
set_user_maxspeed(id, EXTRA_SPEED.0)
change to
Code:
set_user_maxspeed(id, EXTRA_SPEED * 1.0)
Third.
Code:
client_cmd(id, "cl_forwardspeed EXTRA_SPEED")
change to
Code:
client_cmd(id, "cl_forwardspeed %d", EXTRA_SPEED)
and so for the others
Freecode is offline
Werewolf
Senior Member
Join Date: Jan 2006
Location: Sweden
Old 03-25-2006 , 11:21  
Reply With Quote #4

It wont remove the money and it doesn't add xp etc.
__________________
~~~~~Hawk~~~~~
Werewolf is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 03-25-2006 , 17:26  
Reply With Quote #5

Code:
public DoShopMenu(id, key) {     new usermoney = cs_get_user_money(id)     new userhealth = get_user_health(id)     switch(key)     {         case 0:         {             if(usermoney < EXTRA_HP_COST)             {                 return PLUGIN_HANDLED             }                         set_user_health(id, userhealth + EXTRA_HP_AMOUNT)             cs_set_user_money(id, usermoney - EXTRA_HP_COST)             return PLUGIN_CONTINUE         }         case 1:         {             if(usermoney < EXTRA_XP_COST)             {                 return PLUGIN_HANDLED             }                         g_PlayerXP[id] += EXTRA_XP_AMOUNT             cs_set_user_money(id, usermoney - EXTRA_XP_COST)             return PLUGIN_CONTINUE         }         case 2:         {             if(usermoney < EXTRA_SPEED_COST)             {                 return PLUGIN_HANDLED             }                         set_user_maxspeed(id, EXTRA_SPEED * 1.0)             client_cmd(id, "cl_forwardspeed %d",EXTRA_SPEED)             client_cmd(id, "cl_backspeed %d",EXTRA_SPEED)             client_cmd(id, "cl_sidespeed %d",EXTRA_SPEED)             cs_set_user_money(id, usermoney - EXTRA_SPEED_COST)             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE }
Freecode is offline
Werewolf
Senior Member
Join Date: Jan 2006
Location: Sweden
Old 03-27-2006 , 09:35  
Reply With Quote #6

OK. Here is the code you posted:
Code:
public DoShopMenu(id, key) {     new usermoney = cs_get_user_money(id)     new userhealth = get_user_health(id)     switch(key)     {         case 0:         {             if(usermoney < EXTRA_HP_COST)             {                 return PLUGIN_HANDLED             }                           set_user_health(id, userhealth + EXTRA_HP_AMOUNT)             cs_set_user_money(id, usermoney - EXTRA_HP_COST)             return PLUGIN_CONTINUE         }         case 1:         {             if(usermoney < EXTRA_XP_COST)             {                 return PLUGIN_HANDLED             }                           g_PlayerXP[id] += EXTRA_XP_AMOUNT             cs_set_user_money(id, usermoney - EXTRA_XP_COST)             return PLUGIN_CONTINUE         }         case 2:         {             if(usermoney < EXTRA_SPEED_COST)             {                 return PLUGIN_HANDLED             }                           set_user_maxspeed(id, EXTRA_SPEED * 1.0)             client_cmd(id, "cl_forwardspeed %d",EXTRA_SPEED)             client_cmd(id, "cl_backspeed %d",EXTRA_SPEED)             client_cmd(id, "cl_sidespeed %d",EXTRA_SPEED)             cs_set_user_money(id, usermoney - EXTRA_SPEED_COST)             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE }

Here is my fixed code:
Code:
public DoShopMenu(id, key) {     new usermoney = cs_get_user_money(id)     new userhealth = get_user_health(id)     switch(key)     {         case 0:         {             if(usermoney < EXTRA_HP_COST)             {                 return PLUGIN_HANDLED             }             set_user_health(id, userhealth + EXTRA_HP_AMOUNT)             cs_set_user_money(id, usermoney - EXTRA_HP_COST)             return PLUGIN_CONTINUE         }         case 1:         {             if(usermoney < EXTRA_XP_COST)             {                 return PLUGIN_HANDLED             }             g_PlayerXP[id] += EXTRA_XP_AMOUNT             cs_set_user_money(id, usermoney - EXTRA_XP_COST)             DeathMsg()             return PLUGIN_CONTINUE         }         case 2:         {             if(usermoney < EXTRA_SPEED_COST)             {                 return PLUGIN_HANDLED             }             set_user_maxspeed(id, EXTRA_SPEED * 1.0)             client_cmd(id, "cl_forwardspeed %d", EXTRA_SPEED)             client_cmd(id, "cl_backspeed %d", EXTRA_SPEED)             client_cmd(id, "cl_sidespeed %d", EXTRA_SPEED)             cs_set_user_money(id, usermoney - EXTRA_SPEED_COST)             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE }
__________________
~~~~~Hawk~~~~~
Werewolf 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 16:39.


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