Raised This Month: $ Target: $400
 0% 

Code to edit :)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wojtex
Junior Member
Join Date: Oct 2007
Old 11-26-2007 , 12:49   Code to edit :)
Reply With Quote #1

What's wrog with this code, can you edit it(+karma)

Code:
new const g_sounds[][] = 
{ 
"voi/elo.wav", 
"voi/siema.wav", 
"voi/siemano.wav" 
} 
 
new const g_teamattack_sounds[][] = 
{ 
"tk1.wav", 
"tk2.wav", 
"tk3.wav", 
"tk4.wav" 
} 
 
new const g_attack_sounds[][]= 
{        
"voi/wqrw5.wav", 
"voi/wqrw4.wav", 
"voi/wqrw2.wav",  
"voi/wqrw3.wav", 
"voi/wqrw6.wav", 
"voi/wqrw7.wav", 
"voi/wqrw8.wav", 
"voi/wqrw1.wav", 
"voi/taunt5.wav", 
"voi/taunt2.wav", 
"voi/taunt4.wav", 
"voi/taunt3.wav", 
"voi/taunt1.wav", 
"voi/okurwa.wav" 
} 
 
new g_maxplayers 
 
public plugin_init() 
{ 
register_plugin(PLUGIN, VERSION, AUTHOR) 
 
register_clcmd("say elo",   "say_elo_handle") 
register_clcmd("say siema", "say_siema_handle") 
register_clcmd("say siemano",   "say_siemano_handle") 
 
g_maxplayers = get_maxplayers() + 1 
} 
 
public plugin_precache() 
{    
for(new i = 0; i < sizeof g_sounds; i++) 
{    
if(!precache_sound(g_sounds[i])) 
{ 
log_amx("Error: Could not precache (%s) plugin stopped." 
 
g_sounds[i]) 
pause("ad") 
} 
 
for(new i = 0; i < sizeof g_teamattack_sounds; i++) 
{ 
if(!precache_sound(g_teamattack_sounds[i])) 
{ 
log_amx("Error: Could not precache (%s), plugin stopped.", 
 
g_teamattack_sounds[i]) 
pause("ad") 
} 
 
for(new i = 0; i < sizeof g_attack_sounds; i++) 
{ 
if(!precache_sound(g_atac_sounds[i])) 
{ 
log_amx("Error: Could not precache (%s), plugin stopped.", 
 
g_atac_sounds[i]) 
pause("ad") 
} 
 
 
public say_elo_handle(id,0) 
{ 
play_sound(id, 0) 
} 
 
public say_siema_handle(id,1) 
{ 
play_sound(id, 1) 
} 
 
public say_siemano_handle(id,2) 
{ 
play_sound(id, 2) 
} 
 
public play_sounds(id, soundid) 
{ 
static buffer[64] 
 
format(buffer, 63, "sound/ %s", g_sounds[soundid]) 
 
if(is_user_alive(id)) 
{ 
for(new i = 0; i < g_maxplayers; i++) 
{ 
if(is_user_connected(i)) 
{ 
console_cmd(id, "spk %s", buffer) 
} 
 
} 
else 
{ 
for(new i = 0; i < g_maxplayers; i++) 
{ 
if(is_user_connected(i) && !is_user_alive(i)) 
{ 
console_cmd(id, "spk %s", buffer) 
} 
 
} 
return PLUGIN_HANDLED 
} 
 
public client_damage (attacker, victim, damage, wpnindex, hitplace, TA, atac) 
{ 
if(TA 
if(attack 
emit_sound(victim, CHAN_VOICE, g_teamattack_sounds[random_num(0, sizeof 
 
g_teamattack_sounds - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM) 
} 
emit_sound(victim, CHAN_VOICE, g_attack_sound[random_num(0, sizeof 
 
g_atac_sound - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM) 
}
__________________
Sorry 4 my bad english
wojtex is offline
RaYden
Member
Join Date: Sep 2007
Old 11-26-2007 , 14:06   Re: Code to edit :)
Reply With Quote #2

omg I have no idea how u damaged that code so badly
I have posted a fix ... haven't tested it tho
MAKE SURE U HAVE THE SOUND FILES IN THE CORRECT FOLDERS OTHERWISE IT WILL NOT WORK !!! >.<
Attached Files
File Type: sma Get Plugin or Get Source (soundz.sma - 838 views - 2.7 KB)

Last edited by RaYden; 11-26-2007 at 14:15.
RaYden is offline
wojtex
Junior Member
Join Date: Oct 2007
Old 11-26-2007 , 14:28   Re: Code to edit :)
Reply With Quote #3

Its not my plugin it is my friends + karma
__________________
Sorry 4 my bad english
wojtex is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 11-26-2007 , 17:47   Re: Code to edit :)
Reply With Quote #4

Code:
public play_sound( soundid) { static buffer[64],player[32],playersnum   format(buffer, 63, "sound/ %s", g_sounds[soundid])   get_players(player,playersnum,"c") for(new i = 0; i < playersnum; i++) {     if(is_user_connected(i))     {         console_cmd(player[i], "spk %s", buffer)     } } return PLUGIN_HANDLED }
Lee is offline
RaYden
Member
Join Date: Sep 2007
Old 11-27-2007 , 03:01   Re: Code to edit :)
Reply With Quote #5

yes there was a lot of pointless stuff in that script ... I might have not removed it all
RaYden is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 11-27-2007 , 06:12   Re: Code to edit :)
Reply With Quote #6

I think he meant "that should be players[i], and not just i"

EDIT: And now I know how to highlight things in "small" tags .. rock on.
purple_pixie is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 11-27-2007 , 08:33   Re: Code to edit :)
Reply With Quote #7

If the highlighted line used player[i], it would be "pointless". As it stands, it's a bug because player[] won't always contain contiguous user IDs. Also, client_cmd() accepts 0 as its first parameter - so there's no need to use get_players() to determine connected players anyway.

Last edited by Lee; 11-27-2007 at 14:58.
Lee is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 11-27-2007 , 09:22   Re: Code to edit :)
Reply With Quote #8

Code:
new const g_sounds[][] = 
{ 
"voi/elo.wav", 
"voi/siema.wav", 
"voi/siemano.wav" 
} 
 
new const g_teamattack_sounds[][] = 
{ 
"tk1.wav", 
"tk2.wav", 
"tk3.wav", 
"tk4.wav" 
} 
 
new const g_attack_sounds[][]= 
{        
"voi/wqrw5.wav", 
"voi/wqrw4.wav", 
"voi/wqrw2.wav",  
"voi/wqrw3.wav", 
"voi/wqrw6.wav", 
"voi/wqrw7.wav", 
"voi/wqrw8.wav", 
"voi/wqrw1.wav", 
"voi/taunt5.wav", 
"voi/taunt2.wav", 
"voi/taunt4.wav", 
"voi/taunt3.wav", 
"voi/taunt1.wav", 
"voi/okurwa.wav"
omg noob... sound files have copyrights?
}
Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-27-2007 , 09:25   Re: Code to edit :)
Reply With Quote #9

Quote:
Originally Posted by Sn!ff3r View Post
omg noob... sound files have copyrights?
}
Is that a question or do you just suck at english?
[ --<-@ ] Black Rose is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 11-27-2007 , 09:51   Re: Code to edit :)
Reply With Quote #10

The message started "omg noob" and you think there's a chance he doesn't suck at English :-D
purple_pixie 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 11:07.


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