Raised This Month: $51 Target: $400
 12% 

CSGO Bomb Sounds


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
A k c 3 n 7
Junior Member
Join Date: Oct 2014
Location: Romania
Old 09-18-2017 , 05:39   CSGO Bomb Sounds
Reply With Quote #1

delet
__________________


Last edited by A k c 3 n 7; 10-02-2017 at 10:33.
A k c 3 n 7 is offline
DevilBoy.eXe
Member
Join Date: Mar 2017
Location: Romania
Old 09-18-2017 , 07:02   Re: CSGO Bomb Sounds
Reply With Quote #2

Gj mate!
But no credits... thanks X(
Replace this
Code:
       client_print(0, print_chat,"[CSGO] Jucatorul %s a primit +300$ pentru planatarea bombei",szName)
       client_print(0, print_chat, "[CSGO] Jucatorul %s a primit +500$ pentru dezamorsarea bombei ",szName)
with this
Code:
       client_print(0, print_chat,"[CSGO] Player %s has received +300$ for planting the bomb!",szName)
       client_print(0, print_chat, "[CSGO] Player %s has received +500$ for defusing the bomb! ",szName)
Or make a lang file
__________________


Last edited by DevilBoy.eXe; 09-18-2017 at 07:11.
DevilBoy.eXe is offline
Send a message via Yahoo to DevilBoy.eXe Send a message via Skype™ to DevilBoy.eXe
A k c 3 n 7
Junior Member
Join Date: Oct 2014
Location: Romania
Old 09-18-2017 , 17:24   Re: CSGO Bomb Sounds
Reply With Quote #3

Quote:
Originally Posted by DevilBoy.eXe View Post
Gj mate!
But no credits... thanks X(
Replace this
Code:
       client_print(0, print_chat,"[CSGO] Jucatorul %s a primit +300$ pentru planatarea bombei",szName)
       client_print(0, print_chat, "[CSGO] Jucatorul %s a primit +500$ pentru dezamorsarea bombei ",szName)
with this
Code:
       client_print(0, print_chat,"[CSGO] Player %s has received +300$ for planting the bomb!",szName)
       client_print(0, print_chat, "[CSGO] Player %s has received +500$ for defusing the bomb! ",szName)
Or make a lang file
edited, thanks
__________________

A k c 3 n 7 is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 09-18-2017 , 23:57   Re: CSGO Bomb Sounds
Reply With Quote #4

Why is szName[33] is a global array ?

+ Here you don't need a loop since you have only 1 sound in these consts.

PHP Code:
for(sizeof g_szDefSound i++)
        
precache_sound(g_szDefSound[i]);

    for(
sizeof g_szPlantedSound i++)
        
precache_sound(g_szPlantedSound[i]); 
A small typo here , wati - > wait
PHP Code:
public logevent_round_end(id) {

       
client_cmd(0"wati;stopsound")

__________________
Ayman Khaled is offline
A k c 3 n 7
Junior Member
Join Date: Oct 2014
Location: Romania
Old 09-19-2017 , 09:31   Re: CSGO Bomb Sounds
Reply With Quote #5

i think is better
PHP Code:
public plugin_precache() {

        
precache_sound"csgo/planting.wav")
        
precache_sound"csgo/planting2.wav")
        
precache_sound"csgo/defusing.wav")
        
precache_sound"csgo/CSGOPlanted.wav")

and
PHP Code:
       new szName[33]
       
get_user_name(id,szName,32)
       
cs_set_user_money(id,cs_get_user_money(id)+300)
       
client_print(0print_chat,"[CSGO] Player %s has received +300$ for planting the bomb!",szName
PHP Code:
       new szName[33]   
       
get_user_name(id,szName,32)
       
cs_set_user_money(id,cs_get_user_money(id)+500)
       
client_cmd(0"spk radio/bombdef.wav")
       
client_print(0print_chat"[CSGO] Player %s has received +500$ for defusing the bomb!",szName
__________________


Last edited by A k c 3 n 7; 09-20-2017 at 08:24.
A k c 3 n 7 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-20-2017 , 01:24   Re: CSGO Bomb Sounds
Reply With Quote #6

oLd but good job you have tried
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 09-20-2017 , 14:29   Re: CSGO Bomb Sounds
Reply With Quote #7

I'll give you some tips since you posted this here, though by the looks of what you put there you don't really know what you're doing. The plugin is full off unnecessary code, which makes me believe you copied a lot of the code from other sources that use an array of sounds and play one randomly (such as round end music).

Anyways, here goes:

1) Use suggestive variable names, the cvar pointer names make no sense
2) Do not use two-dimensional arrays for when you're only storing one sound name. g_szDefSound[] = "csgo/defusing.wav" is enough
3) Use the strings you just defined above in precache, eg precache_sound(g_szDefSound)
4) You should clamp the money you set to 16000. Your plugin will go over 16000.
5) Again, use the variable you just declared globally in your spk command. client_cmd(0, "spk %s", g_szDefSound). Also, I think the spk won't work on latest steam clients anymore. Just use emit the sound on id 0 to play it globally.
6) Indent the code properly! You have lots of tabs all over the place, there is no structure whatsoever to the code, don't ignore the loose indentation warnings from your compiler
7) Use charsmax instead of hardcoded values eg get_user_name(id,szName,32) -> get_user_name(id,szName,charsmax(szName))

Finally, you named this plugin csgo bomb sounds, but it also gives bonus money. Either specify this in the plugin description, or remove the money bonus from it.
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
A k c 3 n 7
Junior Member
Join Date: Oct 2014
Location: Romania
Old 09-20-2017 , 14:53   Re: CSGO Bomb Sounds
Reply With Quote #8

@aron9forever, you right it's my first plugin i'm documented from more plugins and sites but i don't know all about this, and about gives money i think it's no big problem it's just one little code
__________________

A k c 3 n 7 is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 09-20-2017 , 15:52   Re: CSGO Bomb Sounds
Reply With Quote #9

Quote:
Originally Posted by aron9forever View Post
4) You should clamp the money you set to 16000. Your plugin will go over 16000.
just a small question, if i wont the money go over 16k.
is this example true ?
PHP Code:
new PlayerMoney cs_get_user_money id )
clamp(PlayerMoney016000
__________________
Ayman Khaled is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 09-20-2017 , 16:47   Re: CSGO Bomb Sounds
Reply With Quote #10

Quote:
Originally Posted by Ayman Khaled View Post
just a small question, if i wont the money go over 16k.
is this example true ?
PHP Code:
new PlayerMoney cs_get_user_money id )
clamp(PlayerMoney016000
that is correct, but you either need to save the return value of the clamp or use it directly
PHP Code:
new PlayerMoney cs_get_user_money id )
new 
limitedMoney clamp(PlayerMoney016000
or simply
PHP Code:
cs_set_user_money(idclamp(cs_get_user_money(id) + 500016000)) 
this is only if u ever also substract money
if you're only going to add to it then you can just use max(newMoney, 16000) and it will set either newMoney or 16000 whichever is bigger
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever 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 06:02.


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