AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   announce frags and deaths with voice (https://forums.alliedmods.net/showthread.php?t=230125)

ezio_auditore 11-20-2013 09:55

announce frags and deaths with voice
 
PHP Code:

/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

public plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
// Add your code here...
 
register_clcmd("say /speakscroe" "playerinfo"
}
public 
playerinfo(id)
{
 new 
voice[3][33]
 new 
kills
 kills 
get_user_frags(id)
 new 
deaths
 deaths 
get_user_deaths(id)
 
 
num_to_word(killsvoice[1], 32)
 
num_to_word(deathsvoice[2] , 32)
 
 return 
format(voice[2],32,"spk ^"vox/%s kills and %s deaths^""killsdeaths);


In this plugin.... when a player says /showscore, a voice announces the score....
the .sma file compiled without error but the plugin "speaks" nothing.....
please can anyone debug it

YamiKaitou 11-20-2013 09:59

Re: announce frags and deaths with voice
 
kills and deaths are Integers, not Strings

Plus, you are telling it to speak anything

ezio_auditore 11-20-2013 10:03

Re: announce frags and deaths with voice
 
we can convert number to strung....(num_to_str)

and string to word (str_to_word) isn't possible

YamiKaitou 11-20-2013 10:10

Re: announce frags and deaths with voice
 
Quote:

Originally Posted by ezio_auditore (Post 2063221)
we can convert number to strung....(num_to_str)

and string to word (str_to_word) isn't possible

You have already converted the numbers to words with num_to_word. You just don't use the word in your format string.


Also, please learn more about scripting before you actually try to script, your code just plain will not work and doesn't do anything

ezio_auditore 11-20-2013 10:31

Re: announce frags and deaths with voice
 
Quote:

Originally Posted by YamiKaitou (Post 2063223)
You have already converted the numbers to words with num_to_word. You just don't use the word in your format string.


Also, please learn more about scripting before you actually try to script, your code just plain will not work and doesn't do anything

thanks a lot...
but i used it as done in timeleft.sma

YamiKaitou 11-20-2013 10:36

Re: announce frags and deaths with voice
 
Quote:

Originally Posted by ezio_auditore (Post 2063225)
thanks a lot...
but i used it as done in timeleft.sma

Maybe, but you didn't look at the big picture of how it is used in timeleft. The way you are using it, nothing will happen

ezio_auditore 11-20-2013 12:04

Re: announce frags and deaths with voice
 
Quote:

Originally Posted by YamiKaitou (Post 2063227)
Maybe, but you didn't look at the big picture of how it is used in timeleft. The way you are using it, nothing will happen

so....
how to do it

MPNumB 11-22-2013 11:27

Re: announce frags and deaths with voice
 
Also the not all sounds are there. But it's possible to improvise.
PHP Code:

#define SPK_YOUR_SCORE_IS "your(e75) screen(e35) before(s35) is"
#define SPK_KILLS "kill(e64) safe(e10)"
#define SPK_KILL "kill"
#define SPK_AND "and"
#define SPK_DEATH "delta(e30) f(s60)"
#define SPK_DEATHS "delta(e30) f(s65) safe(e10)" 

speak_score(iPlrIdiKillsNumiDeathsNum)
{
    new 
iKills[64], iDeaths[64];
    
num_to_word(iKillsNumiKills63);
    
num_to_word(iDeathsNumiDeaths63);
    
    
client_cmd(iPlrId"spk ^"vox/%%%s _comma and %%s^""SPK_YOUR_SCORE_ISiKills, ((iKillsNum==1)?SPK_KILL:SPK_KILLS),
     
iDeaths, ((iDeathsNum==1)?SPK_DEATH:SPK_DEATHS));


That's the best I could get for words "death" and "deaths".


All times are GMT -4. The time now is 23:12.

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