Help to supplement the plugin [Fall sound]
I have a plugin that plays sound when a player crashes to death, who could help me supplement it, I need to make it so that 3 random sounds are played instead of 1
#include <sourcemod> #include <sdktools> public Plugin:myinfo = { name = "worldspawn Kill Sound", version = "1.0", } public OnPluginStart() { HookEvent("player_death", Death); } public OnMapStart() { AddFileToDownloadsTable("sound/worldspawn.mp3"); AddToStringTable(FindStringTable("soundprecac he"), "*worldspawn.mp3"); } public Death(Handle:event, const String:name[], bool:dontBroadcast) { decl String:str[32]; GetEventString(event, "weapon", str, sizeof(str)); if(strcmp(str, "worldspawn", true) == 0) { decl clients[MaxClients]; new total = 0; for (new i=1; i<=MaxClients; i++) { if (IsClientInGame(i)) { clients[total++] = i; } } EmitSound(clients, total, "*worldspawn.mp3"); } } |
Re: Help to supplement the plugin [Fall sound]
Do a GetRandomInt with a switch statement
https://sm.alliedmods.net/new-api/halflife/GetRandomInt https://forums.alliedmods.net/showthread.php?t=265448 Here ,there should be everything you need. |
Re: Help to supplement the plugin [Fall sound]
no thanks, but I've already been written a plugin for free, it turns out I only needed to add 4 lines, I don't think I had to pay for it...
|
Re: Help to supplement the plugin [Fall sound]
Quote:
|
Re: Help to supplement the plugin [Fall sound]
probably was a reply based on his signature.
Anyway, this kind of "random" usually is achieved by "GetRandomInt" with a switch/case statement. |
Re: Help to supplement the plugin [Fall sound]
Quote:
|
Re: Help to supplement the plugin [Fall sound]
Untested
PHP Code:
|
| All times are GMT -4. The time now is 05:48. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.