Raised This Month: $ Target: $400
 0% 

A Couple Questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dizzy
Veteran Member
Join Date: Jun 2004
Location: Massachusetts
Old 06-27-2006 , 20:16   Re: A Couple Questions
Reply With Quote #1

My .txt is

Code:
[en]
KILL_STREAK_A = %s: Multi-Kill!
KILL_STREAK_B = %s: Ultra-Kill!
KILL_STREAK_C = %s: Monster-Kill!
KILL_STREAK_D = %s: Killing Spree!
KILL_STREAK_E = %s: Rampage!
KILL_STREAK_F = %s: Holy Shit!
KILL_STREAK_G = %s: Godlike!
KNIFE_MESSAGE_A = %s Sliced And Diced %s!
KNIFE_MESSAGE_B = %s Shanked %s!
KNIFE_MESSAGE_C = %s Pulled A Knife On %s!
KNIFE_MESSAGE_D = %s Knived %s!
MESSAGENOHP_A = %i terrorist vs %i CT^n%s: Now It All Depends On You!
MESSAGENOHP_B =%i terrorist vs %i CT^n%s: I Hope You Still Have A Healthpack.
MESSAGENOHP_C =%i terrorist vs %i CT^n%s: All Your Teammates Were Killed. Good Luck!
MESSAGENOHP_D =%i terrorist vs %i CT^n%s: Now Your Are Alone. Have Fun!
MESSAGEHP_A = %i terrorist vs %i CT^n%s (%i hp): Now It All Depends On You!
MESSAGEHP_B = %i terrorist vs %i CT^n%s (%i hp): I Hope You Still Have A Healthpack.
MESSAGEHP_C = %i terrorist vs %i CT^n%s (%i hp): All Your Teammates Were Killed. Good Luck!
MESSAGEHP_D = %i terrorist vs %i CT^n%s (%i hp): Now Your Are Alone. Have Fun!
PREPARE = Prepare To Fight!
KILLSTREAK = * You are on a killstreak with %d kills.
DEATHSTREAK = * Take care, you are on a deathstreak with %d deaths in a row.
HEADSHOTKILL = ::HeadShot::^nYou Pwned %s!
Dizzy is offline
Send a message via AIM to Dizzy
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-28-2006 , 02:07   Re: A Couple Questions
Reply With Quote #2

Format the messages in plugin_init. I'm think you can use format with ML strings.

First clean up your global variables make a define like so:
Code:
#define MAX_MSG_LEN 64 new stkmessages[LEVELS][MAX_MSG_LEN]

Then in plugin_init format your messages like so:
Code:
format(stkmessages[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "KILL_STREAK_A"); // or however you format it..

You may want to use enums as well.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.

Last edited by v3x; 06-28-2006 at 02:10.
v3x is offline
Dizzy
Veteran Member
Join Date: Jun 2004
Location: Massachusetts
Old 06-28-2006 , 12:32   Re: A Couple Questions
Reply With Quote #3

Heya v3x, thanks for that, just one problem, I didn't understand what you meant when you were talking about the global variables.

I put the formats in the plugin_init

Here are my errors
Code:
//// ultimate_sounds.sma
// C:\HLDS\cstrike\addons\amxmodx\scripting\ultimate_sounds.sma(49) : error 017:
 undefined symbol "stkmessages"
// C:\HLDS\cstrike\addons\amxmodx\scripting\ultimate_sounds.sma(49) : warning 21
5: expression has no effect
// C:\HLDS\cstrike\addons\amxmodx\scripting\ultimate_sounds.sma(49) : error 001:
 expected token: ";", but found "]"
// C:\HLDS\cstrike\addons\amxmodx\scripting\ultimate_sounds.sma(49) : error 029:
 invalid expression, assumed zero
// C:\HLDS\cstrike\addons\amxmodx\scripting\ultimate_sounds.sma(49) : fatal erro
r 107: too many error messages on one line
//
// Compilation aborted.
// 4 Errors.
// Could not locate output file compiled\ultimate_sounds.amx (compile failed).
//
// Compilation Time: 0.19 sec
// ----------------------------------------
And here is my script:

Code:
/////////////////////////////////////////////////// //AMXMOD[X]                                      // //  ::Ultimate sounds::                          // //    by Hephaistos ([email protected])       // //    edited by Dizzy ([email protected])   // //                                               // //  cvar:                                        // //    streak_mode < flags >                      // //    "a" - messages                             // //    "b" - sounds                               // //                                               // //  kniff_mode < flags >                         // //    "a" - messages                             // //    "b" - sounds                               // //                                               // //  hs_mode < flags >                            // //    "a" - messages                             // //    "b" - sounds                               // //                                               // //  lastman_mode < flags >                       // //    "a" - messages                             // //    "b" - hp                                   // //    "c" - sounds                               // /////////////////////////////////////////////////// #include <amxmodx> #define MAX_MSG_LEN 64 public plugin_init() {     register_plugin("Ultimate Sound","1.0","Dizzy")     register_dictionary("ultimatesounds.txt")     register_event("DeathMsg","hs","a","3=1")     register_event("DeathMsg","knife_kill","a","4&kni")     register_event("ResetHUD", "reset_hud", "b");     register_event("DeathMsg", "death_event", "a")     register_event("SendAudio","roundend_msg","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")     register_event("TextMsg","roundend_msg","a","2&#Game_C","2&#Game_w")     register_event("DeathMsg","death_msg","a")     register_cvar("lastman_mode","abc")     register_cvar("streak_mode","ab")     register_cvar("kniff_mode","ab")     register_cvar("hs_mode","ab")     format(stkmessages[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "KILL_STREAK_A")     format(stkmessages[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "KILL_STREAK_B")     format(stkmessages[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "KILL_STREAK_C")     format(stkmessages[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "KILL_STREAK_D")     format(stkmessages[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "KILL_STREAK_E")     format(stkmessages[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "KILL_STREAK_F")     format(stkmessages[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "KILL_STREAK_G")     format(kniffmessages[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "KNIFE_MESSAGE_A")     format(kniffmessages[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "KNIFE_MESSAGE_B")     format(kniffmessages[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "KNIFE_MESSAGE_C")     format(kniffmessages[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "KNIFE_MESSAGE_D")     format(messagesnohp[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "MESSAGENOHP_A")     format(messagesnohp[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "MESSAGENOHP_B")     format(messagesnohp[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "MESSAGENOHP_C")     format(messagesnohp[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "MESSAGENOHP_D")     format(messageshp[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "MESSAGEHP_A")     format(messageshp[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "MESSAGEHP_B")     format(messageshp[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "MESSAGEHP_C")     format(messageshp[0], MAX_MSG_LEN - 1, "%L", LANG_SERVER, "MESSAGEHP_D")     return PLUGIN_CONTINUE } public plugin_precache() {     precache_sound("misc/monsterkill.wav")     precache_sound("misc/godlike.wav")     precache_sound("misc/headshot.wav")     precache_sound("misc/humiliation.wav")     precache_sound("misc/killingspree.wav")     precache_sound("misc/multikill.wav")     precache_sound("misc/ultrakill.wav")     precache_sound("misc/maytheforce.wav")     precache_sound("misc/oneandonly.wav")     precache_sound("misc/prepare.wav")     precache_sound("misc/rampage.wav")     precache_sound("misc/holyshit.wav")     return PLUGIN_CONTINUE } #define KNIFFMESSAGES 4 #define LEVELS 7 #define MESSAGESNOHP 4 #define MESSAGESHP 4 new kills[33] = {0,...}; new deaths[33] = {0,...}; new alone_ann = 0 new levels[7] = { 3, 5, 7, 9, 10, 13, 15 } new stksounds[7][] = { "misc/multikill", "misc/ultrakill", "misc/monsterkill", "misc/killingspree", "misc/rampage", "misc/holyshit", "misc/godlike" } new stkmessages[7][] = { "%L", LANG_SERVER, "KILL_STREAK_A", "%L", LANG_SERVER, "KILL_STREAK_B", "%L", LANG_SERVER, "KILL_STREAK_C", "%L", LANG_SERVER, "KILL_STREAK_D", "%L", LANG_SERVER, "KILL_STREAK_E", "%L", LANG_SERVER, "KILL_STREAK_F", "%L", LANG_SERVER, "KILL_STREAK_G" } new kniffmessages[KNIFFMESSAGES][] = { "%L", LANG_SERVER, "KNIFE_MESSAGE_A", "%L", LANG_SERVER, "KNIFE_MESSAGE_B", "%L", LANG_SERVER, "KNIFE_MESSAGE_C", "%L", LANG_SERVER, "KNIFE_MESSAGE_D" } new messagesnohp[MESSAGESNOHP][] = { "%L", LANG_SERVER, "MESSAGENOHP_A", "%L", LANG_SERVER, "MESSAGENOHP_B", "%L", LANG_SERVER, "MESSAGENOHP_C", "%L", LANG_SERVER, "MESSAGENOHP_D" } new messageshp[MESSAGESHP][] = { "%L", LANG_SERVER, "MESSAGEHP_A", "%L", LANG_SERVER, "MESSAGEHP_B", "%L", LANG_SERVER, "MESSAGEHP_C", "%L", LANG_SERVER, "MESSAGEHP_D" } get_streak() {     new streak[3]     get_cvar_string("streak_mode",streak,2)     return read_flags(streak) } public death_event(id) {     new streak = get_streak()     if ((streak&1) || (streak&2))     {             new killer = read_data(1);             new victim = read_data(2);             kills[killer] += 1;             kills[victim] = 0;             deaths[killer] = 0;             deaths[victim] += 1;             for (new i = 0; i < LEVELS; i++)         {                 if (kills[killer] == levels[i])             {                      announce(killer, i);                      return PLUGIN_CONTINUE;             }         }     }     return PLUGIN_CONTINUE; } announce(killer, level) {     new streak = get_streak()     if (streak&1)     {             new name[32];         get_user_name(killer, name, 32);         set_hudmessage(0, 100, 200, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2);         show_hudmessage(0, stkmessages[level], name);     }     if (streak&2){             client_cmd(0, "spk %s", stksounds[level]);     } } public reset_hud(id) {     set_hudmessage(200, 0, 0, -1.0, 0.30, 0, 3.0, 3.0, 0.15, 0.15, 1)     show_hudmessage(0, "%L", LANG_SERVER, "PREPARE")     client_cmd(0,"spk misc/prepare")     new streak = get_streak()     if (streak&1)     {         if (kills[id] > levels[0])         {                 client_print(id, print_chat, "%L", LANG_SERVER,             "KILLSTREAK", kills[id]);         }         else if (deaths[id] > 1)         {             client_print(id, print_chat, "%L", LANG_SERVER,             "DEATHSTREAK", deaths[id]);         }     } } public client_connect(id) {     new streak = get_streak()     if ((streak&1) || (streak&2))     {         kills[id] = 0;         deaths[id] = 0;     } } public knife_kill() {     new kniffmode[4]     get_cvar_string("kniff_mode",kniffmode,4)     new kniffmode_bit = read_flags(kniffmode)     if (kniffmode_bit & 1)     {         new killer_id = read_data(1)         new victim_id = read_data(2)         new killer_name[33], victim_name[33]         get_user_name(killer_id,killer_name,33)         get_user_name(victim_id,victim_name,33)         set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)         show_hudmessage(0,kniffmessages[ random_num(0,KNIFFMESSAGES-1) ],killer_name,victim_name)     }     if (kniffmode_bit & 2)     {         client_cmd(0,"spk misc/humiliation")     } } public roundend_msg(id)     alone_ann = 0 public death_msg(id) {     new lmmode[8]     get_cvar_string("lastman_mode",lmmode,8)     new lmmode_bit = read_flags(lmmode)     new players_ct[32], players_t[32], ict, ite, last     get_players(players_ct,ict,"ae","CT")       get_players(players_t,ite,"ae","TERRORIST")       if (ict==1&&ite==1)     {         new name1[32], name2[32]         get_user_name(players_ct[0],name1,32)         get_user_name(players_t[0],name2,32)         set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)         if (lmmode_bit & 1)         {             if (lmmode_bit & 2)             {                 show_hudmessage(0,"%s (%i hp) vs. %s (%i hp)",name1,get_user_health(players_ct[0]),name2,get_user_health(players_t[0]))             }             else             {                 show_hudmessage(0,"%s vs. %s",name1,name2)             }             if (lmmode_bit & 4)             {                 client_cmd(0,"spk misc/maytheforce")             }         }     }     else {       if (ict==1&&ite>1&&alone_ann==0&&(lmmode_bit & 4))     {         last=players_ct[0]         client_cmd(last,"spk misc/oneandonly")     }     else if (ite==1&&ict>1&&alone_ann==0&&(lmmode_bit & 4))     {         last=players_t[0]         client_cmd(last,"spk misc/oneandonly")     }     else     {         return PLUGIN_CONTINUE     }     alone_ann = last     new name[32]       get_user_name(last,name,32)     if (lmmode_bit & 1)     {         set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)         if (lmmode_bit & 2)         {             show_hudmessage(0,messageshp[ random_num(0,MESSAGESHP-1) ],ite ,ict ,name,get_user_health(last))         }         else         {             show_hudmessage(0,messagesnohp[ random_num(0,MESSAGESNOHP-1) ],ite ,ict ,name )         }     }     if (lmmode_bit & 4)     {         client_cmd(last,"spk misc/maytheforce")     } }     return PLUGIN_CONTINUE   } public hs() {     new hsmode[4]     get_cvar_string("hs_mode",hsmode,4)     new hsmode_bit = read_flags(hsmode)     if (hsmode_bit & 1)     {     new killer_id = read_data(1)     new victim_id = read_data(2)     new victim_name[33]     get_user_name(victim_id,victim_name,33)     set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 3.0, 3.0, 0.15, 0.15, 1)     show_hudmessage(killer_id, "%L", LANG_SERVER, "HEADSHOTKILL",victim_name)     }     if (hsmode_bit & 2)     {         client_cmd(0,"spk misc/headshot")     } }
Dizzy is offline
Send a message via AIM to Dizzy
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-29-2006 , 08:06   Re: A Couple Questions
Reply With Quote #4

Ugh,

Put all of your global variables and defines BEFORE the plugin_init forward and then format the global vars like so:

Change this:
new stkmessages[7][] =
{
"%L", LANG_SERVER, "KILL_STREAK_A",
"%L", LANG_SERVER, "KILL_STREAK_B",
"%L", LANG_SERVER, "KILL_STREAK_C",
"%L", LANG_SERVER, "KILL_STREAK_D",
"%L", LANG_SERVER, "KILL_STREAK_E",
"%L", LANG_SERVER, "KILL_STREAK_F",
"%L", LANG_SERVER, "KILL_STREAK_G"
}

to this:

new stkmessages[LEVELS][MAX_MSG_LEN]
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.

Last edited by v3x; 06-29-2006 at 08:07. Reason: text editor is retarded
v3x 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 08:08.


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